From 253675f77d9493a8ae1699c475977fd56b6d234b Mon Sep 17 00:00:00 2001 From: Vergil <974548713@qq.com> Date: Fri, 15 May 2020 14:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=88=B6=E4=BB=B6=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Inventory/Inboundscanning/index.vue | 93 ++++++++----------- 1 file changed, 39 insertions(+), 54 deletions(-) diff --git a/src/views/Inventory/Inboundscanning/index.vue b/src/views/Inventory/Inboundscanning/index.vue index b30c085c..325dec4b 100644 --- a/src/views/Inventory/Inboundscanning/index.vue +++ b/src/views/Inventory/Inboundscanning/index.vue @@ -204,67 +204,52 @@ export default { this.listLoading = true searchTable(this.partNumber).then(response => { console.log(response.data) - if (response.data.length === 0) { + if (response.data[0].结果 === '成功' || response.data[0].结果 === '自动完成入库') { this.listLoading = false + 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].零件图号 + }) + const 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 + }, []) + } else if (response.data[0].结果 === '未查到') { this.$notify({ title: '警告', - message: '该零件未加工', + message: '跟单号有误', + type: 'warning' + }) + } else if (response.data[0].结果 === '未完成') { + this.$notify({ + title: '警告', + message: '此零件未加工完成', + type: 'warning' + }) + } else if (response.data[0].结果 === '已入库') { + this.$notify({ + title: '警告', + message: '此零件已入库', type: 'warning' }) - } else { - console.log(response.data, 1233) - for (let i = 0; i < response.data.length; i++) { - if (response.data[i].考核状态 === 7) { - this.listLoading = false - this.tableData.push({ - plannumber: response.data[i].剩余数量, - innumber: response.data[i].入库数量, - capture: '', - note: '', - 工艺计划流水号: response.data[i].工艺计划流水号, - 项目名称: response.data[i].项目名称, - 机床图号: response.data[i].机床图号, - 零件图号: response.data[i].零件图号 - }) - const 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 - }, []) - } else if (response.data[i].考核状态 === 6) { - this.$notify({ - title: '警告', - message: 'P' + response.data[i].工艺计划流水号 + '未加工完成', - type: 'warning' - }) - } else if (response.data[i].考核状态 === 8) { - this.$notify({ - title: '警告', - message: 'P' + response.data[i].工艺计划流水号 + '已入库', - type: 'warning' - }) - } else if (response.data[i].考核状态 === 9) { - this.$notify({ - title: '警告', - message: 'P' + response.data[i].工艺计划流水号 + '已出库', - type: 'warning' - }) - } - } } }).then(() => { - // if (this.finishParts.length > 0) { - // this.dialogFormVisible = true - // } this.listLoading = false }) },