From 9754debef34ae0ba85be5bc787289f75c86879cd Mon Sep 17 00:00:00 2001 From: caoxinyu Date: Sat, 11 May 2019 12:47:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BB=B6=E5=87=BA=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Inventory/Inboundscanning/index.vue | 81 ++++++++----------- 1 file changed, 33 insertions(+), 48 deletions(-) diff --git a/src/views/Inventory/Inboundscanning/index.vue b/src/views/Inventory/Inboundscanning/index.vue index f1c3b6ca..183499a8 100644 --- a/src/views/Inventory/Inboundscanning/index.vue +++ b/src/views/Inventory/Inboundscanning/index.vue @@ -9,7 +9,7 @@ - + @@ -101,7 +101,8 @@ export default { inventoryNumber: '', locateName: [], // 货位名称下拉框 locateNumber: '', - Partpaint: '' + Partpaint: '', + tableDataNum: [] } }, computed: { @@ -118,6 +119,7 @@ export default { methods: { // 移除 handleDelete(index, row) { + this.tableDataNum.splice(index, 1) this.tableData.splice(index, 1) }, // 获取人员编号 @@ -176,7 +178,7 @@ export default { }, // 根据流水号查询 getscantable() { - this.tableData = [] + // this.tableData = [] if (this.partNumber.length === 0) { this.$notify({ title: '警告', @@ -212,52 +214,34 @@ export default { } else if (response.data[i].考核状态 === 7) { this.listLoading = false this.tableData.push({ - plannumber: response.data[0].剩余数量, - innumber: response.data[0].入库数量, + plannumber: response.data[i].剩余数量, + innumber: response.data[i].入库数量, capture: '', note: '', - 工艺计划流水号: response.data[0].工艺计划流水号, - 项目名称: response.data[0].项目名称, - 机床图号: response.data[0].机床图号, - 零件图号: response.data[0].零件图号 + 工艺计划流水号: response.data[i].工艺计划流水号, + 项目名称: response.data[i].项目名称, + 机床图号: response.data[i].机床图号, + 零件图号: response.data[i].零件图号 }) + let hash = {}; // 一个新数组,data为你需要去重的数组,newData用于接收去重后的数组, curVal.去重条件 + this.tableDataNum = this.tableData.reduce((preVal, curVal) => { + hash[curVal.工艺计划流水号] ? '' : hash[curVal.工艺计划流水号] = true && preVal.push({ + 工艺计划流水号: curVal.工艺计划流水号, + 项目名称: curVal.项目名称, + 机床图号: curVal.机床图号, + 零件图号: curVal.零件图号, + plannumber: curVal.plannumber, + innumber: curVal.innumber, + capture: '', + note: '' + }); + return preVal + }, []) } } } - - // if (response.data.length === 0) { - // this.listLoading = false - // this.$message.warning('该零件未加工完成') - // } else if (response.data[0].考核状态 === 8) { - // this.listLoading = false - // this.$message.warning('该零件已入库') - // } else if (response.data[0].考核状态 === 9) { - // this.listLoading = false - // this.$message.warning('该零件已出库') - // } else if (response.data[0].考核状态 === 7) { - // for (let i = 0; i < this.tableData.length; i++) { - // if (response.data[0].工艺计划流水号 === this.tableData[i].工艺计划流水号) { - // this.ace = this.ace + 1 - // } - // } - // if (this.ace === 0) { - // this.tableData.push({ - // plannumber: response.data[0].剩余数量, - // innumber: response.data[0].入库数量, - // capture: '', - // note: '', - // 工艺计划流水号: response.data[0].工艺计划流水号, - // 项目名称: response.data[0].项目名称, - // 机床图号: response.data[0].机床图号, - // 零件图号: response.data[0].零件图号 - // }) - // } else { - // this.$message.error('此件已在列表中') - // } - // } }).then(() => { this.listLoading = false - // this.ace = 0 }) } }, @@ -271,14 +255,14 @@ export default { if (this.locateNumber === '') { this.$message.error('请选择货位') } else { - for (let i = 0; i < this.tableData.length; i++) { - if (Number(this.tableData[i].innumber) === 0) { + for (let i = 0; i < this.tableDataNum.length; i++) { + if (Number(this.tableDataNum[i].innumber) === 0) { this.$message.error('请输入正确数量') } else { - if (this.tableData[i].innumber > this.tableData[i].plannumber) { - this.tableData[i].innumber = this.tableData[i].plannumber + if (this.tableDataNum[i].innumber > this.tableDataNum[i].plannumber) { + this.tableDataNum[i].innumber = this.tableDataNum[i].plannumber } - insertOne(this.tableData[i].工艺计划流水号, this.tableData[i].innumber, this.PeopleNumber, this.tableData[i].capture, this.inventoryNumber, this.locateNumber, this.tableData[i].note).then(response => { + insertOne(this.tableDataNum[i].工艺计划流水号, this.tableDataNum[i].innumber, this.PeopleNumber, this.tableDataNum[i].capture, this.inventoryNumber, this.locateNumber, this.tableDataNum[i].note).then(response => { if (response.data[0].result === '1') { this.$message({ type: 'success', @@ -305,6 +289,7 @@ export default { // 清空 Empty() { this.tableData = [] + this.tableDataNum = [] this.Partpaint = '' }, // 仓库查询