|
|
|
@ -32,19 +32,30 @@ const PreviewTable: FC = (props) => {
|
|
|
|
|
className={styles.tableWrapper}
|
|
|
|
|
columns={columns}
|
|
|
|
|
dataSource={dataSource}
|
|
|
|
|
pagination={false}
|
|
|
|
|
bordered
|
|
|
|
|
size="small"
|
|
|
|
|
scroll={{ x: 1200, y: `calc(100vh - 109px)` }}
|
|
|
|
|
summary={() => {
|
|
|
|
|
if (!showSumrow) return;
|
|
|
|
|
let totalColumns: any[] = [];
|
|
|
|
|
_.forEach(columns, it => {
|
|
|
|
|
if (!it.children) {
|
|
|
|
|
totalColumns.push(it);
|
|
|
|
|
} else {
|
|
|
|
|
totalColumns = [...totalColumns, ...it.children];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return (
|
|
|
|
|
<Table.Summary fixed>
|
|
|
|
|
<Table.Summary.Row>
|
|
|
|
|
{
|
|
|
|
|
_.map(columns, (item, index) => {
|
|
|
|
|
_.map([{}, ...totalColumns], (item, index) => {
|
|
|
|
|
if (index === 0) {
|
|
|
|
|
return <Table.Summary.Cell index={0} key={index}><Text type="danger">总计</Text></Table.Summary.Cell>;
|
|
|
|
|
return <Table.Summary.Cell index={0} key={index} align="center"><Text
|
|
|
|
|
type="danger">总计</Text></Table.Summary.Cell>;
|
|
|
|
|
}
|
|
|
|
|
return <Table.Summary.Cell index={index} key={index}>
|
|
|
|
|
return <Table.Summary.Cell index={index} key={index} align="center">
|
|
|
|
|
<Text type="danger">{!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"}</Text>
|
|
|
|
|
</Table.Summary.Cell>;
|
|
|
|
|
})
|
|
|
|
|