Files
ga-commission-system/ga-frontend/src/pages/product/ContractList.tsx
T

67 lines
3.1 KiB
TypeScript
Raw Normal View History

import { ProTable, type ProColumns } from '@ant-design/pro-components';
import PageContainer from '@/components/common/PageContainer';
import CodeBadge from '@/components/common/CodeBadge';
import MoneyText from '@/components/common/MoneyText';
import { useCommonCodes } from '@/hooks/useCommonCodes';
import { contractApi, ContractResp, ContractSearchParam } from '@/api/contract';
export default function ContractList() {
const { data: insuranceCodes = [] } = useCommonCodes('INSURANCE_TYPE');
const { data: statusCodes = [] } = useCommonCodes('CONTRACT_STATUS');
const columns: ProColumns<ContractResp>[] = [
{
title: '검색어', dataIndex: 'searchKeyword', hideInTable: true,
fieldProps: { placeholder: '계약자/증권번호' },
},
{
title: '보험종류', dataIndex: 'insuranceType', width: 100, valueType: 'select',
valueEnum: Object.fromEntries(insuranceCodes.map((c) => [c.code, { text: c.codeName }])),
render: (_, r) => <CodeBadge groupCode="INSURANCE_TYPE" value={r.insuranceType} />,
},
{
title: '상태', dataIndex: 'status', width: 90, valueType: 'select',
valueEnum: Object.fromEntries(statusCodes.map((c) => [c.code, { text: c.codeName }])),
render: (_, r) => <CodeBadge groupCode="CONTRACT_STATUS" value={r.status} />,
},
{ title: '증권번호', dataIndex: 'policyNo', width: 140, search: false },
{ title: '계약자', dataIndex: 'contractorName', width: 100, search: false },
{ title: '설계사', dataIndex: 'agentName', width: 100, search: false },
{ title: '보험사', dataIndex: 'companyName', width: 120, search: false },
{ title: '상품', dataIndex: 'productName', width: 220, search: false },
{
title: '보험료', dataIndex: 'premium', width: 120, align: 'right', search: false,
render: (_, r) => <MoneyText value={r.premium} />,
},
{
title: '납입주기', dataIndex: 'payCycle', width: 90, search: false,
render: (_, r) => <CodeBadge groupCode="PAY_CYCLE" value={r.payCycle} />,
},
{ title: '계약일', dataIndex: 'contractDate', width: 110, search: false },
];
return (
<PageContainer title="계약 관리" description="보험사·상품·계약 통합 관리">
<ProTable<ContractResp, ContractSearchParam>
rowKey="contractId"
columns={columns}
scroll={{ x: 1300 }}
request={async (params) => {
const { current, pageSize, ...rest } = params as any;
const res = await contractApi.list({ ...rest, pageNum: current, pageSize });
return { data: res.list, total: res.total, success: true };
}}
pagination={{
pageSize: 20,
showSizeChanger: true,
pageSizeOptions: ['20', '50', '100'],
showTotal: (total) => `${total.toLocaleString()}`,
}}
search={{ labelWidth: 'auto', searchText: '검색', resetText: '초기화', collapsed: false, collapseRender: false }}
options={{ density: false, fullScreen: true, reload: true, setting: true }}
dateFormatter="string"
/>
</PageContainer>
);
}