From c19dbc2e7a49c6371abe4fd88c71338751c05dee Mon Sep 17 00:00:00 2001 From: duxingchen Date: Fri, 28 Aug 2026 17:00:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=80=8F=E8=A7=86=E8=A1=A8):=20=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=BA=95=E9=83=A8=E5=A2=9E=E5=8A=A0=E6=AF=8F=E5=88=97?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=90=88=E8=AE=A1=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 每块透视表底部 summary 行,统计各工序列的设备数合计 + 行总计 - 固定底部,方便查看每列总量 --- frontend/src/pages/MatrixBoard.tsx | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) 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} + + + + ); + }} />