完成合同类型下供应商非必填

master
linyongLynn 1 year ago
parent 5d0a39b761
commit 9909acbb71

@ -489,7 +489,7 @@
v-show="true" v-show="true"
:label="formType === 'contract' ? '承包商/供应商' : '付款对象'" :label="formType === 'contract' ? '承包商/供应商' : '付款对象'"
prop="supply" prop="supply"
:rules="[{ required: true, message: formType === 'contract' ? '请输入承包商/供应商' : '请输入付款对象', trigger: 'submit' }]" :rules="formType === 'contract' ? [] : [{ required: true, message: '请输入付款对象', trigger: 'submit' }]"
> >
<el-input <el-input
v-model="form.supply" v-model="form.supply"
@ -2189,7 +2189,66 @@ export default {
// 提交新建 // 提交新建
async submit() { async submit() {
try { try {
console.log(this.form.showAfterPayment) // 验证基本信息表单
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 (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) { if (!this.form.showAfterPayment && this.form.before_contract_template) {
@ -2497,50 +2556,6 @@ export default {
// 获取模版配置 // 获取模版配置
this.getTemplateConfig() this.getTemplateConfig()
} else if (this.currentStep === 2) { } 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) { if (!this.form.type) {
this.form.type = '' this.form.type = ''

Loading…
Cancel
Save