Bläddra i källkod

bug修复【ID1008304】

chenrui 3 år sedan
förälder
incheckning
5c082759d2
1 ändrade filer med 24 tillägg och 7 borttagningar
  1. 24 7
      src/views/purchasingManagement/bulkWarehousingOrder/productModal.vue

+ 24 - 7
src/views/purchasingManagement/bulkWarehousingOrder/productModal.vue

@@ -139,7 +139,8 @@ export default {
       productData: [],
       warehouseCascadeData: [], //  仓库仓位  下拉数据
       warehouseSnBackups: '', //  仓库备份数据
-      warehouseLocationSnBackups: '' //  仓位备份数据
+      warehouseLocationSnBackups: '', //  仓位备份数据
+      defaultWarehouseCascade: [] //  默认仓库仓位
     }
   },
   methods: {
@@ -165,7 +166,7 @@ export default {
         }
       })
     },
-    // 调往对象名称  change
+    // 产品编码  change
     handleChange (value) {
       const ind = this.productData.findIndex(item => item.productSn == value)
       this.form.productName = this.productData[ind].product.name
@@ -204,7 +205,7 @@ export default {
                 _this.$emit('ok', res.data)
                 _this.spinning = false
               }, 1000)
-            }else{
+            } else {
               _this.spinning = false
             }
           })
@@ -231,10 +232,28 @@ export default {
         this.warehouseLocationSnBackups = this.form.warehouseLocationSn
       }
     },
-    // 仓库仓位
+    //  仓库仓位  级联  列表
     getWarehouseCascade () {
+      const _this = this
       warehouseCascadeList({}).then(res => {
         if (res.status == 200) {
+          res.data.filter(item => {
+            // 过滤默认仓库
+            if (item.defaultFlag == 1) { //  defaultFlag为1是默认仓库
+              _this.defaultWarehouseCascade[0] = item.warehouseSn
+              // 过滤默认仓位
+              item.warehouseLocationList.filter(subItem => {
+                if (subItem.defaultFlag == 1) {
+                  _this.defaultWarehouseCascade[1] = subItem.warehouseLocationSn
+                  _this.form.warehouse = _this.defaultWarehouseCascade
+                  _this.form.warehouseSn = _this.defaultWarehouseCascade[0] || undefined
+                  _this.form.warehouseLocationSn = _this.defaultWarehouseCascade[1] || undefined
+                  _this.warehouseSnBackups = _this.defaultWarehouseCascade[0] || undefined
+                  _this.warehouseLocationSnBackups = _this.defaultWarehouseCascade[1] || undefined
+                }
+              })
+            }
+          })
           res.data.map(item => {
             item.sn = item.warehouseSn
             if (item.warehouseLocationList) {
@@ -263,9 +282,7 @@ export default {
         this.warehouseSnBackups = ''
         this.warehouseLocationSnBackups = ''
       } else {
-        if (this.warehouseCascadeData.length == 0) {
-          this.getWarehouseCascade()
-        }
+        this.getWarehouseCascade()
       }
     },
     itemSn (newValue, oldValue) {