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 () {