Files
ga-commission-system/ga-frontend/src/pages/rule/ExceptionCodeList.tsx
T

56 lines
2.5 KiB
TypeScript
Raw Normal View History

import { Tag } from 'antd';
import { ProTable, type ProColumns } from '@ant-design/pro-components';
import PageContainer from '@/components/common/PageContainer';
import { ruleApi, ExceptionCodeResp } from '@/api/rule';
const DIRECTION_COLOR = { PLUS: 'success', MINUS: 'error' } as const;
export default function ExceptionCodeList() {
const columns: ProColumns<ExceptionCodeResp>[] = [
{ title: '예외코드', dataIndex: 'exceptionCode', width: 120, search: false,
render: (_, r) => <strong>{r.exceptionCode}</strong> },
{ title: '예외명', dataIndex: 'exceptionName', width: 160, search: false },
{ title: '카테고리', dataIndex: 'category', width: 110, search: false },
{
title: '방향', dataIndex: 'direction', width: 80, align: 'center', search: false,
render: (_, r) => <Tag color={DIRECTION_COLOR[r.direction as 'PLUS' | 'MINUS'] ?? 'default'}>
{r.direction === 'PLUS' ? '가산 (+)' : '차감 (-)'}</Tag>,
},
{
title: '자동계산', dataIndex: 'autoCalcYn', width: 90, align: 'center', search: false,
render: (_, r) => r.autoCalcYn === 'Y' ? <Tag color="processing"></Tag> : <Tag></Tag>,
},
{
title: '승인 필요', dataIndex: 'approvalRequired', width: 90, align: 'center', search: false,
render: (_, r) => r.approvalRequired === 'Y' ? <Tag color="warning"></Tag> : <Tag></Tag>,
},
{
title: '과세', dataIndex: 'taxIncluded', width: 80, align: 'center', search: false,
render: (_, r) => r.taxIncluded === 'Y' ? <Tag color="success"></Tag> : <Tag></Tag>,
},
{ title: '설명', dataIndex: 'description', ellipsis: true, search: false },
{
title: '활성', dataIndex: 'isActive', width: 70, align: 'center', search: false,
render: (_, r) => <Tag color={r.isActive === 'Y' ? 'success' : 'default'}>
{r.isActive === 'Y' ? 'Y' : 'N'}</Tag>,
},
];
return (
<PageContainer title="예외 코드" description="가산/차감/승인/세금 정책 마스터 (예외금액 원장에서 사용)">
<ProTable<ExceptionCodeResp>
rowKey="exceptionCode"
columns={columns}
search={false}
request={async () => {
const list = await ruleApi.exceptionCodes();
return { data: list, total: list.length, success: true };
}}
pagination={{ pageSize: 50, showTotal: (t) => `${t}` }}
options={{ density: false, fullScreen: true, reload: true, setting: true }}
dateFormatter="string"
/>
</PageContainer>
);
}