From 039c69f9f99b813c0787745ae63404c4bc9bab78 Mon Sep 17 00:00:00 2001 From: wisonic-s <51065359+wisonic-s@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:21:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=80=8F=E8=A7=86=E8=A1=A8=E6=A0=91=E5=BD=A2=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E8=87=AA=E5=AE=9A=E4=B9=89=E6=B1=87=E6=80=BB=E5=88=97?= =?UTF-8?q?=E5=B0=8F=E8=AE=A1=E4=B8=8D=E6=98=BE=E7=A4=BA=20(#15355)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../charts/impl/table/TablePivotHandler.java | 2 +- .../js/panel/charts/table/table-pivot.ts | 26 ++++++------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java index fcc56fc89d..4c2f0b65cc 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/table/TablePivotHandler.java @@ -243,11 +243,11 @@ public class TablePivotHandler extends GroupChartHandler { var tmpList = new ArrayList>(); 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); diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts index ef8692639c..e541ac6ae9 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts @@ -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 '-' }