From fe730915f26d681ceae867791997987e4b7dbcb1 Mon Sep 17 00:00:00 2001 From: shijing Date: Mon, 20 Jul 2026 16:26:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=A6=85=E9=81=93452=E7=BB=BC=E5=90=88?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=95=8C=E9=9D=A2=E6=A3=92=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9C=AA=E6=98=BE=E7=A4=BA=E5=8F=91=E8=B4=A7=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/statistics/total_statistics.vue | 71 ++++++++++++++++++----- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/src/views/statistics/total_statistics.vue b/src/views/statistics/total_statistics.vue index 738394bb..2a88f27a 100644 --- a/src/views/statistics/total_statistics.vue +++ b/src/views/statistics/total_statistics.vue @@ -266,6 +266,7 @@ export default { //棒数据 getDataB(data,saleData) { let that = this; + that.tableData11 = []; let models = [],dataArr = []; //按版型(型号)分组 data.forEach((item) => { @@ -348,15 +349,33 @@ export default { that.tableData11[index] = obj; }); saleData.forEach((item) => { - let index = 0; + let model = ""; if (item.型号.indexOf("+") > -1) { - let model = item.型号.split("+")[0]; - index = models.indexOf(model); + model = item.型号.split("+")[0]; } else { - index = models.indexOf(item.型号); + model = item.型号; } + let index = models.indexOf(model); if (index > -1) { - that.tableData22[index].检验合格数=item.数量; + that.tableData11[index].检验合格数 += item.数量; + } else { + models.push(model); + that.tableData11.push({ + 版型: model, + 合格数: 0, + 仓库库存: 0, + 库存: 0, + 平头: 0, + 粘头: 0, + 粗中细: 0, + 抛光: 0, + 开槽: 0, + 配管: 0, + 成品库: 0, + 合计: 0, + 中检合格数: 0, + 检验合格数: item.数量, + }); } }) that.models_b = models; @@ -365,8 +384,10 @@ export default { //管数据 getDataG(data,saleData) { let that = this; + that.tableData22 = []; let models = [], modelArr = []; + let modelsspec = []; //modelArr按型号分组 data.forEach((item) => { let index = 0; @@ -414,7 +435,6 @@ export default { }); //specArr已将同型号的数组中按规格分组 specArr.forEach((item3, index3) => { - let modelsspec = []; item3.forEach((item4) => { let obj = { 版型: "", @@ -479,19 +499,42 @@ export default { }); }); saleData.forEach((item) => { - let index = 0; - if (item.型号.indexOf("+") > -1) { - let model = item.型号.split("+")[1]; - index = models.indexOf(model); + let model = "", spec = ""; + if (item.型号 && item.型号.indexOf("+") > -1) { + model = item.型号.split("+")[1]; } else { - index = models.indexOf(item.型号); + model = item.型号 || ""; } + if (item.规格 && item.规格.indexOf("+") > -1) { + spec = item.规格.split("+")[1]; + } else { + spec = item.规格 || ""; + } + let msitem = model + spec; + let index = modelsspec.indexOf(msitem); if (index > -1) { - that.tableData22[index].检验合格数=item.数量; + that.tableData22[index].检验合格数 += item.数量; + } else { + modelsspec.push(msitem); + that.tableData22.push({ + 版型: model, + 规格: spec, + 合格数: 0, + 仓库库存: 0, + 退火: 0, + 库存: 0, + 开槽: 0, + 倒角: 0, + 配棒: 0, + 成品库: 0, + 合计: 0, + 中检合格数: 0, + 检验合格数: item.数量, + }); } }) - that.models_g = models; - that.getCountOk('g',models); + that.models_g = modelsspec; + that.getCountOk('g',modelsspec); }, getSaleOutData(data_b, data_g){ let that = this;