2026-02-28 15:29:12 +08:00
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
|
|
import { ProColumns, ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { Button, Tag } from 'antd';
|
|
|
|
|
import { listStockAdjusts } from '@/services/api';
|
2026-03-30 02:56:16 +00:00
|
|
|
import type { StockAdjust } from '@/types/api';
|
2026-02-28 15:29:12 +08:00
|
|
|
|
2026-03-30 02:56:16 +00:00
|
|
|
const STATUS_MAP: Record<number, { text: string; color: string }> = {
|
2026-02-28 15:29:12 +08:00
|
|
|
0: { text: '待审核', color: 'warning' },
|
|
|
|
|
1: { text: '已审核', color: 'success' },
|
|
|
|
|
2: { text: '已驳回', color: 'error' },
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-30 02:56:16 +00:00
|
|
|
const columns: ProColumns<StockAdjust>[] = [
|
2026-02-28 15:29:12 +08:00
|
|
|
{ title: '调整单号', dataIndex: 'adjustNo' },
|
|
|
|
|
{ title: '调整日期', dataIndex: 'adjustDate', valueType: 'date', search: false },
|
|
|
|
|
{ title: '调整原因', dataIndex: 'adjustReason', search: false },
|
|
|
|
|
{ title: '操作人', dataIndex: 'operator', search: false },
|
|
|
|
|
{
|
2026-03-30 02:56:16 +00:00
|
|
|
title: '状态',
|
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
search: false,
|
2026-02-28 15:29:12 +08:00
|
|
|
render: (_, record) => {
|
2026-03-30 02:56:16 +00:00
|
|
|
const s = STATUS_MAP[record.status] ?? STATUS_MAP[0];
|
2026-02-28 15:29:12 +08:00
|
|
|
return <Tag color={s.color}>{s.text}</Tag>;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{ title: '创建时间', dataIndex: 'createdAt', valueType: 'dateTime', search: false },
|
|
|
|
|
{ title: '操作', valueType: 'option', render: () => [<a key="view">查看</a>] },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const AdjustsPage: React.FC = () => (
|
2026-03-30 02:56:16 +00:00
|
|
|
<ProTable<StockAdjust>
|
2026-02-28 15:29:12 +08:00
|
|
|
headerTitle="库存调整"
|
|
|
|
|
rowKey="adjustId"
|
|
|
|
|
columns={columns}
|
|
|
|
|
search={false}
|
|
|
|
|
request={async (params) => {
|
2026-03-30 02:56:16 +00:00
|
|
|
const res = await listStockAdjusts({ page: params.current, pageSize: params.pageSize });
|
|
|
|
|
return { data: res?.data?.list || [], total: res?.data?.total || 0, success: res?.code === 0 };
|
2026-02-28 15:29:12 +08:00
|
|
|
}}
|
|
|
|
|
toolBarRender={() => [
|
|
|
|
|
<Button key="add" type="primary" icon={<PlusOutlined />}>创建调整单</Button>,
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default AdjustsPage;
|