From 9909acbb71cf2700e9febb74d1e03c322611ca4a Mon Sep 17 00:00:00 2001 From: linyongLynn <15926056+linyonglynn@user.noreply.gitee.com> Date: Sat, 2 Aug 2025 09:57:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=88=E5=90=8C=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=8B=E4=BE=9B=E5=BA=94=E5=95=86=E9=9D=9E=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/contractList.vue | 107 ++++++++++++++++------------ 1 file changed, 61 insertions(+), 46 deletions(-) diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 74e1936..2504a7d 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -489,7 +489,7 @@ v-show="true" :label="formType === 'contract' ? '承包商/供应商' : '付款对象'" prop="supply" - :rules="[{ required: true, message: formType === 'contract' ? '请输入承包商/供应商' : '请输入付款对象', trigger: 'submit' }]" + :rules="formType === 'contract' ? [] : [{ required: true, message: '请输入付款对象', trigger: 'submit' }]" > { + if (field === 'moneyWay') { + return !this.form.moneyWay || this.form.moneyWay.length === 0 + } else if (field === 'plan') { + return !this.form.plan || this.form.plan.length === 0 + } else { + return !this.form[field] + } + }) + + // 单独检查供应商/付款对象字段 + if (this.formType !== 'contract' && !this.form.supply) { + this.$Message.warning('请输入付款对象') + return + } + + if (missingFields.length > 0) { + // 生成具体的错误提示信息 + const fieldNames = { + name: '项目名称', + type: '项目类型', + price: '合同预算金额', + moneyWay: '资金渠道', + plan: '关联预算计划', + supply: '付款对象' + } + + const missingFieldNames = missingFields.map(field => fieldNames[field] || field).join('、') + this.$Message.warning(`请填写:${missingFieldNames}`) + return + } // 保存事前支付表格的数据 if (!this.form.showAfterPayment && this.form.before_contract_template) { @@ -2497,50 +2556,6 @@ export default { // 获取模版配置 this.getTemplateConfig() } else if (this.currentStep === 2) { - // 验证基本信息表单 - const visibleFields = [] - - // 检查项目名称是否显示 - if (this.showFields.projectName) { - visibleFields.push('name') - } - - // 检查项目类型是否显示 - if (this.showFields.projectType) { - visibleFields.push('type') - } - - // 检查预算价格是否显示 - if (this.showFields.budgetPrice) { - visibleFields.push('price') - } - - // 检查资金渠道是否显示 - if (this.showFields.fundChannel) { - visibleFields.push('moneyWay') - } - - // 检查预算计划是否显示 - if (this.showFields.budgetPlan) { - visibleFields.push('plan') - } - - // 检查显示的表单项是否都已填写 - const missingFields = visibleFields.filter(field => { - if (field === 'moneyWay') { - return !this.form.moneyWay || this.form.moneyWay.length === 0 - } else if (field === 'plan') { - return !this.form.plan || this.form.plan.length === 0 - } else { - return !this.form[field] - } - }) - - if (missingFields.length > 0) { - this.$Message.warning('请填写所有必填项') - return - } - // 在进入第三步之前,确保所有必要的数据都被正确设置 if (!this.form.type) { this.form.type = ''