From 1888b426ff2b6a529f5fdef0f0453dadef71824b Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 17 四月 2024 10:17:38 +0800
Subject: [PATCH] 隐藏多单位的问题

---
 src/views/productManage/reorderRules/index.vue |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/src/views/productManage/reorderRules/index.vue b/src/views/productManage/reorderRules/index.vue
index 9384663..91de486 100644
--- a/src/views/productManage/reorderRules/index.vue
+++ b/src/views/productManage/reorderRules/index.vue
@@ -7,9 +7,11 @@
         :show-apply="false"
         :placeholder="'璇疯緭鍏ヤ綅缃�/浜у搧'"
         :amount-view="false"
+        :search-task-map="searchTaskMap"
         @addCommonClick="addProductClick"
         @searchClick="getList"
         @discardBtnClick="discardBtnClick"
+        @delSelectClick="delSelectClick"
       />
     </div>
     <div class="list-view">
@@ -76,11 +78,21 @@
       maxInventory: 0,
       orderNumber: 0,
       unit: "",
-      reorderId: 0
+      reorderId: 0,
+      queryProductId: null,
+      searchTaskMap: [],
+      currentRowId: -1
     }
   },
   created() {
     this.setTable()
+    let query = this.$route.query
+    if (query) {
+      this.queryProductId = query.productId?.length ? query.productId : null
+      this.pagerOptions.currPage = 1
+      this.searchTaskMap =
+        query.productId?.length > 0 ? [{ productId: this.queryProductId, title: query.productName }] : []
+    }
     this.getData()
   },
   methods: {
@@ -90,7 +102,7 @@
         selectBox: false,
         selectIndex: true,
         tableColumn: [
-          { label: "浜у搧", prop: "productName", product: true },
+          { label: "浜у搧", prop: "productName", product: true, width: "150px" },
           { label: "浣嶇疆", prop: "locationName", defaultLocation: true },
           { label: "鍦ㄥ簱鏁伴噺", prop: "amount" },
           { label: "棰勬祴鏁伴噺", prop: "prediction" },
@@ -105,11 +117,11 @@
     // 璇锋眰鏁版嵁
     async getData() {
       await getReorderRuleList({
+        productId: this.queryProductId ? this.queryProductId : null,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
       }).then((res) => {
         if (res.code === 200) {
-          console.log(res)
           const list = res.data.map((item) => {
             let orderNum = 0
             if (parseFloat(item.minInventory) - parseFloat(item.prediction) > 0) {
@@ -168,7 +180,6 @@
     },
     // 鏂板
     addProductClick() {
-      console.log(this.addTitle)
       this.isSel()
       if (this.isNoProduct && this.addTitle === "鏂板缓") {
         this.$refs.tablelistRef.getProductList()
@@ -203,7 +214,6 @@
         let params = this.saveParams()
         requestUrl(params)
           .then((res) => {
-            console.log(res)
             if (res.code === 200) {
               let tipStr = this.currentRowId === 0 ? "娣诲姞鎴愬姛" : "淇敼鎴愬姛"
               this.$message.success(tipStr)
@@ -211,10 +221,9 @@
             }
           })
           .catch((err) => {
-            console.log(err)
             this.getData()
+            console.log(err)
           })
-        // }
       }
     },
     saveParams() {
@@ -270,7 +279,7 @@
       if (!this.isNoProduct && this.currentRowId === 0) {
         this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓")
       } else {
-        this.currentRowId = row.id
+        this.currentRowId = row.id || 0
         this.addTitle = "淇濆瓨"
         this.showDiscard = true
         this.isRowClick = true
@@ -308,8 +317,10 @@
     },
     // 閫変腑浜у搧鏂规硶
     selProductClick(item) {
-      this.productId = item.value
+      this.productId = item.productId
       this.unit = item.unit
+      this.amount = item.amount
+      this.prediction = item.prediction
     },
     // 閫変腑璺嚎鏂规硶
     selRouteClick(item, prop) {
@@ -319,6 +330,11 @@
     // 鑾峰彇褰撳墠鏃堕棿
     currentTime() {
       return currentTime()
+    },
+    // 鍒犻櫎浜у搧
+    delSelectClick() {
+      this.queryProductId = ""
+      this.getData()
     }
   }
 }

--
Gitblit v1.8.0