From 5f336e61d916b34f73a5bb55637022b775d89422 Mon Sep 17 00:00:00 2001 From: lynn Date: Wed, 7 May 2025 12:32:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=98=E7=82=B9=E8=AE=A1?= =?UTF-8?q?=E5=88=92bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/inventorys/stocktaking.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/views/inventorys/stocktaking.vue b/src/views/inventorys/stocktaking.vue index 4ff3e00..955ea2d 100644 --- a/src/views/inventorys/stocktaking.vue +++ b/src/views/inventorys/stocktaking.vue @@ -998,11 +998,15 @@ export default { // 如果是第一次加载,初始化选中状态 if (this.materialModal.selectedMaterialIds.size === 0) { this.materialList.forEach(item => { - if (item.material_infos_plan_link && - item.material_infos_plan_link.length > 0 && - item.material_infos_plan_link[0].material_infos_plan_id === planId) { - console.log('item.id', item.id) - this.materialModal.selectedMaterialIds.add(item.id); + if (item.material_infos_plan_link && item.material_infos_plan_link.length > 0) { + // 遍历物资绑定的所有盘点计划 + const hasMatchingPlan = item.material_infos_plan_link.some(link => + link.material_infos_plan_id === planId + ); + if (hasMatchingPlan) { + console.log('item.id', item.id); + this.materialModal.selectedMaterialIds.add(item.id); + } } }); }