From 763bec8077191e42a779e8f77e5126e5dd09b27f Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期三, 14 五月 2025 14:32:43 +0800 Subject: [PATCH] feat: 接口 --- src/views/Reward/components/WithdrawalApprovalAuditDialog.vue | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 255 insertions(+), 0 deletions(-) diff --git a/src/views/Reward/components/WithdrawalApprovalAuditDialog.vue b/src/views/Reward/components/WithdrawalApprovalAuditDialog.vue new file mode 100644 index 0000000..bdb9a5a --- /dev/null +++ b/src/views/Reward/components/WithdrawalApprovalAuditDialog.vue @@ -0,0 +1,255 @@ +<template> + <ProDialog :title="title" v-model="visible" @close="onDialogClose" destroy-on-close draggable> + <PortraitTableWithAttachment v-bind="portraitTableWithAttachmentProps" /> + <ProForm + :model="form" + ref="dialogForm" + label-width="90px" + style="margin-top: 20px" + :is-read="form.isCheck" + > + <ProFormCol> + <ProFormColItem :span="12"> + <ProFormItemV2 + label="瀹℃牳:" + prop="checkStatus" + :check-rules="[{ message: '璇烽�夋嫨瀹℃牳鐘舵��' }]" + > + <ProFormRadio + v-model="form.checkStatus" + :value-enum="EnterpriseRechargeStatusEnumTextForAdudit" + /> + </ProFormItemV2> + </ProFormColItem> + </ProFormCol> + <ProFormCol v-if="form.isCheck"> + <ProFormColItem :span="12"> + <ProFormItemV2 label="瀹℃牳鏃ユ湡:" prop="creationTime"> + <ProFormDatePicker v-model="form.creationTime" type="date" format="YYYY-MM-DD HH:mm" /> + </ProFormItemV2> + </ProFormColItem> + </ProFormCol> + <ProFormCol> + <ProFormColItem :span="12"> + <ProFormItemV2 + label="涓婁紶鍑瘉:" + prop="checkFileUrl" + :required="form.checkStatus === EnterpriseRechargeStatusEnum.CheckPassed" + :check-rules="[ + { + message: '璇蜂笂浼犲嚟璇�', + validator: (rule, value, callback) => { + if ( + value?.length === 0 && + form.checkStatus === EnterpriseRechargeStatusEnum.CheckPassed + ) { + callback(new Error('璇蜂笂浼犲嚟璇�')); + } + callback(); + }, + }, + ]" + > + <ProFormUpload + v-model:file-url="form.checkFileUrl" + :limit="1" + :showTip="false" + :limitFileSize="50" + ></ProFormUpload> + </ProFormItemV2> + </ProFormColItem> + </ProFormCol> + + <ProFormCol> + <ProFormColItem> + <ProFormItemV2 + label="瀹℃牳鐞嗙敱:" + prop="checkRemark" + :required="form.checkStatus === EnterpriseRechargeStatusEnum.CheckReject" + :check-rules="[ + { + message: '璇疯緭鍏ュ鏍哥悊鐢�', + validator: (rule, value, callback) => { + if (!value && form.checkStatus === EnterpriseRechargeStatusEnum.CheckReject) { + callback(new Error('璇疯緭鍏ラ┏鍥炵悊鐢�')); + } + callback(); + }, + }, + ]" + > + <ProFormTextArea + v-model="form.checkRemark" + placeholder="璇疯緭鍏�" + show-word-limit + :maxlength="150" + ></ProFormTextArea> + </ProFormItemV2> + </ProFormColItem> + </ProFormCol> + </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 } from 'element-plus'; +import { + ProDialog, + ProForm, + ProFormItemV2, + ProFormTextArea, + ProFormCol, + ProFormColItem, + ProFormRadio, + ProFormUpload, + ProFormDatePicker, + UploadUserFile, +} from '@bole-core/components'; +import * as parkBountyApplyServices from '@/services/api/ParkBountyApply'; +import { usePortraitTableWithAttachment } from '@/hooks'; +import { convertApi2FormUrl, convertApi2FormUrlOnlyOne } from '@/utils'; +import { useQuery } from '@tanstack/vue-query'; +import { + EnterpriseRechargeStatusEnum, + EnterpriseRechargeStatusEnumTextForAdudit, +} from '@/constants'; + +defineOptions({ + name: 'WithdrawalApprovalAuditDialog', +}); + +// type Props = {}; + +// const props = withDefaults(defineProps<Props>(), {}); + +const visible = defineModel({ type: Boolean }); + +type Form = { + title?: string; + drawWithId: string; + checkStatus: EnterpriseRechargeStatusEnum; + checkRemark: string; + creationTime?: string; + isCheck: boolean; + checkFileUrl: UploadUserFile[]; +}; + +const form = defineModel<Form>('form'); + +const title = computed(() => (form.value?.isCheck ? '璇︽儏' : '鎻愮幇瀹℃壒')); + +const emit = defineEmits<{ + (e: 'onConfirm'): void; + (e: 'onCancel'): void; +}>(); + +watch( + () => visible.value, + (val) => { + if (val) { + refetch(); + } + } +); + +const { + data: detail, + refetch, + isLoading, +} = useQuery({ + queryKey: ['parkBountyApplyServices/getEnterpriseDrawWithDetail', form.value?.drawWithId], + queryFn: async () => { + return await parkBountyApplyServices.getEnterpriseDrawWithDetail( + { + drawWithId: form.value?.drawWithId, + }, + { + showLoading: true, + } + ); + }, + placeholderData: () => ({} as API.GetEnterpriseDrawWithDetailOutput), + enabled: !!form.value?.drawWithId, + onSuccess(data) { + form.value.checkRemark = data.checkRemark ?? ''; + form.value.creationTime = data.creationTime ?? ''; + form.value.checkStatus = form.value?.isCheck + ? data.checkStatus + : ('' as any as EnterpriseRechargeStatusEnum); + form.value.checkFileUrl = convertApi2FormUrlOnlyOne(data.checkFileUrl); + }, +}); + +const { portraitTableWithAttachmentProps } = usePortraitTableWithAttachment({ + data: detail, + annexList: computed(() => + detail.value?.invoiceUrl + ? detail.value?.invoiceUrl.split('|').map((item) => convertApi2FormUrl(item)) + : [] + ), + columns: [ + { + label: '浼佷笟鍚嶇О', + key: 'enterpriseName', + }, + { + label: '缁熶竴绀句細淇$敤浠g爜', + key: 'societyCreditCode', + }, + { + label: '璐︽埛鍚嶇О', + key: 'accountName', + }, + { + label: '閾惰甯愬彿', + key: 'bankNumber', + }, + { + label: '寮�鎴烽摱琛�', + key: 'bankName', + }, + { + label: '寮�鎴锋敮琛�', + key: 'bankResumeName', + }, + { + label: '鎻愮幇閲戦', + key: 'amount', + type: 'money', + }, + { + label: '鐢宠鏃ユ湡', + key: 'creationTime', + type: 'date', + }, + ], +}); + +const dialogForm = ref<FormInstance>(); + +function onDialogClose() { + if (!dialogForm.value) return; + dialogForm.value.resetFields(); +} + +function handleConfirm() { + if (!dialogForm.value) return; + if (form.value?.isCheck) { + emit('onCancel'); + return; + } + dialogForm.value.validate((valid) => { + if (valid) { + emit('onConfirm'); + } else { + return; + } + }); +} +</script> -- Gitblit v1.9.1