瀏覽代碼

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

yusheng 9 月之前
父節點
當前提交
d11a414af4
共有 1 個文件被更改,包括 8 次插入3 次删除
  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[