From 0cfd0210353660b93d357c1eb446e0a0ed460975 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Tue, 30 Dec 2025 10:26:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../person-exit/person-exit-form.vue | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/views/construction-person/entry-and-exit-manage/person-exit/person-exit-form.vue b/src/views/construction-person/entry-and-exit-manage/person-exit/person-exit-form.vue index 3789423..9a9f31a 100644 --- a/src/views/construction-person/entry-and-exit-manage/person-exit/person-exit-form.vue +++ b/src/views/construction-person/entry-and-exit-manage/person-exit/person-exit-form.vue @@ -122,16 +122,40 @@ export default { personExitFormRules: { fileList: [ { + required: true, trigger: 'change,blur', - required: this.checkExitFileFun() == 1, - message: '请上传离场工资结算确认单', + validator: this.validateFileList, }, ], }, + needExitFile: false, } }, methods: { - // 确定按钮 + async initExitFileRule() { + if (!this.personExitFormData.proId) { + return + } + const result = await this.checkExitFileFun() + + this.needExitFile = result == 1 + if (this.needExitFile) { + this.personExitFormRules.fileList[0].required = true + } else { + this.personExitFormRules.fileList[0].required = false + } + }, + validateFileList(rule, value, callback) { + if (this.needExitFile) { + if (!value || value.length === 0) { + callback(new Error('请上传离场工资结算确认单')) + } else { + callback() + } + } else { + callback() + } + }, onHandleConfirmAddOrEditFun() { return new Promise(async (resolve, reject) => { if (this.isExitUpload === 1) { @@ -236,7 +260,7 @@ export default { handler(newVal) { if (Object.keys(newVal).length > 0) { Object.assign(this.personExitFormData, newVal) - this.checkExitFileFun() + this.initExitFileRule() } }, deep: true,