From 0538fbd82ea053ae9bededd8334d013fac7b489c Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期四, 28 九月 2023 10:00:58 +0800
Subject: [PATCH] feat: 跟进记录页列表配置列显隐控制

---
 src/views/client/followupRecords/index.vue |   42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/src/views/client/followupRecords/index.vue b/src/views/client/followupRecords/index.vue
index 889334a..668d00e 100644
--- a/src/views/client/followupRecords/index.vue
+++ b/src/views/client/followupRecords/index.vue
@@ -33,6 +33,7 @@
               @selContactsClick="selContactsClick"
               @selClientClick="selClientClick"
               @getSelectArray="getSelectArray"
+              @selTableCol="selTableCol"
           >
             <template slot="tableButton">
               <el-table-column label="鎿嶄綔" width="60" fixed="right">
@@ -136,7 +137,19 @@
         value: "topic",
         label: ""
       },
-      search_map: {}
+      search_map: {},
+      tableColumn: [
+        { label: "涓婚", prop: "topic", min: 120 ,default:true}, // 涓婚
+        { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 190, isClientClick: true }, // 瀹㈡埛鍚嶇О
+        { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 100, isContactClick: true }, // 鑱旂郴浜哄鍚�
+        { label: "瀹㈡埛鐘舵��", prop: "client_status", min: 100 }, // 瀹㈡埛鐘舵��
+        { label: "鑱旂郴鏂瑰紡", prop: "contact_information_name", min: 100 }, // 鑱旂郴鏂瑰紡
+        { label: "鑱旂郴鏃ユ湡", prop: "follow_time", min: 130 }, // 鑱旂郴浜烘棩鏈�
+        { label: "涓嬫鍥炶鏃ユ湡", prop: "next_follow_time", min: 130 }, // 涓嬫鍥炶鏃ユ湡
+        { label: "璐熻矗浜�", prop: "member_name", min: 110 }, // 璐熻矗浜�
+        { label: "璺熻繘璁板綍", prop: "record", min: 130 } // 璺熻繘璁板綍
+      ],
+      showCol:['涓婚','瀹㈡埛鍚嶇О','鑱旂郴浜哄鍚�','鑱旂郴浜哄鍚�','瀹㈡埛鐘舵��','鑱旂郴鏂瑰紡','鑱旂郴鏃ユ湡','涓嬫鍥炶鏃ユ湡','璐熻矗浜�','璺熻繘璁板綍']
     }
   },
   created() {
@@ -160,18 +173,11 @@
     setTable() {
       this.tableList = {
         tableInfomation: [],
-        tableColumn: [
-          { label: "涓婚", prop: "topic", min: 120 }, // 涓婚
-          { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 190, isClientClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 100, isContactClick: true }, // 鑱旂郴浜哄鍚�
-          { label: "瀹㈡埛鐘舵��", prop: "client_status", min: 100 }, // 瀹㈡埛鐘舵��
-          { label: "鑱旂郴鏂瑰紡", prop: "contact_information_name", min: 100 }, // 鑱旂郴鏂瑰紡
-          { label: "鑱旂郴鏃ユ湡", prop: "follow_time", min: 130 }, // 鑱旂郴浜烘棩鏈�
-          { label: "涓嬫鍥炶鏃ユ湡", prop: "next_follow_time", min: 130 }, // 涓嬫鍥炶鏃ユ湡
-          { label: "璐熻矗浜�", prop: "member_name", min: 110 }, // 璐熻矗浜�
-          { label: "璺熻繘璁板綍", prop: "record", min: 130 } // 璺熻繘璁板綍
-        ]
+        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
@@ -179,6 +185,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