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

master
linyongLynn 3 months ago
parent 5d0a39b761
commit 9909acbb71

@ -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' }]"
>
<el-input
v-model="form.supply"
@ -2189,7 +2189,66 @@ export default {
//
async submit() {
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) {
@ -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 = ''

Loading…
Cancel
Save