From 0358c535963edb19780cd53c8e133bf298da6419 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期二, 31 十月 2023 10:14:47 +0800
Subject: [PATCH] 上架规则列表修改

---
 src/views/warehouseManage/listingRules/index.vue |   47 ++++++++++++++++++++++-------------------------
 1 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/src/views/warehouseManage/listingRules/index.vue b/src/views/warehouseManage/listingRules/index.vue
index d4d8ba5..b7be896 100644
--- a/src/views/warehouseManage/listingRules/index.vue
+++ b/src/views/warehouseManage/listingRules/index.vue
@@ -89,6 +89,7 @@
       isRowClick: false,
       areaId: 0,
       productId: 0,
+      productCategoryId:0,
       subLocationId: 0,
       currentRowId: 0,
       rowIndex:-1,
@@ -180,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 {
@@ -199,12 +200,12 @@
           })
           let requestUrl = this.currentRowId === 0 ? addListingRules : updateListingRules
           requestUrl({
-            RuleType:this.RuleType,
-            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) {
@@ -220,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
           break
         } else {
           this.isNoProduct = true
@@ -299,15 +300,12 @@
         this.subLocationId = row.locationId
         this.productCategoryId = row.productCategoryId
         this.productId = row.productId
-        if(this.tableList.tableData[rowIndex].productCategory===""){
-          this.tableList.tableColumn[2].productType=false
-        }else{
-          this.tableList.tableColumn[2].productType=true
-        }
         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
         }
     }
     },
@@ -354,11 +352,14 @@
     // 閫変腑浜у搧绫诲瀷鏂规硶
     selProductTypeClick(item) {
       this.RuleType=2
-      console.log(item,"浜у搧绫诲瀷",this.tableList.tableData[this.rowIndex])
-      // this.tableList.tableColumn[1].product=false
-      this.tableList.tableData[this.rowIndex].productName=' '
-      this.productId=''
-      this.productCategoryId=this.tableList.tableData[this.rowIndex].productCategoryId
+      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) {
@@ -373,16 +374,12 @@
   },
   watch:{
     rowIndex(newVal){
-      console.log(this.tableList.tableData[newVal].productName.length,"watch")
-      if(this.tableList.tableData[newVal].productCategory.length===0){
-        this.tableList.tableColumn[2].productType=false
-      }else{
-        this.tableList.tableColumn[2].productType=true
-      }
       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
       }
     }
   }

--
Gitblit v1.8.0