diff --git a/src/views/claimAndreturn/picking/apply/component/AddPicking1.vue b/src/views/claimAndreturn/picking/apply/component/AddPicking1.vue index 91dc336..1d0f694 100644 --- a/src/views/claimAndreturn/picking/apply/component/AddPicking1.vue +++ b/src/views/claimAndreturn/picking/apply/component/AddPicking1.vue @@ -927,9 +927,28 @@ export default { } } } - } - this.leaseApplyDetails = [...new Set(tempList)] + const newDataList = [...this.leaseApplyDetails, ...tempList] + const map = new Map() + for (let item of newDataList) { + if (!map.has(item.typeId)) { + map.set(item.typeId, item) + } + } + const newArray = [...map.values()] + + let newArray_array = [] + items.forEach((e) => { + newArray.forEach((j) => { + if (e == j.typeId) { + newArray_array.push(j) + } + }) + }) + this.leaseApplyDetails = newArray_array + } else { + this.leaseApplyDetails = [] + } // const templateList = deviceTypeList.map((e) => { // let { num, companyId, id, unitName } = e.data diff --git a/src/views/claimAndreturn/return/apply/component/addReturn1.vue b/src/views/claimAndreturn/return/apply/component/addReturn1.vue index cd93930..f2e55e9 100644 --- a/src/views/claimAndreturn/return/apply/component/addReturn1.vue +++ b/src/views/claimAndreturn/return/apply/component/addReturn1.vue @@ -884,9 +884,11 @@ export default { /** 删除按钮操作 */ handleDelete(row) { this.deviceType.forEach((e, index) => { - if (e[3] === row.typeId) { - this.deviceType.splice(index, 1) - this.propsKey++ + if (e[3] == row.typeId) { + this.$nextTick(() => { + this.deviceType.splice(index, 1) + this.propsKey++ + }) } }) this.leaseApplyDetails.splice(row.index, 1) @@ -913,6 +915,7 @@ export default { /////// 设备类型树 切换 async deviceTypeChange(val) { + console.log(val, '*******************') // let nodes = null // console.log( // 'vall1211221122', @@ -955,13 +958,14 @@ export default { // } // } let tempList = [] + if (val.length > 0) { const items = val.map((e) => { return e[3] }) for (let i in items) { for (let z in deviceTypeList) { - if (deviceTypeList[z].data.typeId === items[i]) { + if (deviceTypeList[z].data.typeId == items[i]) { let { num, companyId, typeId, unitNames } = deviceTypeList[z].data tempList.push({ @@ -979,9 +983,30 @@ export default { } } } - } - this.leaseApplyDetails = [...new Set(tempList)] + const newDataList = [...this.leaseApplyDetails, ...tempList] + const map = new Map() + for (let item of newDataList) { + if (!map.has(item.typeId * 1)) { + map.set(item.typeId * 1, item) + } + } + const newArray = [...map.values()] + + console.log(newArray, 'newArray', items, 'items') + + let newArray_array = [] + items.forEach((e) => { + newArray.forEach((j) => { + if (e == j.typeId) { + newArray_array.push(j) + } + }) + }) + this.leaseApplyDetails = newArray_array + } else { + this.leaseApplyDetails = [] + } }, //// 将数据处理成 表格中需要的数据 handelTableItemData(node) { diff --git a/src/views/warehouseManage/newPurchase/toolsAcceptance/component/addTools.vue b/src/views/warehouseManage/newPurchase/toolsAcceptance/component/addTools.vue index deb25de..371a8da 100644 --- a/src/views/warehouseManage/newPurchase/toolsAcceptance/component/addTools.vue +++ b/src/views/warehouseManage/newPurchase/toolsAcceptance/component/addTools.vue @@ -177,19 +177,14 @@ > - + @@ -775,36 +770,41 @@ export default { const items = val.map((e) => { return e[3] }) - for (let i in items) { - for (let z in deviceTypeList) { - if (deviceTypeList[z].data.typeId === items[i]) { - this.$set(deviceTypeList[z].data, 'supplierId', '') - this.$set( - deviceTypeList[z].data, - 'createTime', - null, - ) - this.$set( - deviceTypeList[z].data, - 'productionTime', - '', - ) - this.$set( - deviceTypeList[z].data, - 'purchasePrice', - 0, - ) - this.$set(deviceTypeList[z].data, 'purchaseNum', 1) - - tempList.push(deviceTypeList[z].data) - + for (let i of items) { + for (let z of deviceTypeList) { + if (z.data.typeId === i) { + const obj = JSON.parse(JSON.stringify(z.data)) + obj.supplierId = '' + obj.createTime = null + obj.productionTime = '' + obj.purchasePrice = 0 + obj.purchaseNum = '' + tempList.push(obj) break } } } - } - this.equipmentList = [...new Set(tempList)] + const newDataListNew = [...this.equipmentList, ...tempList] + const map = new Map() + for (let item of newDataListNew) { + if (!map.has(item.typeId)) { + map.set(item.typeId, item) + } + } + const newArray = [...map.values()] + let newArray_array = [] + items.forEach((e) => { + newArray.forEach((j) => { + if (e == j.typeId) { + newArray_array.push(j) + } + }) + }) + this.equipmentList = newArray_array + } else { + this.equipmentList = [] + } }, }, }