From 7f7bb489b5454fc93245782332d08f2f213860ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Wed, 5 Nov 2025 11:39:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(klp-material-picker):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=A7=84=E6=A0=BC=E8=BF=87=E6=BB=A4=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=92=8C=E5=8E=9F=E6=9D=90=E6=96=99=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改产品和原材料的过滤逻辑,使其不仅支持按名称过滤,还支持按规格字段过滤。同时移除了调试用的console.log语句。 --- .../components/klp-material-picker/klp-material-picker.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/hand-factory/components/klp-material-picker/klp-material-picker.vue b/apps/hand-factory/components/klp-material-picker/klp-material-picker.vue index d709601..fbf4582 100644 --- a/apps/hand-factory/components/klp-material-picker/klp-material-picker.vue +++ b/apps/hand-factory/components/klp-material-picker/klp-material-picker.vue @@ -244,7 +244,8 @@ this.filteredProducts = keyword ? this.products.filter(p => { // 只基于产品名称过滤,且确保是产品数据 - return p.productName && p.productName.toLowerCase().includes(keyword) + return (p.productName && p.productName.toLowerCase().includes(keyword)) + || p?.specification?.toLowerCase()?.includes(keyword) }) : [...this.products]; }, @@ -254,8 +255,10 @@ const keyword = this.rawMaterialSearchKeyword.trim().toLowerCase(); this.filteredRawMaterials = keyword ? this.rawMaterials.filter(m => { + console.log(m.specification) // 只基于原材料名称过滤,且确保是原材料数据 - return m.rawMaterialName && m.rawMaterialName.toLowerCase().includes(keyword) + return (m.rawMaterialName && m.rawMaterialName.toLowerCase().includes(keyword)) + || m?.specification?.toLowerCase()?.includes(keyword) }) : [...this.rawMaterials]; },