diff --git a/src/views/contractManagement/expenditureContract/modules/ExpenditureContractModule.vue b/src/views/contractManagement/expenditureContract/modules/ExpenditureContractModule.vue index 968dd8b..b1e5283 100644 --- a/src/views/contractManagement/expenditureContract/modules/ExpenditureContractModule.vue +++ b/src/views/contractManagement/expenditureContract/modules/ExpenditureContractModule.vue @@ -309,7 +309,7 @@ export default { }, principalId: { rules: [{ required: true, message: '请选择负责人' }], - validateTrigger: 'blur' + validateTrigger: 'change' }, contractAmount: { rules: [{ required: true, validator: this.checkMoney }], @@ -527,15 +527,21 @@ export default { * @param value */ principalChange(value) { - let param = { - id: value - } - getAllUserList(param).then(res => { - this.model.departmentName = res.result[0].orgCodeTxt - this.$nextTick(() => { - this.form.setFieldsValue(pick(this.model, 'departmentName')) + // value不为undefined + if (value) { + let param = { + id: value + } + getAllUserList(param).then(res => { + this.model.departmentName = res.result[0].orgCodeTxt + this.$nextTick(() => { + this.form.setFieldsValue(pick(this.model, 'departmentName')) + }) }) - }) + return + } + // value为undefined时清除部门名称 + this.form.setFieldsValue({departmentName: undefined}) }, /** * 总签订金额修改 diff --git a/src/views/contractManagement/revenueContract/modules/RevenueContractModule.vue b/src/views/contractManagement/revenueContract/modules/RevenueContractModule.vue index 1cc827f..2076aa8 100644 --- a/src/views/contractManagement/revenueContract/modules/RevenueContractModule.vue +++ b/src/views/contractManagement/revenueContract/modules/RevenueContractModule.vue @@ -589,19 +589,25 @@ export default { * @param value */ principalChange(value) { - let param = { - id: value - } - getAllUserList(param).then(res => { - if (res.success) { - this.model.departmentName = res.result[0].orgCodeTxt - this.$nextTick(() => { - this.form.setFieldsValue(pick(this.model, 'departmentName')) - }) - } else { - this.$message.warn(res.message) + // value不为undefined + if (value) { + let param = { + id: value } - }) + getAllUserList(param).then(res => { + if (res.success) { + this.model.departmentName = res.result[0].orgCodeTxt + this.$nextTick(() => { + this.form.setFieldsValue(pick(this.model, 'departmentName')) + }) + } else { + this.$message.warn(res.message) + } + }) + return + } + // value为undefined时清除部门名称 + this.form.setFieldsValue({departmentName: undefined}) }, /** * 打包状态修改 diff --git a/src/views/packManagement/modules/BatchInvoicingModule.vue b/src/views/packManagement/modules/BatchInvoicingModule.vue index 3984ca6..e2905b1 100644 --- a/src/views/packManagement/modules/BatchInvoicingModule.vue +++ b/src/views/packManagement/modules/BatchInvoicingModule.vue @@ -283,18 +283,28 @@ export default { */ postContactChange(value) { console.log(value) - getContactsById({ id: value }).then(res => { - let obj = { - postalCode: res.result.postalCode, - contactAddress: res.result.contactAddress - } - if (this.packContactId) { - this.packContact = obj - this.packContact.contactId = value - } else { - this.form.setFieldsValue(pick(obj, 'postalCode', 'contactAddress')) - } - }) + // value不为undefined + if (value) { + getContactsById({ id: value }).then(res => { + let obj = { + postalCode: res.result.postalCode, + contactAddress: res.result.contactAddress + } + if (this.packContactId) { + this.packContact = obj + this.packContact.contactId = value + } else { + this.form.setFieldsValue(pick(obj, 'postalCode', 'contactAddress')) + } + }) + return + } + // value为undefined,清除邮政编码和通讯地址 + const obj = { + postalCode: undefined, + contactAddress: undefined + } + this.form.setFieldsValue(pick(obj, 'postalCode', 'contactAddress')) }, /** * 清空本次开票金额