普通项目、工作组项目关联收入合同校验,bug修改

This commit is contained in:
zhaoxiao
2021-10-19 09:00:03 +08:00
parent 285946ee43
commit cbd2687c58
11 changed files with 177 additions and 93 deletions
@@ -42,7 +42,7 @@
<company-select placeholder="请选择来款企业"
v-decorator="['chargeCompany',validatorRules.chargeCompany]"
@change="companyChange"
:disabled="disabledChargeCompany"
:disabled="disabledCompany"
:maxLength='50'>
</company-select>
</a-form-item>
@@ -187,6 +187,8 @@ import SelectContacts from '@comp/company/SelectContacts'
import { addZero } from '../../../utils/util'
import Vue from 'vue'
import { USER_INFO } from '../../../store/mutation-types'
import { money } from '../../../utils/validate'
import { checkAssociatedProject } from '../../../utils/projectCheck'
export default {
name: 'GeneralProjectModule',
@@ -290,7 +292,7 @@ export default {
validateTrigger: 'change'
},
receivableAmount: {
rules: [{ required: true, message: '请输入应收金额' }],
rules: [{ required: true, validator: this.checkMoney }],
validateTrigger: 'blur'
},
needInvoice: {
@@ -314,6 +316,7 @@ export default {
selectedCompany: null, // 当前选中的企业
selectedContact: null, // 编辑时的联系人
selectedMailContact: null, // 编辑时的邮寄联系人
disabledCompany: false, // 企业是否可以编辑
url: {
add: '/project/payCommonProject/add',
edit: '/project/payCommonProject/edit'
@@ -346,9 +349,16 @@ export default {
companyName: record.chargeCompanyTemporaryName
}
}
// 判断企业是否可以编辑,项目来款、开票、邮寄、打包、关联合同后,企业不可更改
if (record.id) {
// 验证项目是否关联收入合同
checkAssociatedProject(record.id).then(res => {
this.disabledCompany = this.disabledChargeCompany || res || (!!record.inAccount && record.inAccount !== 0) || (!!record.makeInvoice && record.makeInvoice !== 0) || (!!record.mail && record.mail !== 0)
})
} else {
this.disabledCompany = this.disabledChargeCompany
}
// 是否存在从收入合同传入的签订联系人id
console.log(record, this.signedContactId)
record.contactsId = this.signedContactId || record.contactsTemporaryId || undefined
record.mailContactsId = this.signedContactId || record.mailContactsTemporaryId || undefined
// 回显选中的企业
@@ -487,6 +497,22 @@ export default {
this.form.setFieldsValue(pick(this.model, 'mailContactsId'))
})
}
},
/**
* 校验金额格式
* @param rules
* @param value
* @param callback
*/
checkMoney(rules, value, callback) {
console.log(value, rules.field)
if (value) {
if (money(value)) {
callback()
}
callback('请输入正确格式的金额')
}
callback('请输入应收金额')
}
}
}