forked from yoone/WEB
107 lines
2.2 KiB
TypeScript
107 lines
2.2 KiB
TypeScript
import { stockcontrollerGetstockrecords } from '@/servers/api/stock';
|
|
import {
|
|
ActionType,
|
|
PageContainer,
|
|
ProColumns,
|
|
ProTable,
|
|
} from '@ant-design/pro-components';
|
|
import { App } from 'antd';
|
|
import { useRef } from 'react';
|
|
|
|
const ListPage: React.FC = () => {
|
|
const { message } = App.useApp();
|
|
const actionRef = useRef<ActionType>();
|
|
const columns: ProColumns<API.StockRecordDTO>[] = [
|
|
{
|
|
title: '仓库',
|
|
dataIndex: 'stockPointName',
|
|
hideInSearch: true,
|
|
},
|
|
{
|
|
title: '产品名称',
|
|
dataIndex: 'productName',
|
|
},
|
|
{
|
|
title: 'SKU',
|
|
dataIndex: 'productSku',
|
|
hideInSearch: true,
|
|
},
|
|
{
|
|
title: '出入库',
|
|
dataIndex: 'operationType',
|
|
valueType: 'select',
|
|
valueEnum: {
|
|
'in': {
|
|
text: '入库'
|
|
},
|
|
"out": {
|
|
text: '出库'
|
|
}
|
|
},
|
|
},
|
|
{
|
|
title: '库存',
|
|
hideInSearch: true,
|
|
render: (_, record: API.StockRecordDTO) => (
|
|
<span>
|
|
{record?.operationType === 'in' ? '+' : '-'}
|
|
{record.quantityChange}
|
|
</span>
|
|
),
|
|
},
|
|
{
|
|
title: '操作人',
|
|
dataIndex: 'operatorName',
|
|
hideInSearch: true,
|
|
},
|
|
{
|
|
title: '备注',
|
|
dataIndex: 'note',
|
|
hideInSearch: true,
|
|
},
|
|
{
|
|
title: '创建时间',
|
|
dataIndex: 'createdAt',
|
|
valueType: 'dateTime',
|
|
hideInSearch: true,
|
|
},
|
|
{
|
|
title: '起始日期',
|
|
dataIndex: 'startDate',
|
|
valueType: 'date',
|
|
hideInTable: true,
|
|
},
|
|
{
|
|
title: '结束日期',
|
|
dataIndex: 'endDate',
|
|
valueType: 'date',
|
|
hideInTable: true,
|
|
},
|
|
];
|
|
|
|
return (
|
|
<PageContainer ghost>
|
|
<ProTable<API.StockRecordDTO>
|
|
headerTitle="查询表格"
|
|
actionRef={actionRef}
|
|
rowKey="id"
|
|
request={async (params) => {
|
|
const { data, success } = await stockcontrollerGetstockrecords(
|
|
params,
|
|
);
|
|
|
|
return {
|
|
total: data?.total || 0,
|
|
data: data?.items || [],
|
|
success,
|
|
};
|
|
}}
|
|
columns={columns}
|
|
// toolBarRender={() => [<CreateForm tableRef={actionRef} />]}
|
|
/>
|
|
</PageContainer>
|
|
);
|
|
};
|
|
|
|
export default ListPage;
|