From 2174f758e8a963964198e092f0d528ef1ae9b81e Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期二, 22 七月 2025 09:59:05 +0800 Subject: [PATCH] feat: 页面 --- src/views/Reward/components/BatchRegisterDialog.vue | 214 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 214 insertions(+), 0 deletions(-) diff --git a/src/views/Reward/components/BatchRegisterDialog.vue b/src/views/Reward/components/BatchRegisterDialog.vue new file mode 100644 index 0000000..a3f1014 --- /dev/null +++ b/src/views/Reward/components/BatchRegisterDialog.vue @@ -0,0 +1,214 @@ +<template> + <ProDialog + title="鎵归噺鐧昏" + v-model="visible" + @close="onDialogClose" + destroy-on-close + draggable + width="700px" + > + <ProForm :model="form" ref="dialogForm" label-width="120px"> + <ProFormItemV2 prop="ids" class="pro-form-item-label-hidden"> + <div class="batchEntryRewardBody"> + <el-transfer + v-model="deleteList" + filterable + :filter-method="filterMethod" + filter-placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" + :data="form.companyList" + :titles="['鐧昏', '涓嶇櫥璁�']" + :props="prop" + @change="handleChange" + /> + </div> + </ProFormItemV2> + <ProFormItemV2 label="鐧昏绫诲瀷:" prop="incomeType" required> + <ProFormRadio + v-model="form.incomeType" + :value-enum="incomeTypeEnum" + :button-style="false" + @change="handleIncomeTypeChange" + /> + </ProFormItemV2> + <ProFormItemV2 + label="鐧昏閲戦:" + prop="amount" + :check-rules="[{ message: '璇疯緭鍏ョ櫥璁伴噾棰�', type: 'number' }]" + > + <ProFormInputNumber + v-model="form.amount" + :controls="false" + :min="0" + unit="鍏�" + :precision="2" + ></ProFormInputNumber> + </ProFormItemV2> + <ProFormItemV2 + label="涓婁紶鐧昏鍑瘉:" + prop="certificateUrl" + :check-rules="[{ message: '璇蜂笂浼犵櫥璁板嚟璇�', type: 'upload' }]" + > + <ProFormUpload + v-model:file-url="form.certificateUrl" + :limitFileSize="50" + accept="doc,docx,pdf,xls,xlsx,jpg/jpeg,png" + ></ProFormUpload> + </ProFormItemV2> + </ProForm> + <template #footer> + <span class="dialog-footer"> + <el-button @click="emit('onCancel')">鍙� 娑�</el-button> + <el-button type="primary" @click="handleConfirm">纭� 瀹�</el-button> + </span> + </template> + </ProDialog> +</template> + +<script setup lang="ts"> +import { FormInstance, TransferPropsAlias } from 'element-plus'; +import { + ProDialog, + ProForm, + ProFormItemV2, + ProFormInputNumber, + ProFormRadio, + ProFormUpload, + UploadUserFile, +} from '@bole-core/components'; +import { Message } from '@bole-core/core'; +import { IncomeTypeEnumText, IncomeTypeEnum } from '@/constants'; +import * as parkBountyApplyServices from '@/services/api/ParkBountyApply'; + +defineOptions({ + name: 'BatchRegisterDialog', +}); + +type Props = { + /** + * @deprecated + */ + financeSumAmount?: number; +}; + +const props = withDefaults(defineProps<Props>(), {}); + +const visible = defineModel({ type: Boolean }); + +type Form = { + title?: string; + parkBountyApplyDetailIds: string[]; + amount: number; + companyList: API.GetNotTransferCompanyNameListOutput[]; + incomeType: IncomeTypeEnum; + parkBountyApplyId: string; + showSuportPlatRecharge: boolean; + + certificateUrl: UploadUserFile[]; +}; + +const form = defineModel<Form>('form'); + +const incomeTypeEnum = computed(() => { + return [ + { + label: IncomeTypeEnumText[IncomeTypeEnum.Fiscal], + value: IncomeTypeEnum.Fiscal, + }, + form.value.showSuportPlatRecharge && { + label: IncomeTypeEnumText[IncomeTypeEnum.Platform], + value: IncomeTypeEnum.Platform, + }, + ].filter(Boolean); +}); + +const deleteList = ref<string[]>([]); + +watch(visible, (value, oldValue) => { + if (value && !oldValue) { + getParkBountyApplyBatchFinanceEnterprise(); + } +}); + +async function getParkBountyApplyBatchTransferEnterprise() { + try { + let res = await parkBountyApplyServices.getParkBountyApplyBatchTransferEnterprise({ + parkBountyApplyId: form.value.parkBountyApplyId, + }); + if (res) { + form.value.companyList = res; + form.value.parkBountyApplyDetailIds = res.map((x) => x.parkBountyApplyDetailId); + deleteList.value = []; + } + } catch (error) {} +} + +async function getParkBountyApplyBatchFinanceEnterprise() { + try { + let res = await parkBountyApplyServices.getParkBountyApplyBatchFinanceEnterprise({ + parkBountyApplyId: form.value.parkBountyApplyId, + }); + if (res) { + form.value.companyList = res; + form.value.parkBountyApplyDetailIds = res.map((x) => x.parkBountyApplyDetailId); + deleteList.value = []; + } + } catch (error) {} +} +function handleIncomeTypeChange() { + if (form.value.incomeType === IncomeTypeEnum.Fiscal) { + getParkBountyApplyBatchFinanceEnterprise(); + } else { + getParkBountyApplyBatchTransferEnterprise(); + } +} + +function handleChange(ids: string[]) { + form.value.parkBountyApplyDetailIds = form.value.companyList + .filter((item) => !ids.includes(item.companyId)) + .map((item) => item.parkBountyApplyDetailId); +} + +const emit = defineEmits<{ + (e: 'onConfirm'): void; + (e: 'onCancel'): void; +}>(); + +const dialogForm = ref<FormInstance>(); + +function onDialogClose() { + if (!dialogForm.value) return; + dialogForm.value.resetFields(); +} + +function handleConfirm() { + if (!form.value.parkBountyApplyDetailIds.length) { + Message.warnMessage('璇烽�夋嫨鍏ヨ处浼佷笟'); + return; + } + if (!dialogForm.value) return; + dialogForm.value.validate((valid) => { + if (valid) { + emit('onConfirm'); + } else { + return; + } + }); +} + +const prop = { + label: 'name', + key: 'companyId', +} as TransferPropsAlias; + +const filterMethod = (query: string, item: API.GetCompanyNameListOutput) => { + return item.name.toLowerCase().includes(query.toLowerCase()); +}; +</script> + +<style lang="scss" scoped> +.batchEntryRewardBody { + display: flex; + justify-content: center; + width: 100%; +} +</style> -- Gitblit v1.9.1