index.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import {useContextSection, useQueryTableList} from '@hooks';
  2. import {FC} from 'react';
  3. import {context, pageContext, searchContext} from '../content';
  4. import {getRelocationOrderList} from '@apis';
  5. import {ColumnsType} from 'antd/es/table';
  6. import {RelocationOrderListData} from '@models';
  7. import {HUGE_TABLE_WIDTH, MIDDLE_TABLE_WIDTH, NORMAL_TABLE_WIDTH, SMALL_TABLE_WIDTH} from '@utils';
  8. import {Card} from 'antd';
  9. import {Table} from '@components';
  10. const columns: ColumnsType<RelocationOrderListData> = [
  11. {
  12. title: '移库单ID',
  13. dataIndex: 'warehouseTransferId',
  14. key: 'warehouseTransferId',
  15. width: NORMAL_TABLE_WIDTH,
  16. },
  17. {
  18. title: '移库单编号',
  19. dataIndex: 'warehouseTransferCode',
  20. key: 'warehouseTransferCode',
  21. width: NORMAL_TABLE_WIDTH,
  22. },
  23. {
  24. title: 'WBS编号',
  25. dataIndex: 'WBS',
  26. key: 'WBS',
  27. width: NORMAL_TABLE_WIDTH,
  28. },
  29. {
  30. title: '物料名称',
  31. dataIndex: 'materialName',
  32. key: 'materialName',
  33. width: HUGE_TABLE_WIDTH,
  34. },
  35. {
  36. title: '物料编号',
  37. dataIndex: 'materialCode',
  38. key: 'materialCode',
  39. width: MIDDLE_TABLE_WIDTH,
  40. },
  41. {
  42. title: '要货仓库',
  43. dataIndex: 'askGoodsWarehouseName',
  44. key: 'askGoodsWarehouseName',
  45. width: MIDDLE_TABLE_WIDTH,
  46. },
  47. {
  48. title: '出货仓库',
  49. dataIndex: 'supplyWarehouseName',
  50. key: 'supplyWarehouseName',
  51. width: MIDDLE_TABLE_WIDTH,
  52. },
  53. {
  54. title: '移库类型',
  55. dataIndex: 'warehouseTransferType',
  56. key: 'warehouseTransferType',
  57. width: NORMAL_TABLE_WIDTH,
  58. },
  59. {
  60. title: '移库数量',
  61. dataIndex: 'num',
  62. key: 'num',
  63. width: SMALL_TABLE_WIDTH,
  64. },
  65. {
  66. title: '出库数量',
  67. dataIndex: 'outNum',
  68. key: 'outNum',
  69. width: SMALL_TABLE_WIDTH,
  70. },
  71. {
  72. title: '状态',
  73. dataIndex: 'type',
  74. key: 'type',
  75. width: SMALL_TABLE_WIDTH,
  76. render(_, {type}) {
  77. return type === '1' ? '已移库' : '未移库';
  78. },
  79. },
  80. {
  81. title: '单据日期',
  82. dataIndex: 'documentTime',
  83. key: 'documentTime',
  84. width: NORMAL_TABLE_WIDTH,
  85. },
  86. ];
  87. const TableList: FC = function () {
  88. const params = useContextSection(context, state => state[0]);
  89. const [{data, count}] = useQueryTableList({
  90. queryFn: getRelocationOrderList,
  91. params,
  92. pageContext,
  93. searchContext,
  94. });
  95. return (
  96. <Card className='table-wrapper'>
  97. <Table
  98. columns={columns}
  99. data={data}
  100. count={count}
  101. pageContext={pageContext}
  102. searchContext={searchContext}
  103. />
  104. </Card>
  105. );
  106. };
  107. export default TableList;