From 2096069a58c69ed76024a1cb3dc58f1bb7192490 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Fri, 1 Mar 2024 14:38:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=BA=8F=E5=8F=B7=E5=90=8E=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98=E5=BA=8F=E5=8F=B7=E7=9A=84?= =?UTF-8?q?=E5=88=97=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/chart/table/table-info.js | 1 - .../chart/components/ChartComponentS2.vue | 19 ++++++++++++------- .../components/shapeAttr/SizeSelectorAntV.vue | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) 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,