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/sales/salesOpportunity/index.vue |   55 ++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/src/views/sales/salesOpportunity/index.vue b/src/views/sales/salesOpportunity/index.vue
index d715a5f..78ef867 100644
--- a/src/views/sales/salesOpportunity/index.vue
+++ b/src/views/sales/salesOpportunity/index.vue
@@ -11,7 +11,7 @@
             :show-download="false"
             :amount-view="false"
             :show-action-btn="false"
-            placeholder="璇疯緭鍏ュ鎴峰悕绉�"
+            placeholder="璇疯緭鍏ユ満浼氬悕绉�"
             @searchClick="onFilterSearch"
         >
           <template slot="leftButton">
@@ -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,25 +176,29 @@
     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
         const value = this.tableList.tableColumn[i].prop
         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() {
@@ -347,15 +365,6 @@
       border-radius: 12px;
       height: 100%;
       overflow: hidden;
-    }
-
-    .supplier-search {
-      display: flex;
-      align-items: center;
-      .add-view {
-        margin-left: auto;
-        margin-right: 20px;
-      }
     }
     .list-view {
       height: calc(100% - 60px);

--
Gitblit v1.8.0