合并代码

This commit is contained in:
孙景学
2025-07-02 16:18:03 +08:00
parent 2b3eb5672d
commit 3ae57eb23b
87 changed files with 3852 additions and 19276 deletions

View File

@ -18,29 +18,33 @@ interface InvoiceInfo {
certificateUrl: string;
}
interface InvoiceTabProps {
viewType?: boolean;
}
const InvoiceTab: React.FC = () => {
const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
const { viewType = false } = props;
//语言切换
const intl = useIntl();
//列表渲染数据
const [data, setData] = useState<InvoiceInfo[]>([]);
//列表加载
const [loading, setLoading] = useState(false);
//列表分页
//列表分页
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
//列表方法
const getList = async (pageNo = 1, pageSize = 10) => {
setLoading(true);
try {
const { code, data } = await invoiceGetPage({pageNo, pageSize});
if (code === 200) {
setData(data.records);
setPagination({ current: pageNo, pageSize, total:data.total });
}
} finally {
setLoading(false);
}
setLoading(true);
try {
const { code, data } = await invoiceGetPage({ pageNo, pageSize });
if (code === 200) {
setData(data.records);
setPagination({ current: pageNo, pageSize, total: data.total });
}
} finally {
setLoading(false);
}
};
//增改查
@ -71,7 +75,7 @@ const InvoiceTab: React.FC = () => {
//初始化
useEffect(() => {
getList();
getList();
}, []);
const columns: ColumnsType<InvoiceInfo> = [
@ -86,33 +90,37 @@ const InvoiceTab: React.FC = () => {
{ title: 'page.workbench.invoice.updateTime', dataIndex: 'updateTime', ellipsis: true },
{
title: 'page.workbench.invoice.qualificationCertificate',
width:'180px',
width: '180px',
dataIndex: 'qualificationCertificate',
render: (val: string) => (val ? <a href={val} target="_blank" rel="noreferrer"></a> : '-'),
},
{
title: 'page.workbench.attachments.action',
dataIndex: 'option',
width: 120,
render: (_: any, record: InvoiceInfo) => (
<>
<a style={{ marginRight: 8 }} onClick={() => handleView(record)}></a>
<a onClick={() => handleEdit(record)}></a>
</>
),
},
...(viewType ? [] : [
{
title: 'page.workbench.attachments.action',
dataIndex: 'option',
width: 120,
render: (_: any, record: InvoiceInfo) => (
<>
<a style={{ marginRight: 8 }} onClick={() => handleView(record)}></a>
<a onClick={() => handleEdit(record)}></a>
</>
),
},
]),
];
return (
<div style={{ padding: '0 30px 0 0' }}>
<div style={{ marginBottom: 16 }}>
<Button type="primary" onClick={handleAdd}></Button>
<div style={{ marginBottom: 16 }}>
{!viewType && (
<Button type="primary" onClick={handleAdd}></Button>
)}
</div>
<Table
className="custom-table"
rowKey="id"
columns={columns.map(column => ({
...column,
title: intl.formatMessage({ id: column.title as string })
title: intl.formatMessage({ id: column.title as string })
}))}
dataSource={data}
pagination={pagination}