From 03cfba0f636b42417070fc8caef44bcdd792a085 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期二, 07 五月 2024 17:34:37 +0800
Subject: [PATCH] 概述 出库模块 编辑的时候循环处理对应产品调用接口获取在库数量的逻辑处理

---
 src/views/overview/AddOverviewDialog.vue |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/views/overview/AddOverviewDialog.vue b/src/views/overview/AddOverviewDialog.vue
index a02fc4b..156dbe6 100644
--- a/src/views/overview/AddOverviewDialog.vue
+++ b/src/views/overview/AddOverviewDialog.vue
@@ -477,6 +477,7 @@
                 @inputContent="inputContent"
                 @addProductClick="addProductClick('鎿嶄綔')"
                 @getSelectArray="getSelectArray"
+                @selSonLocationClick="selSonLocationClick"
                 @emptyProductClick="emptyProductClick"
                 @clearupProduct="clearupProduct"
               >
@@ -643,6 +644,9 @@
   getLogisticCompanyList,
   printReceipts,
 } from "@/api/overview/overview";
+import {
+  getLocationProductAmount
+} from "@/api/operate/inventoryAdjustment"
 import {
   getSupplierList,
   getCompanyList,
@@ -1333,9 +1337,11 @@
           {
             label: "浠�",
             prop: "fromLocationId",
+            min:120,
             sonLocation: true,
             isRequird: true,
           },
+          { label: "鍦ㄥ簱鏁伴噺", prop: "inLibraryAmount" },
           { label: "鏁伴噺", prop: "amount", inputFloat: true },
           { label: "璁¢噺鍗曚綅", prop: "unit" },
           { label: "杈呭姪鏁伴噺", prop: "auxiliaryAmount",inputFloatValue:true,isInputFloat:'inputFloatAuxiliaryAmount' },
@@ -1361,6 +1367,7 @@
             label: "浠�",
             prop: "fromLocationId",
             sonLocation: true,
+            min:120,
             isRequird: true,
           },
           {
@@ -1393,6 +1400,7 @@
           {
             label: "浠�",
             prop: "fromLocationId",
+            min:120,
             sonLocation: true,
             isRequird: true,
           },
@@ -1420,6 +1428,7 @@
           {
             label: "浠�",
             prop: "fromLocationId",
+            min:120,
             sonLocation: true,
             isRequird: true,
           },
@@ -1433,10 +1442,17 @@
           { label: "璁¢噺鍗曚綅", prop: "unit" },
         ];
       }
+      console.log(this.tableData,'===tableData')
+      if(this.workType == 2){
+        for(let i in this.tableData){
+          this.selSonLocationClick(this.tableData[i].fromLocation.id,'fromLocationId',this.tableData[i],i,3)
+        }
+      }
       this.productTableList = {
         tableData: this.tableData,
         tableColumn: tableColumnArr,
       };
+      
     },
     getTwoTable(data,value){
         let list = data.map((res) => {
@@ -1560,6 +1576,25 @@
         }
       });
     },
+    selSonLocationClick(val, prop, row,scope,type){
+      if(this.workType == 2){
+        if(prop=='fromLocationId'){
+         getLocationProductAmount({
+            locationId:type==3?val:val.value,
+            productId:row.productId
+          }).then((res)=>{
+            if(res.code==200){
+              if(type==3){
+                this.$set(this.tableData[scope],'inLibraryAmount',res.data?res.data.amount:0)
+              }else{
+                this.$set(this.tableData[scope.$index],'inLibraryAmount',res.data?res.data.amount:0)
+              }
+              this.$forceUpdate()
+            }
+          })
+        }
+      }
+    },
     // 鏂板
     addProductClick(value) {
       console.log(value);
@@ -1661,7 +1696,7 @@
       if (this.workType == "鍐呴儴璋冩嫧"||this.workType==3) {
         this.tableColumn = [
           { label: "浜у搧", prop: "name", productName: true, isRequird: true },
-          { label: "浠�", prop: "number", select: true },
+          { label: "浠�", prop: "number", select: true,min:120,},
           { label: "鑷�", prop: "amount", select: true },
           { label: "瀹屾垚", prop: "total", inputFloat: true },
           { label: "璁¢噺鍗曚綅", prop: "total", select: true },
@@ -1669,7 +1704,7 @@
       } else {
         this.tableColumn = [
           { label: "浜у搧", prop: "name", productName: true, isRequird: true },
-          { label: "浠�", prop: "number", select: true },
+          { label: "浠�", prop: "number", select: true , min:120,},
           { label: "瀹屾垚", prop: "total", inputFloat: true },
           { label: "璁¢噺鍗曚綅", prop: "total", select: true },
         ];

--
Gitblit v1.8.0