|
@@ -741,22 +741,58 @@
|
|
|
})
|
|
|
},
|
|
|
getWorkClientChoose2 (list) {
|
|
|
- this.inputForm.primaryLinkman = list.name
|
|
|
- this.inputForm.customerNo = list.no
|
|
|
- this.inputForm.uscCode = list.uscCode
|
|
|
- this.inputForm.address = list.address
|
|
|
- this.inputForm.customerId = list.id
|
|
|
- this.inputForm.clientContactsPhone = list.mobile
|
|
|
- const wait = function () {
|
|
|
+ console.log('list',list)
|
|
|
+ let _this = this
|
|
|
+ // eslint-disable-next-line no-unused-vars
|
|
|
+ let _list = list
|
|
|
+ let _num = 0
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.cwWorkClientContactDTOList)) {
|
|
|
+ this.inputForm.cwWorkClientContactDTOList = []
|
|
|
+ }
|
|
|
+ const waitForEach = function () {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- setTimeout(() => {
|
|
|
+ if (_this.commonJS.isEmpty(_this.inputForm.cwWorkClientContactDTOList)) {
|
|
|
resolve()
|
|
|
- }, 100)
|
|
|
+ } 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)
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
- wait().then(() => {
|
|
|
+ waitForEach().then(() => {
|
|
|
+ this.inputForm.primaryLinkman = list.name
|
|
|
+ this.inputForm.customerNo = list.number
|
|
|
+ this.inputForm.uscCode = list.uscCode
|
|
|
+ this.inputForm.address = list.registerAddress
|
|
|
+ this.inputForm.customerId = list.id
|
|
|
+ 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({number: list.number, name: list.name})
|
|
|
+ this.$refs.contactTable.insertAt({name: list.name,id: list.id,number: list.number})
|
|
|
+ this.tableKeyClient = Math.random()
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- console.log('1231312',this.inputForm.primaryLinkman)
|
|
|
},
|
|
|
// 表单提交
|
|
|
// 暂存
|