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 {