From fabc045268d2fe29ca8b0f25093b9429d5818d22 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 25 六月 2025 19:23:43 +0800
Subject: [PATCH] 出库生成任务优化
---
rsf-admin/src/page/orders/wave/WaveItemList.jsx | 78 +++++++++++++++++++++++++++-----------
1 files changed, 55 insertions(+), 23 deletions(-)
diff --git a/rsf-admin/src/page/orders/wave/WaveItemList.jsx b/rsf-admin/src/page/orders/wave/WaveItemList.jsx
index 99ee024..7dfda50 100644
--- a/rsf-admin/src/page/orders/wave/WaveItemList.jsx
+++ b/rsf-admin/src/page/orders/wave/WaveItemList.jsx
@@ -33,21 +33,19 @@
DeleteButton,
useGetRecordId,
Button,
+ useRefresh,
} from 'react-admin';
+import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
+import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline';
+import PlayArrowOutlinedIcon from '@mui/icons-material/PlayArrowOutlined';
import { Box, Typography, Card, Stack } from '@mui/material';
+import ContentCreate from '@mui/icons-material/Create';
+import PageDrawer from "../../components/PageDrawer";
import { styled } from '@mui/material/styles';
import WaveItemCreate from "./WaveItemCreate";
-import EmptyData from "../../components/EmptyData";
-import MyCreateButton from "../../components/MyCreateButton";
-import MyExportButton from '../../components/MyExportButton';
-import PageDrawer from "../../components/PageDrawer";
import WaveItemEdit from "./WaveItemEdit";
-import MyField from "../../components/MyField";
-import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
-import * as Common from '@/utils/common';
-import ContentCreate from '@mui/icons-material/Create';
-import PlayArrowOutlinedIcon from '@mui/icons-material/PlayArrowOutlined';
-import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline';
+import request from '@/utils/request';
+
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
height: '.9em'
@@ -58,7 +56,7 @@
'& .column-name': {
},
'& .opt': {
- width: 200
+ width: 140
},
}));
@@ -126,7 +124,6 @@
bulkActionButtons={
<>
<BulkStartButton />
- <BulkPauseButton />
</>
}
rowClick={(id, resource, record) => false}
@@ -146,13 +143,16 @@
<TextField source="fieldsIndex" label="table.field.waveItem.fieldsIndex" />
<NumberField source="workQty" label="table.field.waveItem.workQty" />
<TextField source="unit" label="table.field.waveItem.unit" />
- <TextField source="exceStatus" label="table.field.waveItem.exceStatus" />
<TextField source="updateBy$" label="common.field.updateBy" />
<DateField source="updateTime" label="common.field.updateTime" showTime />
<TextField source="createBy$" label="common.field.createBy" />
<DateField source="createTime" label="common.field.createTime" showTime />
- <BooleanField source="statusBool" label="common.field.status" sortable={false} />
<TextField source="memo" label="common.field.memo" sortable={false} />
+ <TextField source="exceStatus$" label="table.field.waveItem.exceStatus" />
+ <WrapperField cellClassName="opt" label="common.field.opt">
+ <BulkPauseButton />
+ <ContinueButton />
+ </WrapperField>
</StyledDatagrid>
</List>
<WaveItemEdit
@@ -185,28 +185,60 @@
return (
<Button label="ra.action.edit" onClick={editClick} startIcon={<ContentCreate />} />
)
-
}
const BulkStartButton = () => {
const { data, selectedIds, onUnselectItems } = useListContext();
-
- const startClick = () => {
- onUnselectItems()
+ const waveId = useGetRecordId();
+ const notify = useNotify();
+ const refresh = useRefresh()
+ const startClick = async () => {
+ onUnselectItems();
+ const { data: { code, data, msg } } = await request.post('/wave/selects/task', { wave: waveId, waveItem: selectedIds });
+ if (code === 200) {
+ notify(msg);
+ setAutoExce(false)
+ } else {
+ notify(msg);
+ }
+ refresh()
}
return (
- <Button label="toolbar.start" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} variant="outlined" />
+ <Button label="toolbar.publicWorking" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} variant="outlined" />
)
}
const BulkPauseButton = () => {
const { data, selectedIds, onUnselectItems } = useListContext();
-
- const pauseClick = () => {
- onUnselectItems()
+ const notify = useNotify()
+ const record = useRecordContext();
+ const pauseClick = async () => {
+ const { data: { code, data, msg } } = await request.post('/waveItem/pause/pub', { wave: waveId, waveItem: selectedIds });
+ if (code === 200) {
+ notify(msg);
+ } else {
+ notify(msg);
+ }
}
return (
- <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseCircleOutlineIcon />} variant="outlined" />
+ record?.exceStatus == 1 ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseCircleOutlineIcon />} /> : <></>
+ )
+}
+
+const ContinueButton = () => {
+ const { data, selectedIds, onUnselectItems } = useListContext();
+ const notify = useNotify()
+ const record = useRecordContext();
+ const continueClick = async () => {
+ const { data: { code, data, msg } } = await request.post('/waveItem/continue/pub', { wave: waveId, waveItem: selectedIds });
+ if (code === 200) {
+ notify(msg);
+ } else {
+ notify(msg);
+ }
+ }
+ return (
+ record?.exceStatus == 4 ? <Button label="toolbar.continuePub" onClick={continueClick} startIcon={<PauseCircleOutlineIcon />} /> : <></>
)
}
\ No newline at end of file
--
Gitblit v1.9.1