From 7f0ec738a0af4d9d334ce85012f864f2519ebb3f Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期六, 23 九月 2023 13:32:24 +0800 Subject: [PATCH] feat: 表格组件新增表头配置组件, 各列表页适配此组件 --- src/views/purchaseManage/quality/index.vue | 40 +++++++++++++++++++++++++++++----------- 1 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/views/purchaseManage/quality/index.vue b/src/views/purchaseManage/quality/index.vue index 9b57852..66c70c9 100644 --- a/src/views/purchaseManage/quality/index.vue +++ b/src/views/purchaseManage/quality/index.vue @@ -21,6 +21,7 @@ ref="tableListRef" :table-list="tableList" @selCommonClick="selCommonClick" + @selTableCol="selTableCol" > <template slot="tableButton"> <el-table-column align="center" label="鐘舵��" width="120"> @@ -72,6 +73,18 @@ }, search: {}, qualityStatusList:getDataByType('qualityStatus'), + tableColumn: [ + { label: "璐ㄦ鍗曠紪鍙�", prop: "number", min: 190, isCommonClick: true }, + { label: "閲囪喘鍗曠紪鍙�", prop: "name", min: 130, isCommonClick: true}, + { 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: 110 }, + { label: "璐ㄦ鏃堕棿", prop: "member_name", min: 150 }, + ], + showCol: ['璐ㄦ鍗曠紪鍙�', '閲囪喘鍗曠紪鍙�', '鍗曟嵁绫诲瀷', '渚涘簲鍟嗗悕绉�', '鍒拌揣浠撳簱', '璐ㄦ鏁伴噺', '妫�楠屽憳', '璐ㄦ鏃堕棿'] } }, created() { @@ -90,22 +103,27 @@ return "--"; } }, + setColumnVisible(showCol){ + return this.tableColumn.map(ele=>{ + return { + ...ele, + isShowColumn:showCol.includes(ele.label) + } + }) + }, setTable() { this.tableList = { tableInfomation: [], selectIndex: true, - tableColumn: [ - { label: "璐ㄦ鍗曠紪鍙�", prop: "number", min: 190, isCommonClick: true }, - { label: "閲囪喘鍗曠紪鍙�", prop: "name", min: 130, isCommonClick: true}, - { 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: 110 }, - { label: "璐ㄦ鏃堕棿", prop: "member_name", min: 150 }, - ] + showcol: this.showCol, + allcol: [], + tableColumn:this.setColumnVisible(this.showCol) } + this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label); + }, + selTableCol(val) { + this.showcol = val; + this.tableList.tableColumn = this.setColumnVisible(val); }, // 璇锋眰鏁版嵁 async getData() { -- Gitblit v1.8.0