|
@@ -0,0 +1,67 @@
|
|
|
+import {deleteOtherOut} from '@apis';
|
|
|
+import {useSupertube, useTableDeleteEvent} from '@hooks';
|
|
|
+import {OtherOutListData} from '@models';
|
|
|
+import {
|
|
|
+ HUGE_TABLE_WIDTH,
|
|
|
+ LARGE_TABLE_WIDTH,
|
|
|
+ NORMAL_TABLE_WIDTH,
|
|
|
+ SMALL_TABLE_WIDTH,
|
|
|
+} from '@utils';
|
|
|
+import {Button} from 'antd';
|
|
|
+import {ColumnsType} from 'antd/es/table';
|
|
|
+
|
|
|
+const columns: ColumnsType<OtherOutListData> = [
|
|
|
+ {title: ' 出库单编号', dataIndex: 'askGoodsCode', width: LARGE_TABLE_WIDTH},
|
|
|
+ {title: '物料编号', dataIndex: 'materialCode', width: LARGE_TABLE_WIDTH},
|
|
|
+ {title: '物料名称', dataIndex: 'materialName', width: HUGE_TABLE_WIDTH},
|
|
|
+ {
|
|
|
+ title: '出库数量',
|
|
|
+ dataIndex: 'num',
|
|
|
+ width: SMALL_TABLE_WIDTH,
|
|
|
+ align: 'right',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '已出库数量',
|
|
|
+ dataIndex: 'outNum',
|
|
|
+ width: NORMAL_TABLE_WIDTH,
|
|
|
+ align: 'right',
|
|
|
+ },
|
|
|
+ {title: '所属公司', dataIndex: 'companyName', width: LARGE_TABLE_WIDTH},
|
|
|
+ {title: '公司编号', dataIndex: 'companyNumber', width: SMALL_TABLE_WIDTH},
|
|
|
+ {title: '领用部门', dataIndex: 'department', width: NORMAL_TABLE_WIDTH},
|
|
|
+ {title: '通知时间', dataIndex: 'sqrq', width: NORMAL_TABLE_WIDTH},
|
|
|
+ {title: 'WBS编号', dataIndex: 'wbs', width: NORMAL_TABLE_WIDTH},
|
|
|
+];
|
|
|
+
|
|
|
+export function useColumns(refetch: () => void) {
|
|
|
+ const isSuper = useSupertube();
|
|
|
+ const [pendingId, onDelete] = useTableDeleteEvent(deleteOtherOut, refetch, {
|
|
|
+ label: '其他出库',
|
|
|
+ });
|
|
|
+
|
|
|
+ const tableColumns: ColumnsType<OtherOutListData> = [
|
|
|
+ ...columns,
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'id',
|
|
|
+ width: SMALL_TABLE_WIDTH,
|
|
|
+ fixed: 'right',
|
|
|
+ render(_, {id, askGoodsCode}) {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <Button
|
|
|
+ type='text'
|
|
|
+ danger
|
|
|
+ loading={pendingId === id}
|
|
|
+ onClick={onDelete(id, askGoodsCode)}
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </Button>
|
|
|
+ </>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ return isSuper ? tableColumns : columns;
|
|
|
+}
|