Browse Source

优化入库申请产品列表匹配逻辑,使用find替代filter提高性能

yusheng 9 months ago
parent
commit
d11a414af4
1 changed files with 8 additions and 3 deletions
  1. 8 3
      src/views/bpm/stockManagement/storage.vue

+ 8 - 3
src/views/bpm/stockManagement/storage.vue

@@ -1521,10 +1521,15 @@
             });
 
             this.productList = res.map((item, index) => {
-              let filtersItem = this.saleProductList.filter(
+              let filtersItem = this.saleProductList.find(
                 (detailItem) =>
-                  detailItem.productCode || detailItem.categoryCode == item.code
-              )[0];
+                  item.code == detailItem.productCode ||
+                  item.code == detailItem.categoryCode
+              );
+              // let filtersItem = this.saleProductList.filter(
+              //   (detailItem) =>
+              //     detailItem.productCode || detailItem.categoryCode == item.code
+              // )[0];
 
               // 显示规格
               let packingSpecificationLabel = this.packingSpecificationOption[