ylj20011123 d3a4c2ad28 update
2025-09-01 18:27:05 +08:00

96 lines
5.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: cclu 1106109051@qq.com
* @Date: 2024-10-31 09:35:52
* @LastEditors: cclu 1106109051@qq.com
* @LastEditTime: 2025-03-13 09:40:17
* @FilePath: \cloud-platform\src\pages\reports\settlementAccount\component\printContent.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import ProTable from "@ant-design/pro-table";
import numeral from 'numeral'
import { formatNumber, formatToTwoDecimalPlaces } from "@/services/options";
type DetailProps = {
pageName: string; // 控制如果出现多个页面都调用该组件 不会调用其他页面的该组件
exportColumns: any;// 导出的表格字段
exportData: any;// 导出的表格数据
exportSumRow?: any; // 导出表格的合计内容
type?: string;// 类型 暂时年度月度 年度 year年度不显示租金和其他 月度 month
}
const PrintContent = ({ pageName, exportColumns, exportData, exportSumRow, type }: DetailProps) => {
const removeDataIndex = (columns: any, removeKeys: any) => {
return columns
.map((column: any) => {
// 如果存在 children递归调用自身处理子层级
if (column.children) {
column.children = removeDataIndex(column.children, removeKeys);
}
return column;
})
.filter((column: any) => !removeKeys.includes(column.dataIndex)); // 过滤掉符合条件的 dataIndex
};
console.log('exportSumRow', exportSumRow)
return (
<div>
<ProTable
style={{ display: "none" }}
className={`${pageName}TestTable testTable`}
columns={type === 'year' ? removeDataIndex(exportColumns, ['PaidFee_9090', 'PaidFee_9099']) : exportColumns}
dataSource={exportData}
pagination={false}
bordered
expandable={{
defaultExpandAllRows: true
}}
summary={() => {
return <>
{
exportSumRow ?
<tr>
<td colSpan={2} align={'center'}>{exportSumRow?.PeriodIndexStr}</td>
<td align={'right'}>{exportSumRow?.MinturnOver ? formatToTwoDecimalPlaces(exportSumRow?.MinturnOver) : '0.00'}</td>
<td></td>
<td align={'right'}>{exportSumRow?.CashAmount ? formatToTwoDecimalPlaces(exportSumRow?.CashAmount) : '0.00'}</td>
<td align={'right'}>{exportSumRow?.MobilePayAmount ? formatToTwoDecimalPlaces(exportSumRow?.MobilePayAmount) : '0.00'}</td>
<td align={'right'}>{exportSumRow?.RevenueAmount ? formatToTwoDecimalPlaces(exportSumRow?.RevenueAmount) : '0.00'}</td>
<td align={'right'}>{exportSumRow?.amount ? formatToTwoDecimalPlaces(exportSumRow?.amount) : '0.00'}</td>
<td align={'right'}>{exportSumRow?.RoyaltyAmount ? formatToTwoDecimalPlaces(exportSumRow?.RoyaltyAmount) : '0.00'}</td>
<td align={'right'}>{exportSumRow?.GuaranteeFee ? formatToTwoDecimalPlaces(exportSumRow?.GuaranteeFee) : '0.00'}</td>
{/* <td align={'right'}>{exportSumRow?.ReceivableAmount ? formatToTwoDecimalPlaces(exportSumRow?.ReceivableAmount) : '0.00'}</td> */}
<td align={'right'}>{exportSumRow?.TotalFee ? formatToTwoDecimalPlaces(exportSumRow?.TotalFee) : '0.00'}</td>
<td align={'right'}>{exportSumRow?.PaidFee ? formatToTwoDecimalPlaces(exportSumRow?.PaidFee) : '0.00'}</td>
{/* <td align={'right'}>{exportSumRow?.PaidFee_9010 ? numeral(exportSumRow?.PaidFee_9010).format('0,0.00') : ''}</td>
<td align={'right'}>{exportSumRow?.PaidFee_9020 ? numeral(exportSumRow?.PaidFee_9020).format('0,0.00') : ''}</td>
<td align={'right'}>{exportSumRow?.PaidFee_9030 ? numeral(exportSumRow?.PaidFee_9030).format('0,0.00') : ''}</td>
<td align={'right'}>{exportSumRow?.PaidFee_9050 ? numeral(exportSumRow?.PaidFee_9050).format('0,0.00') : ''}</td> */}
{
type === 'year' ? ''
: <>
<td align={'right'}>{exportSumRow?.PaidFee_9090 ? formatToTwoDecimalPlaces(exportSumRow?.PaidFee_9090) : '0.00'}</td>
<td align={'right'}>{exportSumRow?.PaidFee_9099 ? formatToTwoDecimalPlaces(exportSumRow?.PaidFee_9099) : '0.00'}</td>
</>
}
<td align={'right'}>{exportSumRow?.ReductionAmountSum ? formatToTwoDecimalPlaces(exportSumRow?.ReductionAmountSum) : '0'}</td>
<td align={'right'}>{exportSumRow?.RefundSupplement ? formatToTwoDecimalPlaces(exportSumRow?.RefundSupplement) : '0'}</td>
<td>{exportSumRow?.desc}</td>
</tr> : ''
}
</>
}}
/>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(PrintContent);