|
|
@@ -3,6 +3,7 @@ import {ProductionRequisitionListData} from '@models';
|
|
|
import {
|
|
|
CODE_COL_WIDTH,
|
|
|
COMPANY_COL_WIDTH,
|
|
|
+ DOUBLE_BTN_WIDTH,
|
|
|
ENTYR_NUMBER_COL_WIDTH,
|
|
|
HUGE_TABLE_WIDTH,
|
|
|
MATERIAL_CODE_COL_WIDTH,
|
|
|
@@ -11,7 +12,12 @@ import {
|
|
|
SMALL_TABLE_WIDTH,
|
|
|
WBS_COL_WIDTH,
|
|
|
} from '@utils';
|
|
|
-import {useContextSection, useSupertube, useTableDeleteEvent} from '@hooks';
|
|
|
+import {
|
|
|
+ useContextSection,
|
|
|
+ useSupertube,
|
|
|
+ useTableDeleteEvent,
|
|
|
+ useTableModalEvent,
|
|
|
+} from '@hooks';
|
|
|
import {Button} from 'antd';
|
|
|
import {delProductionRequisition, delUnProductionRequisition} from '@apis';
|
|
|
import {context} from '../context';
|
|
|
@@ -124,6 +130,10 @@ export function useColumns(refetch: () => void) {
|
|
|
label: `${type === '1' ? '生产' : '非生产'}领料单`,
|
|
|
},
|
|
|
);
|
|
|
+ const [
|
|
|
+ {editId: editState, visible},
|
|
|
+ {onEdit, onClose},
|
|
|
+ ] = useTableModalEvent<{id: string, type: '0' | '1'}>({id: '', type: '1'});
|
|
|
|
|
|
const delColumns: ColumnsType<ProductionRequisitionListData> = [
|
|
|
{
|
|
|
@@ -131,10 +141,18 @@ export function useColumns(refetch: () => void) {
|
|
|
dataIndex: 'id',
|
|
|
key: 'id',
|
|
|
fixed: 'right',
|
|
|
- width: SMALL_TABLE_WIDTH,
|
|
|
+ width: DOUBLE_BTN_WIDTH,
|
|
|
render(_, {id, askGoodsCode}) {
|
|
|
return (
|
|
|
<>
|
|
|
+ <Button
|
|
|
+ type="text"
|
|
|
+ className="ant-text-btn-color-primary"
|
|
|
+ disabled={pendingId === id}
|
|
|
+ onClick={onEdit({id, type: type === '1' ? '0' : '1'})}
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </Button>
|
|
|
<Button
|
|
|
type="text"
|
|
|
danger
|
|
|
@@ -150,5 +168,12 @@ export function useColumns(refetch: () => void) {
|
|
|
];
|
|
|
|
|
|
const isSuper = useSupertube();
|
|
|
- return isSuper ? [...columns, ...delColumns] : columns;
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ columns: isSuper ? [...columns, ...delColumns] : columns,
|
|
|
+ editState,
|
|
|
+ visible,
|
|
|
+ },
|
|
|
+ {onClose},
|
|
|
+ ] as const;
|
|
|
}
|