From bfd5bcf4684f6ed05c7ca707e86cabcc06165ea5 Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Tue, 4 Jul 2023 10:34:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E7=BB=84=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/semifinished/semi-finished-check.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pages/modules/semifinished/semi-finished-check.vue b/src/pages/modules/semifinished/semi-finished-check.vue index fbaaf9f..5e34344 100644 --- a/src/pages/modules/semifinished/semi-finished-check.vue +++ b/src/pages/modules/semifinished/semi-finished-check.vue @@ -101,8 +101,9 @@ export default { }, activated () { if (this.$store.getters.materArr.length > 0) { - this.dataList = [...this.dataList, ...this.$store.getters.materArr] - this.removeRepeat(this.dataList) + let arr = this.$store.getters.materArr + this.removeRepeat(this.dataList, arr) + this.dataList = [...this.dataList, ...arr] this.dataList.map(el => { let res = accMul(el.canuse_qty, el.unit_weight) res = accDiv(res, 1000) @@ -115,11 +116,11 @@ export default { }, methods: { // 数组去重 - removeRepeat (arr) { - for (let i = 0; i < arr.length; i++) { - for (let j = i + 1; j < arr.length; j++) { - if (arr[i].a === arr[j].a) { - arr.splice(j, 1) + removeRepeat (arr1, arr2) { + for (let i = 0; i < arr1.length; i++) { + for (let j = 0; j < arr2.length; j++) { + if (arr1[i].struct_name === arr2[j].struct_name) { + arr2.splice(j, 1) j-- } }