From 517157bcb0e541dc779acc413c44071987802fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Sat, 20 Dec 2025 15:58:14 +0800 Subject: [PATCH] =?UTF-8?q?refactor(WarehouseInterlaced):=20=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E4=BB=93=E5=BA=93=E4=BD=8D=E7=BD=AEID=E7=9A=84?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除冗余的统计和过滤步骤,直接使用去重后的splitIds作为locationIds --- .../warehouse/components/WarehouseInterlaced.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/klp-ui/src/views/wms/warehouse/components/WarehouseInterlaced.vue b/klp-ui/src/views/wms/warehouse/components/WarehouseInterlaced.vue index 122d21d7..df77d480 100644 --- a/klp-ui/src/views/wms/warehouse/components/WarehouseInterlaced.vue +++ b/klp-ui/src/views/wms/warehouse/components/WarehouseInterlaced.vue @@ -238,15 +238,16 @@ export default { if (layer2Warehouses[i]) splitIds.push(layer2Warehouses[i].parentId); } // 1. 先统计每个 parentId 出现的次数 - const countMap = splitIds.reduce((map, id) => { - map.set(id, (map.get(id) || 0) + 1); - return map; - }, new Map()); + // const countMap = splitIds.reduce((map, id) => { + // map.set(id, (map.get(id) || 0) + 1); + // return map; + // }, new Map()); // 2. 过滤出至少出现两次的 parentId,再去重(map的key本身唯一,去重可省略但保留更严谨) - payload.locationIds = [...new Set( - splitIds.filter(id => countMap.get(id) >= 2) - )]; + // payload.locationIds = [...new Set( + // splitIds.filter(id => countMap.get(id) >= 2) + // )]; + payload.locationIds = [...new Set(splitIds)] console.log(payload) this.handleMergeWarehouse(payload); } else if (newLevel === 4) {