Browse Source

bug 修复

lilei 4 năm trước cách đây
mục cha
commit
4dbf215fc9

+ 6 - 1
src/components/Table/index.js

@@ -87,6 +87,10 @@ export default {
     tableId: {
       type: String,
       default: ''
+    },
+    index: {
+      type: [String,Number],
+      default: ''
     }
   }),
   watch: {
@@ -154,7 +158,8 @@ export default {
           this.showPagination && this.localPagination.current || this.pageNum,
         pageSize: (pagination && pagination.pageSize) ||
           this.showPagination && this.localPagination.pageSize || this.pageSize,
-        tableId: this.tableId
+        tableId: this.tableId,
+        index: this.index
       },
       (sorter && sorter.field && {
         sortField: sorter.field

+ 24 - 14
src/views/purchasingManagement/purchaseOrder/warehousing.vue

@@ -24,6 +24,7 @@
         :columns="columns"
         :data="loadData"
         :tableId="item.receivingBillSn"
+        :index="bindex"
         :scroll="{ x: 1360 }"
         bordered>
         <!-- 采购数量 -->
@@ -117,7 +118,7 @@ export default {
             }
           }
           this.disabled = false
-          this.chooseLoadData = data.list
+          this.chooseLoadData[parameter.index] = data.list
           return data
         })
       }
@@ -143,11 +144,20 @@ export default {
       this.productType = []
       this.$refs.table.refresh(true)
     },
+    // 判断是否选择了仓库
+    hasChoseWarehousing (data) {
+      return data.find(item => !item.warehouseCascade || item.warehouseCascade.length == 0)
+    },
     //  确认入库
     handleWarehousing (row, index) {
+      const list = this.chooseLoadData[index]
+      console.log(list)
+      if (this.hasChoseWarehousing(list)) {
+        this.$message.warning('请选择仓库仓位!')
+      }
       purchaseWriteStockIn({ id: row.id }).then(res => {
         if (res.status == 200) {
-          this.$message.info(res.message)
+          this.$message.success(res.message)
           this.getDetail()
         }
       })
@@ -175,14 +185,14 @@ export default {
     getWarehouseCascade () {
       warehouseCascadeList({}).then(res => {
         if (res.status == 200) {
-			res.data.map(item => {
-			  item.sn = item.warehouseSn
-			  if (item.warehouseLocationList) {
-				item.warehouseLocationList.map(subItem => {
-				  subItem.sn = subItem.warehouseLocationSn
-				})
-			  }
-			})
+          res.data.map(item => {
+            item.sn = item.warehouseSn
+            if (item.warehouseLocationList) {
+              item.warehouseLocationList.map(subItem => {
+                subItem.sn = subItem.warehouseLocationSn
+              })
+            }
+          })
           this.warehouseCascadeData = res.data
         } else {
           this.warehouseCascadeData = []
@@ -192,7 +202,7 @@ export default {
     // 修改仓库仓位
     changeWarehouseCascade (val, opt, ind, bindex) {
       console.log(val, opt, ind)
-      let loadData = this.chooseLoadData[ind]
+      let loadData = this.chooseLoadData[bindex][ind]
       if (val.length == 1) {
         this.$message.warning('当前仓库无仓位,请选择其他仓库')
         const warehouseSnBackups = loadData.warehouseSnBackups || undefined
@@ -209,11 +219,11 @@ export default {
         loadData.warehouseLocationSn = val[1] ? val[1] : ''
         loadData.warehouseSnBackups = val[0] ? val[0] : ''
         loadData.warehouseLocationSnBackups = val[1] ? val[1] : ''
-        loadData = this.chooseLoadData[ind]
+        loadData = this.chooseLoadData[bindex][ind]
         this.updateWarehouse(loadData, bindex)
       }
     },
-    // 修改库
+    // 修改
     updateWarehouse (row, bindex) {
       purchaseUpdateWarehouse({
         id: row.id,
@@ -221,7 +231,7 @@ export default {
         warehouseLocationSn: row.warehouseLocationSn
       }).then(res => {
         if (res.status == 200) {
-          this.$message.info(res.message)
+          this.$message.success(res.message)
           console.log(bindex, this.$refs)
           this.$refs['table-' + bindex][0].refresh()
         }