2025-07-25 16:42:54 +08:00

125 lines
3.3 KiB
TypeScript

import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
usePageTabs,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { HouseBillsTypeEnum } from '@/gen/Enums';
import { ProTable } from '@ant-design/pro-components';
import { Space } from 'antd';
import Create from './modals/Create';
import Update from './modals/Update';
export default function Index({ title = '账单' }) {
// 注册当前页面为标签页
usePageTabs({
tabKey: 'house-bills',
tabLabel: title,
});
return (
<MyPageContainer
title={title}
enableTabs={true}
tabKey="house-bills"
tabLabel={title}
>
<ProTable
{...MyProTableProps.props}
request={async (params, sort) =>
MyProTableProps.request(params, sort, Apis.Bill.HouseBills.List)
}
toolBarRender={(action) => [
<Create key="Create" reload={action?.reload} title={title} />,
]}
columns={[
MyColumns.ID(),
MyColumns.EnumTag({
title: '类型',
dataIndex: 'type',
valueEnum: HouseBillsTypeEnum,
}),
{
title: '房屋',
dataIndex: ['asset_house', 'full_name'],
search: {
transform: (value) => {
return { full_name: value };
},
},
},
{
title: '账单月份',
dataIndex: 'month',
width: 100,
},
{
title: '账单金额',
dataIndex: 'amount',
search: false,
width: 100,
},
{
title: '优惠金额',
dataIndex: 'discount_amount',
search: false,
width: 100,
},
{
title: '滞纳金',
dataIndex: 'late_fee',
search: false,
width: 100,
},
// {
// title: '计费开始日期',
// dataIndex: 'start_date',
// search: false,
// width: 120,
// },
// {
// title: '计费结束日期',
// dataIndex: 'end_date',
// search: false,
// width: 120,
// },
// {
// title: '滞纳金起算日期',
// dataIndex: 'late_start_date',
// search: false,
// },
// {
// title: '已收滞纳金天数',
// dataIndex: 'collected_late_fee_days',
// search: false,
// // },
// {
// title: '备注',
// dataIndex: 'remark',
// search: false,
// },
// MyColumns.CreatedAt(),
MyColumns.UpdatedAt(),
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<Update item={item} reload={action?.reload} title={title} />
<MyButtons.Delete
onConfirm={() =>
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
action?.reload(),
)
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}