From 1890de2e5beb6b940e0c9282f1f8b9be3888ae8d Mon Sep 17 00:00:00 2001 From: wisonic Date: Tue, 28 Oct 2025 15:41:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=98=8E=E7=BB=86=E8=A1=A8=E5=90=88=E5=B9=B6=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC=E7=9A=84=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BA=E8=A2=AB=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E7=9A=84=E6=96=87=E5=AD=97=E5=92=8C?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/table/table-info.ts | 14 ++++++++++++++ .../components/js/panel/common/common_table.ts | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts index abf5fe1dda..17533e6db2 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-info.ts @@ -503,6 +503,16 @@ export class TableInfo extends S2ChartView { const summaryObj = getSummaryRow(data, axis, basicStyle.seriesSummary) as any data.push(summaryObj) } + const { mergeCells } = tableCell + const mergedCellsInfoMap: Record = {} + if (mergeCells) { + s2Options.mergedCellsInfo?.reduce((p, n) => { + n.forEach(cell => { + p[`${cell.rowIndex}-${cell.colIndex}`] = true + }) + return p + }, mergedCellsInfoMap) + } s2Options.dataCell = viewMeta => { // 总计行处理 if (showSummary && viewMeta.rowIndex === data.length - 1) { @@ -533,6 +543,10 @@ export class TableInfo extends S2ChartView { // 配置文本自动换行参数 viewMeta.autoWrap = tableCell.mergeCells ? false : basicStyle.autoWrap viewMeta.maxLines = basicStyle.maxLines + // 合并单元格标记 + if (mergeCells && mergedCellsInfoMap[`${viewMeta.rowIndex}-${viewMeta.colIndex}`]) { + viewMeta.isMergedCell = true + } return new CustomDataCell(viewMeta, viewMeta?.spreadsheet) } } 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 0796d04a52..7d0c50764e 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 @@ -2135,6 +2135,7 @@ class CustomMergedCell extends MergedCell { } drawTextShape(): void { + console.log(this.meta.fieldValue) if (this.meta.deFieldType === 7) { drawImage.apply(this) } else { @@ -2158,11 +2159,25 @@ export class CustomDataCell extends TableDataCell { }) } + public getBackgroundColor() { + let bgColorInfo = super.getBackgroundColor() + if (this.meta.isMergedCell) { + bgColorInfo = { + ...bgColorInfo, + backgroundColorOpacity: 0 + } + } + return bgColorInfo + } + /** * 重写绘制文本内容的方法 * @protected */ protected drawTextShape() { + if(this.meta.isMergedCell) { + return + } if (this.meta.autoWrap) { drawTextShape(this, false) } else {