From 14dac72a43c90ed9313abb1ee4c4e6f26b23eb84 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Fri, 29 Aug 2025 16:40:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AD=98=E9=87=8F=E6=98=8E=E7=BB=86=E8=A1=A8=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E5=88=86=E7=BB=84=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table/TableHeaderGroupConfig.vue | 4 +-- .../js/panel/common/common_table.ts | 28 +++++-------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableHeaderGroupConfig.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableHeaderGroupConfig.vue index d5c086ce8f..794dbcb78b 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableHeaderGroupConfig.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/table/TableHeaderGroupConfig.vue @@ -56,7 +56,7 @@ const onCancelConfig = () => { const onConfigChange = () => { const { fields } = s2.dataCfg - emits('onConfigChange', { columns: fields.columns }) + emits('onConfigChange', { columns: fields.columns, meta: [] }) } const init = () => { @@ -79,7 +79,7 @@ const init = () => { pre[cur.field] = cur.title return pre }, {}) - if (!headerGroupConfig.meta?.length) { + if (headerGroupConfig.meta?.length) { headerGroupConfig.meta.forEach(item => { nameFieldMap[item.field] = item.name }) diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts index a1ac9c7be4..ca85cdad4b 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts @@ -2139,37 +2139,23 @@ export const getLeafNodes = (tree: Array): ColumnNode[] => { export const mapKeyToField = (nodes: Array) => { nodes.forEach(node => { + if (node.key) { + node.field = node.key + delete node.key + } if (node.children) { - node.children.forEach(child => { - if (child.key) { - // 如果有 key 字段,则将其映射到 field 字段 - child.field = child.key - delete child.key - } - }) mapKeyToField(node.children as Array) - } else { - if (node.key) { - node.field = node.key - delete node.key - } } }) } export const setupColumnTitle = (nodes: Array, nameMap: Record) => { nodes.forEach(node => { + if (nameMap[node.field]) { + node.title = nameMap[node.field] + } if (node.children) { - node.children.forEach(child => { - if (nameMap[child.field]) { - child.title = nameMap[child.field] - } - }) setupColumnTitle(node.children as Array, nameMap) - } else { - if (nameMap[node.field]) { - node.title = nameMap[node.field] - } } }) }