From af0388c2b508f6928184c06f55b2308a2efb3a4f Mon Sep 17 00:00:00 2001 From: zhangyu Date: Mon, 13 Sep 2021 17:35:45 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E4=BF=AE=E6=94=B9asset=20?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89label=20=E4=BD=9C=E4=B8=BA=E8=A1=A8?= =?UTF-8?q?=E5=A4=B4=E6=97=B6=20=E6=9C=89=E6=97=B6=E4=BC=9A=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/elementSet.vue | 12 ++++++++++++ .../src/components/common/mixin/dataList.js | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/nezha-fronted/src/components/common/elementSet.vue b/nezha-fronted/src/components/common/elementSet.vue index 84978c413..c1c2670a8 100644 --- a/nezha-fronted/src/components/common/elementSet.vue +++ b/nezha-fronted/src/components/common/elementSet.vue @@ -93,6 +93,18 @@ export default { }, // 点击第二个cancel save () { + if (this.tableId == 'assetTable') { + let customAssetLabel = false + this.custom.forEach(item => { + if (customAssetLabel) { + item.minWidth = item.label.length * 16 + 20 + return + } + if (item.label === 'Label' && item.type == 'title') { + customAssetLabel = true + } + }) + } this.$emit('update', this.custom) localStorage.setItem( 'nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.tableId, diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index a530d9448..40e02f612 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -286,10 +286,16 @@ export default { }) if (localStorageTableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) { const arr = localStorageTableTitle.splice(this.$refs.dataTable.tableTitle.length, localStorageTableTitle.length) + arr.forEach(item => { + item.minWidth = item.label.length * 16 + 20 + }) this.tools.customTableTitle = this.tools.customTableTitle.concat(arr) } if (!this.fromBottom) { this.getTableData() + this.$nextTick(() => { + this.$refs.dataTable.$refs.dataTable.doLayout() + }) } }, beforeDestroy () {