From 05159702c718d8661eb457f1362b115beeaa421d Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期五, 03 十一月 2023 09:51:26 +0800
Subject: [PATCH] 新增补货页面,库存报表列表状态修改

---
 src/views/warehouseManage/listingRules/index.vue |   67 ++++++++++++++++++++++++---------
 1 files changed, 48 insertions(+), 19 deletions(-)

diff --git a/src/views/warehouseManage/listingRules/index.vue b/src/views/warehouseManage/listingRules/index.vue
index ffb0523..6e0c9d6 100644
--- a/src/views/warehouseManage/listingRules/index.vue
+++ b/src/views/warehouseManage/listingRules/index.vue
@@ -89,9 +89,11 @@
       isRowClick: false,
       areaId: 0,
       productId: 0,
+      productCategoryId:0,
       subLocationId: 0,
       currentRowId: 0,
-      rowIndex:0
+      rowIndex:-1,
+      RuleType:0,
     }
   },
   created() {
@@ -124,8 +126,8 @@
           const list = res.data.map((item) => {
             return {
               ...item,
-              areaName: {label:item.area.jointName,value:item.area.id},
-              subLocation: {label:item.location.jointName,value:item.location.id},
+              areaName: { label: item.area.jointName, value: item.area.id },
+              subLocation: { label: item.location.jointName, value: item.location.id },
               productName: item.product.name,
               productCategory: item.productCategory.name,
               isSet: false,
@@ -169,7 +171,8 @@
           productName: "",
           companyName: "",
           isSet: true,
-          isEdit: false
+          isEdit: false,
+          isOrder: true
         })
         this.areaId = 0
         this.subLocationId = 0
@@ -178,8 +181,8 @@
       } else {
         if (this.areaId === 0) {
           this.$message.error("璇烽�夋嫨褰撳墠浜у搧鍒拌揪浣嶇疆")
-        } else if (this.productId === 0) {
-          this.$message.error("璇烽�夋嫨浜у搧")
+        } else if (this.productId === 0 && this.productCategoryId==='') {
+          this.$message.error("璇烽�夋嫨浜у搧鎴栦骇鍝佺被鍒�")
         } else if (this.subLocationId === 0) {
           this.$message.error("璇烽�夋嫨瀛樺偍鍒板瓙浣嶇疆")
         } else {
@@ -197,11 +200,12 @@
           })
           let requestUrl = this.currentRowId === 0 ? addListingRules : updateListingRules
           requestUrl({
-            id: this.currentRowId,
-            areaId: this.areaId,
-            locationId: this.subLocationId,
-            productCategoryId: this.productCategoryId,
-            productId: this.productId
+              RuleType:this.RuleType,
+              id: this.currentRowId,
+              areaId: this.areaId,
+              locationId: this.subLocationId,
+              productCategoryId: this.productCategoryId||'',
+              productId: this.productId||''
           }).then((res) => {
             console.log(res)
             if (res.code === 200) {
@@ -217,7 +221,7 @@
     isSel() {
       for (let i = 0; i < this.tableData.length; i++) {
         if (this.tableData[i].productName.length === 0) {
-          this.isNoProduct = false
+          this.isNoProduct = true // 鏆傛椂淇敼涓簍rue锛屽鏋滀骇鍝佷互鍚庢槸蹇呭~锛屾敼涓篺alse灏辫
           break
         } else {
           this.isNoProduct = true
@@ -271,14 +275,12 @@
     },
     // 琛岀偣鍑�
     tableRowClick(row, rowIndex) {
-      // this.tableList.tableColumn[1].product=true
-      // this.tableList.tableColumn[2].productType=true
       this.rowIndex=rowIndex
-      console.log("11111",row,rowIndex)
       this.isSel()
       if (!this.isNoProduct && this.currentRowId === 0) {
         this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓")
       } else {
+        this.tableList.tableColumn[2].productType=true
         this.currentRowId = row.id
         this.addTitle = "淇濆瓨"
         this.showDiscard = true
@@ -289,6 +291,7 @@
         this.tableData.map((item, index) => {
           if (index === rowIndex) {
             item.isEdit = false
+            item.isOrder = true
           } else {
             item.isEdit = true
           }
@@ -297,7 +300,14 @@
         this.subLocationId = row.locationId
         this.productCategoryId = row.productCategoryId
         this.productId = row.productId
-      }
+        if(this.tableList.tableData[rowIndex].productName===""||this.tableList.tableData[rowIndex].productName===" "){
+          this.tableList.tableColumn[1].product=false
+          this.tableList.tableColumn[2].productType=true
+        }else{
+          this.tableList.tableColumn[1].product=true
+          this.tableList.tableColumn[2].productType=false
+        }
+    }
     },
     // 鎼滅储
     getList(val) {
@@ -333,15 +343,23 @@
     },
     // 閫変腑浜у搧鏂规硶
     selProductClick(item) {
+      console.log(item,"浜у搧")
+      this.RuleType=1
       this.tableList.tableColumn[2].productType=false
       this.productId = item.value
       this.productCategoryId = item.categoryId
     },
     // 閫変腑浜у搧绫诲瀷鏂规硶
     selProductTypeClick(item) {
-      console.log(item,"浜у搧绫诲瀷",this.tableList.tableData[this.rowIndex])
-      this.tableList.tableColumn[1].product=false
-      this.tableList.tableData[this.rowIndex].productName='--'
+      this.RuleType=2
+      if(this.currentRowId===0){
+        this.productCategoryId=item.value
+      }else{
+        this.tableList.tableColumn[1].product=false
+        this.tableList.tableData[this.rowIndex].productName=' '
+        this.productId=''
+        this.productCategoryId=this.tableList.tableData[this.rowIndex].productCategoryId
+      }
     },
     // 鍒犻櫎
     async delClick(scope) {
@@ -353,6 +371,17 @@
         }
       })
     }
+  },
+  watch:{
+    rowIndex(newVal){
+      if(this.tableList.tableData[newVal].productName===" "){
+        this.tableList.tableColumn[1].product=false
+        this.tableList.tableColumn[2].productType=true
+      }else{
+        this.tableList.tableColumn[1].product=true
+        this.tableList.tableColumn[2].productType=false
+      }
+    }
   }
 }
 </script>

--
Gitblit v1.8.0