This commit is contained in:
BianLzhaoMin 2025-12-30 10:26:20 +08:00
parent c08663c861
commit 0cfd021035
1 changed files with 28 additions and 4 deletions

View File

@ -122,16 +122,40 @@ export default {
personExitFormRules: { personExitFormRules: {
fileList: [ fileList: [
{ {
required: true,
trigger: 'change,blur', trigger: 'change,blur',
required: this.checkExitFileFun() == 1, validator: this.validateFileList,
message: '请上传离场工资结算确认单',
}, },
], ],
}, },
needExitFile: false,
} }
}, },
methods: { 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() { onHandleConfirmAddOrEditFun() {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (this.isExitUpload === 1) { if (this.isExitUpload === 1) {
@ -236,7 +260,7 @@ export default {
handler(newVal) { handler(newVal) {
if (Object.keys(newVal).length > 0) { if (Object.keys(newVal).length > 0) {
Object.assign(this.personExitFormData, newVal) Object.assign(this.personExitFormData, newVal)
this.checkExitFileFun() this.initExitFileRule()
} }
}, },
deep: true, deep: true,