|
@@ -662,33 +662,50 @@
|
|
|
let _this = this
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
let _list = list
|
|
|
+ let _num = 0
|
|
|
const waitForEach = function () {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- _this.inputForm.cwWorkClientContactDTOList.forEach((client, index) => {
|
|
|
- if (_this.inputForm.customerNo === client.no) {
|
|
|
- _this.$refs.contactTable.remove(client)
|
|
|
- _this.inputForm.cwWorkClientContactDTOList.splice(index, 1)
|
|
|
- // _this.$message.error('已存在客户 “' + client.name + '”,请重新选择')
|
|
|
- // throw new Error('已存在客户 “' + client.name + '”,请重新选择')
|
|
|
- }
|
|
|
- })
|
|
|
- resolve()
|
|
|
+ if (_this.commonJS.isEmpty(_this.inputForm.cwWorkClientContactDTOList)) {
|
|
|
+ resolve()
|
|
|
+ } else {
|
|
|
+ _this.inputForm.cwWorkClientContactDTOList.forEach((client, index) => {
|
|
|
+ if (_this.inputForm.customerNo === client.no) {
|
|
|
+ _this.$refs.contactTable.remove(client)
|
|
|
+ _this.inputForm.cwWorkClientContactDTOList.splice(index, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ resolve()
|
|
|
+ }, 400)
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
waitForEach().then(() => {
|
|
|
- // eslint-disable-next-line no-unused-vars
|
|
|
- let item = {
|
|
|
- no: list.no,
|
|
|
- name: list.name
|
|
|
- }
|
|
|
- // console.log('list', list)
|
|
|
this.inputForm.customerNo = list.no
|
|
|
this.inputForm.uscCode = list.uscCode
|
|
|
this.inputForm.address = list.address
|
|
|
this.inputForm.customerId = list.id
|
|
|
- this.inputForm.cwWorkClientContactDTOList.push(item)
|
|
|
this.inputForm.clientContacts = list.name
|
|
|
this.inputForm.clientContactsPhone = list.mobile
|
|
|
+ const wait = function () {
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ _this.inputForm.cwWorkClientContactDTOList.forEach(client => {
|
|
|
+ if (_list.no === client.no) {
|
|
|
+ _num = 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ resolve()
|
|
|
+ }, 100)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ wait().then(() => {
|
|
|
+ if (_num === 0) {
|
|
|
+ this.inputForm.cwWorkClientContactDTOList.push({no: list.no, name: list.name})
|
|
|
+ this.$refs.contactTable.insertAt({no: list.no, name: list.name})
|
|
|
+ this.tableKeyClient = Math.random()
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
// 表单提交
|