diff --git a/frontend/src/pages/MatrixBoard.tsx b/frontend/src/pages/MatrixBoard.tsx
index 23c091a..974ab5c 100644
--- a/frontend/src/pages/MatrixBoard.tsx
+++ b/frontend/src/pages/MatrixBoard.tsx
@@ -49,7 +49,7 @@ export default function MatrixBoard() {
const matrixChunks = useMemo(() => {
const keys = Array.from(new Set(data.map((d) => d.dimension_key)));
if (keys.length === 0) return [];
- const chunks: { columns: any[]; dataSource: any[] }[] = [];
+ const chunks: { columns: any[]; dataSource: any[]; keys: string[] }[] = [];
for (let i = 0; i < keys.length; i += CHUNK_MATRIX) {
const chunkKeys = keys.slice(i, i + CHUNK_MATRIX);
@@ -99,7 +99,7 @@ export default function MatrixBoard() {
{ title: "合计", dataIndex: "row_total", fixed: "right" as const, align: "center" as const, width: 90, render: (v: number) => {v} },
];
- chunks.push({ columns, dataSource: Array.from(rowsMap.values()) });
+ chunks.push({ columns, dataSource: Array.from(rowsMap.values()), keys: chunkKeys });
}
return chunks;
}, [data]);
@@ -159,6 +159,29 @@ export default function MatrixBoard() {
size="small"
pagination={false}
scroll={{ x: "max-content" }}
+ summary={(pageData: readonly any[]) => {
+ const totals: Record = {};
+ let rowTotal = 0;
+ for (const row of pageData) {
+ rowTotal += row.row_total || 0;
+ for (const k of chunk.keys) totals[k] = (totals[k] || 0) + (row[k] || 0);
+ }
+ return (
+
+
+ 合计
+ {chunk.keys.map(k => (
+
+ {totals[k] || 0}
+
+ ))}
+
+ {rowTotal}
+
+
+
+ );
+ }}
/>