From 6752afa10d0feee2acd6f9d883db875dd19ba0d3 Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期四, 28 九月 2023 10:16:46 +0800
Subject: [PATCH] feat: 销售机会页列表配置列显隐控制

---
 src/views/sales/salesOpportunity/index.vue |   44 +++++++++++++++++++++++++++++++-------------
 1 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/src/views/sales/salesOpportunity/index.vue b/src/views/sales/salesOpportunity/index.vue
index 2c1af06..78ef867 100644
--- a/src/views/sales/salesOpportunity/index.vue
+++ b/src/views/sales/salesOpportunity/index.vue
@@ -32,6 +32,7 @@
               @selContactsClick="selContactsClick"
               @selCommonClick="selCommonClick"
               @getSelectArray="getSelectArray"
+              @selTableCol="selTableCol"
           >
             <template slot="tableButton">
               <el-table-column label="鎿嶄綔" width="100">
@@ -144,7 +145,20 @@
         visible: false,
         title: "鏂板缓",
         infomation: {}
-      }
+      },
+      tableColumn: [
+        { label: "鏈轰細鍚嶇О", prop: "name", min: 120, isCommonClick: true ,default:true}, // 鏈轰細鍚嶇О
+        { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 90, isClientClick: true }, // 瀹㈡埛鍚嶇О
+        { label: "閿�鍞満浼氱紪鍙�", prop: "number" }, // 閿�鍞満浼氱紪鍙�
+        { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 100, isContactClick: true }, // 鑱旂郴浜哄鍚�
+        { label: "閿�鍞樁娈�", prop: "sale_stage_name" }, // 閿�鍞樁娈�
+        { label: "鍙兘鎬�(%)", prop: "possibility_name" }, // 鍙兘鎬�
+        { label: "棰勮鎴愪氦鏃ユ湡", prop: "expected_time", min: 130 }, // 棰勮鎴愪氦鏃ユ湡
+        { label: "棰勮鍚堝悓閲戦", prop: "projected_amount" }, // 棰勮鍚堝悓閲戦
+        { label: "棰勭畻缁濆鍊�", prop: "budget" }, // 棰勭畻缁濆鍊�
+        { label: "閿�鍞礋璐d汉", prop: "member_name" } // 閿�鍞礋璐d汉
+      ],
+      showCol:["鏈轰細鍚嶇О", "瀹㈡埛鍚嶇О", "閿�鍞満浼氱紪鍙�", "鑱旂郴浜哄鍚�", "閿�鍞樁娈�", "鍙兘鎬�(%)", "棰勮鎴愪氦鏃ユ湡", "棰勮鍚堝悓閲戦", "棰勭畻缁濆鍊�", "閿�鍞礋璐d汉"]
     }
   },
   created() {
@@ -162,19 +176,11 @@
     setTable() {
       this.tableList = {
         tableInfomation: [],
-        tableColumn: [
-          { label: "鏈轰細鍚嶇О", prop: "name", min: 120, isCommonClick: true }, // 鏈轰細鍚嶇О
-          { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 90, isClientClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "閿�鍞満浼氱紪鍙�", prop: "number" }, // 閿�鍞満浼氱紪鍙�
-          { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 100, isContactClick: true }, // 鑱旂郴浜哄鍚�
-          { label: "閿�鍞樁娈�", prop: "sale_stage_name" }, // 閿�鍞樁娈�
-          { label: "鍙兘鎬�(%)", prop: "possibility_name" }, // 鍙兘鎬�
-          { label: "棰勮鎴愪氦鏃ユ湡", prop: "expected_time", min: 130 }, // 棰勮鎴愪氦鏃ユ湡
-          { label: "棰勮鍚堝悓閲戦", prop: "projected_amount" }, // 棰勮鍚堝悓閲戦
-          { label: "棰勭畻缁濆鍊�", prop: "budget" }, // 棰勭畻缁濆鍊�
-          { label: "閿�鍞礋璐d汉", prop: "member_name" } // 閿�鍞礋璐d汉
-        ]
+        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
@@ -182,6 +188,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