From 496ab649c883f9be20fa982da9918889cdd18282 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 27 九月 2023 20:18:35 +0800
Subject: [PATCH] 新建库存调整接口联调

---
 src/components/makepager/CommonFormTableView.vue |   49 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 997cf9e..099c275 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -154,8 +154,8 @@
                     "
                   >
                     <el-option
-                      v-for="item in selLocationOptions"
-                      :key="item.id"
+                      v-for="(item, index) in selLocationOptions"
+                      :key="index"
                       :label="item.name"
                       :value="{ value: item.id, label: item.name }"
                     >
@@ -249,6 +249,7 @@
 import { getProductList } from "@/api/product/product"
 import { getLocationList } from "@/api/warehouseManage/warehouse"
 import { getCompanyList } from "@/api/common/other"
+import { getRuleList } from "@/api/operate/inventoryAdjustment"
 // import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
 export default {
   name: "CommmonFormTableView",
@@ -307,9 +308,10 @@
     }
   },
   created() {
-    this.getProductList()
     if (this.isinventory) {
-      this.getLocationList()
+      this.getRuleList()
+    } else {
+      this.getProductList()
     }
     if (this.islistingrules) {
       this.getLocationList()
@@ -335,6 +337,20 @@
           if (res.data && res.data.length > 0) {
             this.productNameOptions = res.data
           }
+        }
+      })
+    },
+    // 搴撳瓨璋冩暣鑾峰彇浣嶇疆鍜屼骇鍝�
+    async getRuleList() {
+      await getRuleList({
+        locationId: 0,
+        productId: ""
+      }).then((res) => {
+        console.log(res)
+        if (res.code === 200) {
+          const list = res.data ? res.data : []
+          this.selLocationOptions = list.locationList
+          this.productNameOptions = list.productList
         }
       })
     },
@@ -384,6 +400,18 @@
           ite.unit = item.unit
         }
       })
+      if (this.isinventory) {
+        getRuleList({
+          locationId: 0,
+          productId: item.value
+        }).then((res) => {
+          console.log(res)
+          if (res.code === 200) {
+            const list = res.data ? res.data : []
+            this.selLocationOptions = list.locationList
+          }
+        })
+      }
       console.log(this.tableList.tableData)
       this.$emit("selProductClick", item)
     },
@@ -391,6 +419,19 @@
     selLocationClick(item, prop) {
       console.log(item)
       console.log(this.tableList.tableData)
+      if (this.isinventory) {
+        getRuleList({
+          locationId: item.value,
+          productId: ""
+        }).then((res) => {
+          console.log(res)
+          if (res.code === 200) {
+            const list = res.data ? res.data : []
+            // this.selLocationOptions = list.locationList
+            this.productNameOptions = list.productList
+          }
+        })
+      }
       this.$emit("selLocationClick", item, prop)
     },
     // 閫夋嫨鍗曚綅/鐢ㄦ埛

--
Gitblit v1.8.0