Przeglądaj źródła

入库单货名筛选重复问题

gjy 2 lat temu
rodzic
commit
5e86bd4c47
1 zmienionych plików z 10 dodań i 6 usunięć
  1. 10 6
      src/views/warehousenew/warehousingOrder.vue

+ 10 - 6
src/views/warehousenew/warehousingOrder.vue

@@ -740,13 +740,18 @@ export default {
               if(j==0){
                 this.goodsList.push(this.warehouseList[i].goodsNameInfos[j])
               }else{
-                for(let n = 0;n < this.goodsList.length;n++){
-                  if(this.goodsList[n].goodsName == this.warehouseList[i].goodsNameInfos[j].goodsName){
-                    this.goodsList[n].storage += this.warehouseList[i].goodsNameInfos[j].storage
-                  }else{
+                // 
+                  if(this.goodsList.every((item)=>{return item.goodsName != this.warehouseList[i].goodsNameInfos[j].goodsName}) ){
                     this.goodsList.push(this.warehouseList[i].goodsNameInfos[j])
+                  }else{
+                    for(let n = 0;n < this.goodsList.length;n++){
+                      if(this.goodsList[n].goodsName == this.warehouseList[i].goodsNameInfos[j].goodsName){
+                        this.goodsList[n].storage += this.warehouseList[i].goodsNameInfos[j].storage
+                      }
+                   }
                   }
-                }
+                  
+                // 
               }
             }
             this.baseId = this.warehouseList[i].id
@@ -763,7 +768,6 @@ export default {
         this.goodsName = this.goodsList[e].goodsName
         this.reserves = this.goodsList[e].storage
         this.multipleSelection1={}
-        
         this.getList()
     },
     handleClose5() {