From 63e03e782c42ae25b19c134f0122ebea25289907 Mon Sep 17 00:00:00 2001 From: lynn Date: Sun, 27 Apr 2025 17:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BC=96=E8=BE=91=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/contractList.vue | 100 ++++++++++++++++------------ 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index b97b176..0967245 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -2107,27 +2107,66 @@ export default { this.getTemplateConfig(); } else if (this.currentStep === 2) { // 验证基本信息表单 - this.$refs.basicInfoForm.validate((valid) => { - if (valid) { - // 在进入第三步之前,确保所有必要的数据都被正确设置 - if (!this.form.type) { - this.form.type = ''; - } - if (!this.form.contract_carry_department) { - this.form.contract_carry_department = []; - } - if (!this.form.moneyWay) { - this.form.moneyWay = []; - } - - // 如果存在事前支付表格,则跳转到事前支付表格 - if (this.form.before_contract_template) { - this.form.showAfterPayment = false; - } + 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'); + } - this.currentStep++; + // 检查显示的表单项是否都已填写 + 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 = ''; + } + if (!this.form.contract_carry_department) { + this.form.contract_carry_department = []; + } + if (!this.form.moneyWay) { + this.form.moneyWay = []; + } + + // 如果存在事前支付表格,则跳转到事前支付表格 + if (this.form.before_contract_template) { + this.form.showAfterPayment = false; + } + + this.currentStep++; } else if (this.currentStep === 3) { this.currentStep++; } @@ -2184,31 +2223,6 @@ export default { } }, - validateCurrentStep() { - if (this.currentStep === 1) { - if (!this.form.category || !this.form.affairType || !this.form.contractType || - !this.form.purchaseForm || !this.form.purchaseMethod) { - this.$Message.warning('请填写所有必填项') - return false - } - - // 获取模版配置参数 - this.getTemplateConfig() - return false // 等待配置参数获取完成 - } else if (this.currentStep === 2) { - // 使用表单验证进行校验 - let isValid = false - this.$refs.basicInfoForm.validate(valid => { - isValid = valid - if (!valid) { - this.$Message.warning('请填写所有必填项') - } - }) - return isValid - } - return true - }, - // 获取模版配置参数 async getTemplateConfig() { try {