From aeaf5640ea95d6ac4f4e2c98c5b15b4145f17fbd Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期四, 28 九月 2023 11:43:40 +0800
Subject: [PATCH] feat: 合同管理页列表配置列显隐控制

---
 src/views/client/salesLead/index.vue |   40 +++++++++++++++++++++++++++++-----------
 1 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/src/views/client/salesLead/index.vue b/src/views/client/salesLead/index.vue
index 0eb1f72..014a51c 100644
--- a/src/views/client/salesLead/index.vue
+++ b/src/views/client/salesLead/index.vue
@@ -28,6 +28,7 @@
               :table-list="tableList"
               @selSalesLeadClick="selSalesLeadClick"
               @getSelectArray="getSelectArray"
+              @selTableCol="selTableCol"
           >
             <template slot="tableButton">
               <el-table-column label="鎿嶄綔" width="120">
@@ -134,7 +135,18 @@
         // 鍒嗛厤
         visible: false,
         infomation: {}
-      }
+      },
+      tableColumn:[
+        { label: "瀹㈡埛鍚嶇О", prop: "name", min: 190, isSalesLeadClick: true ,default:true}, // 瀹㈡埛鍚嶇О
+        { label: "閿�鍞嚎绱㈢紪鍙�", prop: "number", min: 130 }, // 閿�鍞嚎绱㈢紪鍙�
+        { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 130 }, // 鑱旂郴浜哄鍚�
+        { label: "鎵嬫満鍙风爜", prop: "contact_phone", min: 130 }, // 鎵嬫満鍙风爜
+        { label: "鍟嗘満鏉ユ簮", prop: "sales_resources", min: 130 }, // 鍟嗘満鏉ユ簮
+        { label: "鐪佷唤", prop: "province", min: 130 }, // 鐪佷唤
+        { label: "鍩庡競", prop: "city", min: 130 }, // 鍩庡競
+        { label: "璐熻矗浜�", prop: "member_name", min: 130 } // 璐熻矗浜�
+      ],
+      showCol:["瀹㈡埛鍚嶇О","閿�鍞嚎绱㈢紪鍙�","鑱旂郴浜哄鍚�","鎵嬫満鍙风爜","鍟嗘満鏉ユ簮","鐪佷唤","鍩庡競","璐熻矗浜�"]
     }
   },
   created() {
@@ -145,17 +157,11 @@
     setTable() {
       this.tableList = {
         tableInfomation: [],
-        tableColumn: [
-          { label: "瀹㈡埛鍚嶇О", prop: "name", min: 190, isSalesLeadClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "閿�鍞嚎绱㈢紪鍙�", prop: "number", min: 130 }, // 閿�鍞嚎绱㈢紪鍙�
-          { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 130 }, // 鑱旂郴浜哄鍚�
-          { label: "鎵嬫満鍙风爜", prop: "contact_phone", min: 130 }, // 鎵嬫満鍙风爜
-          { label: "鍟嗘満鏉ユ簮", prop: "sales_resources", min: 130 }, // 鍟嗘満鏉ユ簮
-          { label: "鐪佷唤", prop: "province", min: 130 }, // 鐪佷唤
-          { label: "鍩庡競", prop: "city", min: 130 }, // 鍩庡競
-          { label: "璐熻矗浜�", prop: "member_name", 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
@@ -163,6 +169,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() {
       await getSalesLeadsList({

--
Gitblit v1.8.0