diff --git a/core/frontend/src/views/chart/chart/table/table-info.js b/core/frontend/src/views/chart/chart/table/table-info.js index ad2ff103c2..2055e0c8a9 100644 --- a/core/frontend/src/views/chart/chart/table/table-info.js +++ b/core/frontend/src/views/chart/chart/table/table-info.js @@ -17,7 +17,6 @@ import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter' import { handleTableEmptyStrategy, hexColorToRGBA } from '@/views/chart/chart/util' import { maxBy, minBy, find } from 'lodash-es' import TableTooltip from '@/views/chart/components/table/TableTooltip.vue' -import Vue from 'vue' class SortTooltip extends BaseTooltip { vueCom diff --git a/core/frontend/src/views/chart/components/ChartComponentS2.vue b/core/frontend/src/views/chart/components/ChartComponentS2.vue index ea85af835c..2c326b5305 100644 --- a/core/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/core/frontend/src/views/chart/components/ChartComponentS2.vue @@ -567,13 +567,18 @@ export default { } const fieldId = resizeColumn.info.meta.field const size = JSON.parse(this.chart.customAttr).size - size.tableFieldWidth?.forEach(item => { - if (item.fieldId === fieldId) { - const containerWidth = document.getElementById(this.chartId).offsetWidth - item.width = (resizeColumn.info.resizedWidth / containerWidth * 100).toFixed(2) - } - }) - bus.$emit('set-table-column-width', size.tableFieldWidth) + const containerWidth = document.getElementById(this.chartId).offsetWidth + const column = size.tableFieldWidth?.find(i => i.fieldId === fieldId) + let tableWidth + const width = parseFloat((resizeColumn.info.resizedWidth / containerWidth * 100).toFixed(2)) + if (column) { + column.width = width + tableWidth = [...size.tableFieldWidth] + } else { + const tmp = { fieldId, width } + tableWidth = size.tableFieldWidth?.length ? [...size.tableFieldWidth, tmp] : [tmp] + } + bus.$emit('set-table-column-width', tableWidth) } } } diff --git a/core/frontend/src/views/chart/components/shapeAttr/SizeSelectorAntV.vue b/core/frontend/src/views/chart/components/shapeAttr/SizeSelectorAntV.vue index 57674b12ff..ed35884998 100644 --- a/core/frontend/src/views/chart/components/shapeAttr/SizeSelectorAntV.vue +++ b/core/frontend/src/views/chart/components/shapeAttr/SizeSelectorAntV.vue @@ -1848,7 +1848,7 @@ export default { } else { if (!this.sizeForm.tableFieldWidth?.length) { this.sizeForm.tableFieldWidth = [] - const defaultWidth = (100 / allAxis.length).toFixed(2) + const defaultWidth = parseFloat((100 / allAxis.length).toFixed(2)) allAxis.forEach(item => { this.sizeForm.tableFieldWidth.push({ fieldId: item.dataeaseName,