|
|
|
|
@ -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 = [];
|
|
|
|
|
}
|
|
|
|
|
const visibleFields = [];
|
|
|
|
|
|
|
|
|
|
// 如果存在事前支付表格,则跳转到事前支付表格
|
|
|
|
|
if (this.form.before_contract_template) {
|
|
|
|
|
this.form.showAfterPayment = false;
|
|
|
|
|
}
|
|
|
|
|
// 检查项目名称是否显示
|
|
|
|
|
if (this.showFields.projectName) {
|
|
|
|
|
visibleFields.push('name');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 检查项目类型是否显示
|
|
|
|
|
if (this.showFields.projectType) {
|
|
|
|
|
visibleFields.push('type');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 检查预算价格是否显示
|
|
|
|
|
if (this.showFields.budgetPrice) {
|
|
|
|
|
visibleFields.push('price');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.currentStep++;
|
|
|
|
|
// 检查资金渠道是否显示
|
|
|
|
|
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 = '';
|
|
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
|
|