添加页面合计
This commit is contained in:
@@ -245,6 +245,22 @@ const PaymentPage: React.FC = () => {
|
||||
) : null,
|
||||
];
|
||||
|
||||
/** 列表底部合计行:统计当前页的支付金额 */
|
||||
const renderListSummary: TableProps<IPayment>['summary'] = (pageData) => {
|
||||
const totalAmount = pageData.reduce((sum, row) => sum + Number(row.amount ?? 0), 0);
|
||||
return (
|
||||
<Table.Summary.Row>
|
||||
<Table.Summary.Cell index={0} colSpan={2} align="center">
|
||||
<Text strong>本页合计</Text>
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell index={2} align="center">
|
||||
<Text strong type="danger">¥{totalAmount.toFixed(2)}</Text>
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell index={3} colSpan={6} />
|
||||
</Table.Summary.Row>
|
||||
);
|
||||
};
|
||||
|
||||
const tableProps: XinTableProps<IPayment> = {
|
||||
api: '/recon/payment',
|
||||
columns,
|
||||
@@ -253,6 +269,7 @@ const PaymentPage: React.FC = () => {
|
||||
tableRef,
|
||||
operateRender,
|
||||
formProps: false,
|
||||
summary: renderListSummary,
|
||||
actionBarRender: (dom) => [dom.search, dom.keywordSearch],
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user