fix(图表): 修复透视表树形模式下自定义汇总列小计不显示 (#15355)

This commit is contained in:
wisonic-s
2025-03-14 17:21:28 +08:00
committed by GitHub
parent ef67bc88ac
commit 039c69f9f9
2 changed files with 9 additions and 19 deletions

View File

@@ -243,11 +243,11 @@ public class TablePivotHandler extends GroupChartHandler {
var tmpList = new ArrayList<Map<String, Object>>();
tmpData.add(tmpList);
var subRow = rowAxis.subList(0, i + 1);
var xAxis = new ArrayList<>(subRow);
for (int j = 0; j < colAxis.size(); j++) {
if (j == colAxis.size() - 1) {
break;
}
var xAxis = new ArrayList<>(subRow);
var subCol = colAxis.subList(0, j + 1);
xAxis.addAll(subCol);
var tmpAllList = new ArrayList<>(allFields);

View File

@@ -770,11 +770,17 @@ function getTreeCustomCalcResult(query, axisMap, status: TotalStatus, customCalc
// 列小计
if (status.isColSubTotal && !status.isRowTotal && !status.isRowSubTotal) {
const { colSubTotal } = customCalc
const subLevel = getSubLevel(query, col)
const subColLevel = getSubLevel(query, col)
const subRowLevel = getSubLevel(query, row)
const rowPath = getTreePath(query, row)
const colPath = getTreePath(query, col)
const path = [...rowPath, ...colPath]
const data = colSubTotal?.[subLevel]?.data
let data = colSubTotal?.[subColLevel]?.data
// 列小计里面的行小计
if (rowPath.length < row.length) {
const { rowSubInColSub } = customCalc
data = rowSubInColSub?.[subRowLevel]?.[subColLevel]?.data
}
let val
if (path.length && data) {
path.push(quotaField)
@@ -846,22 +852,6 @@ function getTreeCustomCalcResult(query, axisMap, status: TotalStatus, customCalc
}
return val
}
// 列小计里面的行小计
if (status.isColSubTotal && status.isRowSubTotal) {
const { rowSubInColSub } = customCalc
const rowSubLevel = getSubLevel(query, row)
const colSubLevel = getSubLevel(query, col)
const data = rowSubInColSub?.[rowSubLevel]?.[colSubLevel]?.data
const rowPath = getTreePath(query, row)
const colPath = getTreePath(query, col)
const path = [...rowPath, ...colPath]
let val
if (path.length && rowSubInColSub) {
path.push(quotaField)
val = get(data, path)
}
return val
}
return '-'
}