index.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. import {FC} from 'react';
  2. import {WarehousingListData} from '@models';
  3. import {ColumnsType} from 'antd/es/table';
  4. import {Table, TableTools} from '@components';
  5. import {context, pageContext, searchContext} from '../context';
  6. import {Card} from 'antd';
  7. import {
  8. HUGE_TABLE_WIDTH,
  9. LARGE_TABLE_WIDTH,
  10. MIDDLE_TABLE_WIDTH,
  11. NORMAL_TABLE_WIDTH,
  12. SMALL_TABLE_WIDTH,
  13. } from '@utils';
  14. import {exportWarehousing, getWarehousingFlowList} from '@apis';
  15. import {useContextSection, useQueryTableList, useTableExportEvent} from '@hooks';
  16. const columns: ColumnsType<WarehousingListData> = [
  17. {
  18. title: '入库单编号',
  19. dataIndex: 'storageCode',
  20. key: 'storageCode',
  21. width: MIDDLE_TABLE_WIDTH,
  22. },
  23. {
  24. title: '采购订单号',
  25. dataIndex: 'orderCode',
  26. key: 'orderCode',
  27. width: MIDDLE_TABLE_WIDTH,
  28. },
  29. {
  30. title: '物料编号',
  31. dataIndex: 'wllbCode',
  32. key: 'wllbCode',
  33. width: MIDDLE_TABLE_WIDTH,
  34. },
  35. {
  36. title: '物料名称',
  37. dataIndex: 'materialName',
  38. key: 'materialName',
  39. width: HUGE_TABLE_WIDTH,
  40. },
  41. {
  42. title: '供应商名称',
  43. dataIndex: 'supplierName',
  44. key: 'supplierName',
  45. width: LARGE_TABLE_WIDTH,
  46. },
  47. {
  48. title: '所属公司',
  49. dataIndex: 'accountName',
  50. width: LARGE_TABLE_WIDTH,
  51. },
  52. {
  53. title: '公司编号',
  54. dataIndex: 'accountSleeve',
  55. width: SMALL_TABLE_WIDTH,
  56. },
  57. {
  58. title: '生产批次',
  59. dataIndex: 'producDate',
  60. key: 'producDate',
  61. width: NORMAL_TABLE_WIDTH,
  62. },
  63. {
  64. title: '入库数量',
  65. dataIndex: 'capacity',
  66. key: 'capacity',
  67. width: SMALL_TABLE_WIDTH,
  68. align: 'right',
  69. },
  70. {
  71. title: '采购数量',
  72. dataIndex: 'purchaseNum',
  73. width: SMALL_TABLE_WIDTH,
  74. align: 'right',
  75. },
  76. {
  77. title: '库位名称',
  78. dataIndex: 'storageLocationName',
  79. key: 'storageLocationName',
  80. width: NORMAL_TABLE_WIDTH,
  81. },
  82. {
  83. title: '工号',
  84. dataIndex: 'userName',
  85. key: 'userName',
  86. width: NORMAL_TABLE_WIDTH,
  87. },
  88. {
  89. title: '姓名',
  90. dataIndex: 'realName',
  91. key: 'realName',
  92. width: NORMAL_TABLE_WIDTH,
  93. },
  94. {
  95. title: 'WBS编号',
  96. dataIndex: 'wbs',
  97. key: 'wbs',
  98. width: MIDDLE_TABLE_WIDTH,
  99. },
  100. {
  101. title: '类型',
  102. dataIndex: 'type',
  103. key: 'type',
  104. width: SMALL_TABLE_WIDTH,
  105. },
  106. {
  107. title: '入库日期',
  108. dataIndex: 'scrq',
  109. key: 'scrq',
  110. width: MIDDLE_TABLE_WIDTH,
  111. },
  112. {
  113. title: '连番号',
  114. dataIndex: 'serial',
  115. key: 'serial',
  116. width: SMALL_TABLE_WIDTH,
  117. },
  118. ];
  119. const TableList: FC = function () {
  120. const params = useContextSection(context, state => state[0]);
  121. const [{data, count, isFetching}, {refetch}] = useQueryTableList({
  122. queryFn: getWarehousingFlowList,
  123. params,
  124. pageContext,
  125. searchContext,
  126. });
  127. const [isExporting, onExport] = useTableExportEvent({
  128. pageContext,
  129. context,
  130. fn: exportWarehousing,
  131. });
  132. return (
  133. <Card className='table-wrapper'>
  134. <TableTools
  135. onRefresh={refetch}
  136. isRefreshing={isFetching}
  137. isExporting={isExporting}
  138. onExport={onExport}
  139. />
  140. <Table
  141. data={data}
  142. count={count}
  143. pageContext={pageContext}
  144. searchContext={searchContext}
  145. columns={columns}
  146. data-testid='raw_in_stream_table'
  147. />
  148. </Card>
  149. );
  150. };
  151. export default TableList;