From 5cf7d1f0b8d692f02130cb3c0ab2c114da28fa51 Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期四, 28 九月 2023 11:21:16 +0800
Subject: [PATCH] feat: 销售总单页列表配置列显隐控制; 修复列表组件行合并未判空的问题

---
 src/components/makepager/TableCommonView.vue |   12 +++++++++---
 src/views/sales/masterOrder/index.vue        |   38 ++++++++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index 93a80ef..3057f95 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -216,10 +216,16 @@
               .querySelector(".el-table__footer")
             var cell = current.rows[0].cells
             for (let i = 0; i < this.showSummary.mergeNumber; i++) {
-              cell[i].style.display = "none"
+              cell[i] && cell[i].style && (cell[i].style.display = "none")
             }
-            cell[this.showSummary.mergeNumber].classList.remove("is-left")
-            cell[this.showSummary.mergeNumber].colSpan = this.showSummary.mergeNumber.toString()
+            if (cell[this.showSummary.mergeNumber]){
+              if (cell[this.showSummary.mergeNumber].classList){
+                cell[this.showSummary.mergeNumber].classList.remove("is-left")
+              }
+              if (cell[this.showSummary.mergeNumber].colSpan){
+                cell[this.showSummary.mergeNumber].colSpan = this.showSummary.mergeNumber.toString()
+              }
+            }
           }
         })
       }
diff --git a/src/views/sales/masterOrder/index.vue b/src/views/sales/masterOrder/index.vue
index 7705a43..85e9afe 100644
--- a/src/views/sales/masterOrder/index.vue
+++ b/src/views/sales/masterOrder/index.vue
@@ -33,6 +33,7 @@
               @selClientClick="selClientClick"
               @selCommonClick="selCommonClick"
               @getSelectArray="getSelectArray"
+              @selTableCol="selTableCol"
           >
             <template slot="tableButton">
               <el-table-column label="鎿嶄綔" width="90">
@@ -130,7 +131,17 @@
       searchSel: {
         value: "number",
         label: "鍗曟嵁缂栧彿"
-      }
+      },
+      tableColumn: [
+        { label: "鍗曟嵁缂栧彿", prop: "number", min: 100, isCommonClick: true, default: true }, // 鍗曟嵁缂栧彿
+        { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 120, isClientClick: true }, // 瀹㈡埛鍚嶇О
+        { label: "鏈嶅姟寮�濮嬫椂闂�", prop: "start_time" }, // 鏈嶅姟寮�濮嬫椂闂�
+        { label: "鏈嶅姟鎴鏃堕棿", prop: "end_time" }, // 鏈嶅姟鎴鏃堕棿
+        { label: "鍚堝悓閲戦", prop: "money" }, // 鍚堝悓閲戦
+        { label: "璐熻矗浜�", prop: "member_name" } // 璐熻矗浜�
+        // { label: "瀹℃壒鐘舵��", prop: "approvalStatus" } // 瀹℃壒鐘舵��
+      ],
+      showCol:["鍗曟嵁缂栧彿", "瀹㈡埛鍚嶇О", "鏈嶅姟寮�濮嬫椂闂�", "鏈嶅姟鎴鏃堕棿", "鍚堝悓閲戦", "璐熻矗浜�"]
     }
   },
   created() {
@@ -148,16 +159,11 @@
     setTable() {
       this.tableList = {
         tableInfomation: [],
-        tableColumn: [
-          { label: "鍗曟嵁缂栧彿", prop: "number", min: 100, isCommonClick: true }, // 鍗曟嵁缂栧彿
-          { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 120, isClientClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "鏈嶅姟寮�濮嬫椂闂�", prop: "start_time" }, // 鏈嶅姟寮�濮嬫椂闂�
-          { label: "鏈嶅姟鎴鏃堕棿", prop: "end_time" }, // 鏈嶅姟鎴鏃堕棿
-          { label: "鍚堝悓閲戦", prop: "money" }, // 鍚堝悓閲戦
-          { label: "璐熻矗浜�", prop: "member_name" } // 璐熻矗浜�
-          // { label: "瀹℃壒鐘舵��", prop: "approvalStatus" } // 瀹℃壒鐘舵��
-        ]
+        allcol: [],
+        showcol: this.showCol,
+        tableColumn:this.setColumnVisible(this.showCol)
       }
+      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
       this.searchOptions = []
       for (let i = 0; i < this.tableList.tableColumn.length; i++) {
         const label = this.tableList.tableColumn[i].label
@@ -165,6 +171,18 @@
         this.searchOptions.push({ value: value, label: label })
       }
     },
+    setColumnVisible(showCol){
+      return  this.tableColumn.map(ele=>{
+        return {
+          ...ele,
+          isShowColumn:showCol.includes(ele.label)
+        }
+      })
+    },
+    selTableCol(val) {
+      this.showcol = val;
+      this.tableList.tableColumn = this.setColumnVisible(val);
+    },
     // 璇锋眰鏁版嵁
     async getData() {
       this.loading = true

--
Gitblit v1.8.0