[bug] 表单下拉带出信息清除

This commit is contained in:
zhaoxiao
2021-10-28 11:25:55 +08:00
parent f8fdade998
commit 0d03b8dd08
3 changed files with 55 additions and 33 deletions
@@ -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'))
},
/**
* 清空本次开票金额