From 60a8f558b3d144cf3ff5e903de0f384c079268c3 Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期四, 28 九月 2023 11:54:56 +0800
Subject: [PATCH] feat: 服务合同页列表配置列显隐控制; 修复列显隐组件按钮层级过高的问题

---
 src/components/makepager/TableCommonView.vue |    2 +-
 src/views/service/serviceContract/index.vue  |   44 +++++++++++++++++++++++++++++++-------------
 2 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index 3057f95..4104ebb 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -461,7 +461,7 @@
   // background: #06c062;
   top: 0;
   right: -6px;
-  z-index: 9999;
+  z-index: 9;
   .label {
     position: absolute;
     top: 6px;
diff --git a/src/views/service/serviceContract/index.vue b/src/views/service/serviceContract/index.vue
index 520407a..1cdb09c 100644
--- a/src/views/service/serviceContract/index.vue
+++ b/src/views/service/serviceContract/index.vue
@@ -31,6 +31,7 @@
               @selClientClick="selClientClick"
               @selCommonClick="selCommonClick"
               @getSelectArray="getSelectArray"
+              @selTableCol="selTableCol"
           >
             <template slot="tableButton">
               <el-table-column label="鎿嶄綔" width="60">
@@ -128,7 +129,20 @@
       },
       selValueList: [],
       keyword: "",
-      keywordType: ""
+      keywordType: "",
+      tableColumn: [
+        { label: "鏈嶅姟鍚堝悓缂栧彿", prop: "number", isCommonClick: true, default: true }, // 鏈嶅姟鍚堝悓缂栧彿
+        { label: "瀹㈡埛鍚嶇О", prop: "client_name", isClientClick: true }, // 瀹㈡埛鍚嶇О
+        { label: "绛剧害鏃ユ湡", prop: "signTime" }, // 绛剧害鏃ユ湡
+        { label: "鍚堝悓绫诲瀷", prop: "serviceContractType" }, // 鍚堝悓绫诲瀷
+        { label: "鍚堝悓鐘舵��", prop: "serviceContractStatus" }, // 鍚堝悓鐘舵��
+        { label: "璐熻矗浜�", prop: "member_name" }, // 璐熻矗浜�
+        { label: "浜у搧鍚嶇О", prop: "productName", isProductName: true }, // 浜у搧鍚嶇О
+        { label: "鏈嶅姟寮�濮嬫棩", prop: "startTime" }, // 鏈嶅姟寮�濮嬫棩
+        { label: "鏈嶅姟鍒版湡鏃�", prop: "endTime" }, // 鏈嶅姟鍒版湡鏃�
+        { label: "浠风◣鍚堣", prop: "amountTotal" } // 浠风◣鍚堣
+      ],
+      showCol:["鏈嶅姟鍚堝悓缂栧彿", "瀹㈡埛鍚嶇О", "绛剧害鏃ユ湡", "鍚堝悓绫诲瀷", "鍚堝悓鐘舵��", "璐熻矗浜�", "浜у搧鍚嶇О", "鏈嶅姟寮�濮嬫棩", "鏈嶅姟鍒版湡鏃�", "浠风◣鍚堣"]
     }
   },
   created() {
@@ -146,19 +160,11 @@
     setTable() {
       this.tableList = {
         tableInfomation: [],
-        tableColumn: [
-          { label: "鏈嶅姟鍚堝悓缂栧彿", prop: "number", isCommonClick: true }, // 鏈嶅姟鍚堝悓缂栧彿
-          { label: "瀹㈡埛鍚嶇О", prop: "client_name", isClientClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "绛剧害鏃ユ湡", prop: "signTime" }, // 绛剧害鏃ユ湡
-          { label: "鍚堝悓绫诲瀷", prop: "serviceContractType" }, // 鍚堝悓绫诲瀷
-          { label: "鍚堝悓鐘舵��", prop: "serviceContractStatus" }, // 鍚堝悓鐘舵��
-          { label: "璐熻矗浜�", prop: "member_name" }, // 璐熻矗浜�
-          { label: "浜у搧鍚嶇О", prop: "productName", isProductName: true }, // 浜у搧鍚嶇О
-          { label: "鏈嶅姟寮�濮嬫棩", prop: "startTime" }, // 鏈嶅姟寮�濮嬫棩
-          { label: "鏈嶅姟鍒版湡鏃�", prop: "endTime" }, // 鏈嶅姟鍒版湡鏃�
-          { label: "浠风◣鍚堣", prop: "amountTotal" } // 浠风◣鍚堣
-        ]
+        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
@@ -166,6 +172,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