From c6aa3652be2321a30bafddd4bb44e3ab681d79e0 Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期四, 28 九月 2023 09:53:41 +0800 Subject: [PATCH] feat: 联系人页列表配置列显隐控制 --- src/views/client/contacts/index.vue | 38 ++++++++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/views/client/contacts/index.vue b/src/views/client/contacts/index.vue index 93e61cd..00dfcf3 100644 --- a/src/views/client/contacts/index.vue +++ b/src/views/client/contacts/index.vue @@ -31,6 +31,7 @@ @selContactsClick="selContactsClick" @selClientClick="selClientClick" @getSelectArray="getSelectArray" + @selTableCol="selTableCol" > <template slot="tableButton"> <el-table-column label="鎿嶄綔" width="90" fixed="right"> @@ -128,7 +129,17 @@ title: "鏂板缓", infomation: {} }, - search_map: {} + search_map: {}, + tableColumn: [ + { label: "鑱旂郴浜哄鍚�", prop: "name", min: 100, isContactClick: true, default: true }, // 鑱旂郴浜哄鍚� + { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 190, isClientClick: true }, // 瀹㈡埛鍚嶇О + { label: "鑱旂郴浜虹紪鍙�", prop: "number", min: 100 }, // 鑱旂郴浜虹紪鍙� + { label: "鑱屽姟", prop: "position", min: 120 }, // 鑱屽姟 + { label: "鎵嬫満", prop: "phone", min: 100 }, // 鎵嬫満鍙风爜 + { label: "閿�鍞礋璐d汉", prop: "member_name", min: 120 }, // 閿�鍞礋璐d汉 + { label: "棣栬鑱旂郴浜�", prop: "is_first", isFirst: true, min: 90 } // 棣栬鑱旂郴浜� + ], + showCol: ['鑱旂郴浜哄鍚�','瀹㈡埛鍚嶇О','鑱旂郴浜虹紪鍙�','鑱屽姟','鎵嬫満','閿�鍞礋璐d汉','棣栬鑱旂郴浜�'] } }, created() { @@ -146,16 +157,11 @@ setTable() { this.tableList = { tableInfomation: [], - tableColumn: [ - { label: "鑱旂郴浜哄鍚�", prop: "name", min: 100, isContactClick: true }, // 鑱旂郴浜哄鍚� - { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 190, isClientClick: true }, // 瀹㈡埛鍚嶇О - { label: "鑱旂郴浜虹紪鍙�", prop: "number", min: 100 }, // 鑱旂郴浜虹紪鍙� - { label: "鑱屽姟", prop: "position", min: 120 }, // 鑱屽姟 - { label: "鎵嬫満", prop: "phone", min: 100 }, // 鎵嬫満鍙风爜 - { label: "閿�鍞礋璐d汉", prop: "member_name", min: 120 }, // 閿�鍞礋璐d汉 - { label: "棣栬鑱旂郴浜�", prop: "is_first", isFirst: true, min: 90 } // 棣栬鑱旂郴浜� - ] + 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() { this.loading = true -- Gitblit v1.8.0