123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import {
- useContextSection,
- useQueryTableList,
- useTableExportEvent,
- } from '@hooks';
- import {FC} from 'react';
- import {PRELAOD_KEY, context, pageContext, searchContext} from '../context';
- import {exportInventoryLog, getInventoryDetailedList} from '@apis';
- import {Card} from 'antd';
- import {Table, TableTools} from '@components';
- import {ColumnsType} from 'antd/es/table';
- import {InventoryLogListData} from '@models';
- import {
- HUGE_TABLE_WIDTH,
- MODAL_PAGE_SIZE_LIST,
- NORMAL_TABLE_WIDTH,
- } from '@utils';
- const columns: ColumnsType<InventoryLogListData> = [
- {title: '物料编号', dataIndex: 'wllbCode', width: NORMAL_TABLE_WIDTH},
- {title: '物料名称', dataIndex: 'name', width: HUGE_TABLE_WIDTH},
- {
- title: '库位名称',
- dataIndex: 'storageLocationName',
- width: NORMAL_TABLE_WIDTH,
- },
- {
- title: '系统库存',
- dataIndex: 'total',
- width: NORMAL_TABLE_WIDTH,
- align: 'right',
- },
- {
- title: '实际库存',
- dataIndex: 'amount',
- width: NORMAL_TABLE_WIDTH,
- align: 'right',
- },
- ];
- const TableList: FC = function () {
- const params = useContextSection(context, state => state[0]);
- const [{data, count}] = useQueryTableList({
- queryFn: getInventoryDetailedList,
- pageContext,
- searchContext,
- params,
- });
- const [isExporting, onExport] = useTableExportEvent({
- fn: exportInventoryLog,
- pageContext,
- context,
- });
- return (
- <Card className='table-wrapper'>
- <TableTools
- pageContext={pageContext}
- searchContext={searchContext}
- isExporting={isExporting}
- onExport={onExport}
- preloadKey={PRELAOD_KEY}
- />
- <Table
- data={data}
- count={count}
- pageContext={pageContext}
- searchContext={searchContext}
- columns={columns}
- data-testid='inventory_log_table'
- pageSizeList={MODAL_PAGE_SIZE_LIST}
- preloadKey={PRELAOD_KEY}
- isSecondLevel
- />
- </Card>
- );
- };
- export default TableList;
|