From e1a3c04432d808ca27e1158095d2564cd81ea379 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 15 十一月 2023 19:22:16 +0800
Subject: [PATCH] 表格公共组件修改合并

---
 src/views/warehouseManage/listingRules/index.vue |   83 ++++++++++++++++++++---------------------
 1 files changed, 40 insertions(+), 43 deletions(-)

diff --git a/src/views/warehouseManage/listingRules/index.vue b/src/views/warehouseManage/listingRules/index.vue
index 22a6742..bd4fda5 100644
--- a/src/views/warehouseManage/listingRules/index.vue
+++ b/src/views/warehouseManage/listingRules/index.vue
@@ -27,7 +27,7 @@
           @querySearchData="querySearchData"
           @selProductClick="selProductClick"
         >
-        <!-- 
+          <!-- 
           @selProductTypeClick="selProductTypeClick"
          -->
           <template slot="tableButton">
@@ -82,8 +82,8 @@
       queryProductId: null,
       categoryId: null,
       searchTaskMap: [],
-      isCreate:false,
-      thatRow:{},
+      isCreate: false,
+      thatRow: {}
     }
   },
   created() {
@@ -111,13 +111,13 @@
         selectBox: false,
         selectIndex: true,
         tableColumn: [
-          { label: "褰撲骇鍝佸埌杈�", prop: "areaName", location: true },
+          { label: "褰撲骇鍝佸埌杈�", prop: "areaName", toLocation: true },
           { label: "浜у搧", prop: "productName", product: true },
           { label: "浜у搧绫诲埆", prop: "productCategory", productType: true },
           { label: "瀛樺偍鍒板瓙浣嶇疆", prop: "subLocation", sonLocation: true }
           // { label: "鍏徃", prop: "companyName", company: true }
         ],
-        rowClickIndex:-1
+        rowClickIndex: -1
       }
     },
     // 璇锋眰鏁版嵁
@@ -157,7 +157,7 @@
     },
     // 鏂板
     addProductClick() {
-      this.isCreate=true
+      this.isCreate = true
       this.tableList.tableColumn[1].product = true
       this.tableList.tableColumn[2].productType = true
       console.log(this.tableData)
@@ -177,7 +177,7 @@
           subLocation: "",
           productName: "",
           companyName: "",
-          productCategory:"",
+          productCategory: "",
           isSet: true,
           isEdit: false,
           isOrder: true
@@ -213,14 +213,14 @@
             areaId: this.areaId,
             locationId: this.subLocationId,
             productCategoryId: this.productCategoryId,
-            productId: this.productId 
+            productId: this.productId
           }).then((res) => {
             console.log(res)
             if (res.code === 200) {
               this.getData()
               let tipStr = this.currentRowId === 0 ? "娣诲姞鎴愬姛" : "淇敼鎴愬姛"
               this.$message.success(tipStr)
-              this.isCreate=false
+              this.isCreate = false
             }
           })
         }
@@ -240,7 +240,7 @@
     // 鍙栨秷
     discardBtnClick() {
       this.getData()
-      this.isCreate=false
+      this.isCreate = false
       this.tableList.tableColumn[1].product = true
       this.tableList.tableColumn[2].productType = true
       this.addTitle = "鏂板缓"
@@ -279,21 +279,20 @@
     },
     // 琛岀偣鍑�
     tableRowClick(row, rowIndex) {
-      
-      this.thatRow=row
-      this.tableList.rowClickIndex=rowIndex
+      this.thatRow = row
+      this.tableList.rowClickIndex = rowIndex
       this.rowIndex = rowIndex
       this.isSel()
       if (!this.isNoProduct && this.currentRowId === 0) {
         this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓")
-      }else {
-        this.currentRowId = row.id||0
+      } else {
+        this.currentRowId = row.id || 0
         this.addTitle = "淇濆瓨"
         this.showDiscard = true
         this.isRowClick = true
         if (this.isNoProduct) {
           // this.tableData.splice(this.tableData.length - 1, 1)
-            this.tableData.map((item, index) => {
+          this.tableData.map((item, index) => {
             if (index === rowIndex) {
               item.isEdit = false
               item.isOrder = true
@@ -308,25 +307,25 @@
         }
       }
     },
-    querySearchData(queryString,results,value){
-      if(this.isCreate){
-        if(queryString===''){
+    querySearchData(queryString, results, value) {
+      if (this.isCreate) {
+        if (queryString === "") {
           this.tableList.tableColumn[1].product = true
           this.tableList.tableColumn[2].productType = true
-        }else{
-          if(value==="product"){          
+        } else {
+          if (value === "product") {
             this.tableList.tableColumn[2].productType = false
-            if(results.length!==0){
-              this.productId=results[0].id
-            }else{
-              this.productId=0
+            if (results.length !== 0) {
+              this.productId = results[0].id
+            } else {
+              this.productId = 0
             }
-          }else if(value==="productType"){
+          } else if (value === "productType") {
             this.tableList.tableColumn[1].product = false
-            if(results.length!==0){
-              this.productCategoryId=results[0].id
-            }else{
-              this.productCategoryId=0
+            if (results.length !== 0) {
+              this.productCategoryId = results[0].id
+            } else {
+              this.productCategoryId = 0
             }
           }
         }
@@ -368,14 +367,14 @@
       this.subLocationId = item.value
     },
     // 閫変腑浜у搧鏂规硶
-    selProductClick(value,item){
-      if(value==="product"){
+    selProductClick(value, item) {
+      if (value === "product") {
         this.RuleType = 1
         this.tableList.tableColumn[2].productType = false
-        this.productId=item.id
-        this.productCategoryId=item.categoryId
-      }else if(value==="productType"){
-        this.productCategoryId=item.id
+        this.productId = item.id
+        this.productCategoryId = item.categoryId
+      } else if (value === "productType") {
+        this.productCategoryId = item.id
         this.RuleType = 2
         this.tableList.tableColumn[1].product = false
       }
@@ -399,19 +398,17 @@
   },
   watch: {
     rowIndex(newVal) {
-      if(this.isCreate){
-        if(newVal===0){
+      if (this.isCreate) {
+        if (newVal === 0) {
           this.tableList.tableColumn[1].product = true
           this.tableList.tableColumn[2].productType = true
-        }else{
+        } else {
           this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓")
           this.tableList.tableColumn[1].product = false
           this.tableList.tableColumn[2].productType = false
         }
-      }else{
-        if (
-          this.tableList.tableData[newVal].productName === ""
-        ) {
+      } else {
+        if (this.tableList.tableData[newVal].productName === "") {
           this.tableList.tableColumn[1].product = false
           this.tableList.tableColumn[2].productType = true
         } else {

--
Gitblit v1.8.0