From f2833c7f3e01c997e94a66bd5dd9be738b5c6cc7 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 26 六月 2025 13:31:08 +0800
Subject: [PATCH] 波次任务下发功能优化

---
 rsf-admin/src/page/orders/wave/WaveItemList.jsx |   47 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/rsf-admin/src/page/orders/wave/WaveItemList.jsx b/rsf-admin/src/page/orders/wave/WaveItemList.jsx
index ea1c70f..0439bed 100644
--- a/rsf-admin/src/page/orders/wave/WaveItemList.jsx
+++ b/rsf-admin/src/page/orders/wave/WaveItemList.jsx
@@ -33,9 +33,11 @@
     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 StopCircleOutlinedIcon from '@mui/icons-material/StopCircleOutlined';
 import PlayArrowOutlinedIcon from '@mui/icons-material/PlayArrowOutlined';
 import { Box, Typography, Card, Stack } from '@mui/material';
 import ContentCreate from '@mui/icons-material/Create';
@@ -43,6 +45,7 @@
 import { styled } from '@mui/material/styles';
 import WaveItemCreate from "./WaveItemCreate";
 import WaveItemEdit from "./WaveItemEdit";
+import request from '@/utils/request';
 
 const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
     '& .css-1vooibu-MuiSvgIcon-root': {
@@ -141,15 +144,15 @@
                     <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 />
+                        <PauseButton />
+                        <ContinueButton />
                     </WrapperField>
                 </StyledDatagrid>
             </List>
@@ -189,6 +192,8 @@
 const BulkStartButton = () => {
     const { data, selectedIds, onUnselectItems } = useListContext();
     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 });
@@ -198,19 +203,45 @@
         } else {
             notify(msg);
         }
+        refresh()
     }
     return (
         <Button label="toolbar.publicWorking" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} variant="outlined" />
     )
 }
 
-const BulkPauseButton = () => {
-    const { data, selectedIds, onUnselectItems } = useListContext();
+const PauseButton = () => {
+    const notify = useNotify()
+    const refresh = useRefresh();
     const record = useRecordContext();
-    const pauseClick = () => {
-        onUnselectItems();
+    const pauseClick = async () => {
+        const { data: { code, data, msg } } = await request.post('/waveItem/pause/pub/' + record?.id);
+        if (code === 200) {
+            notify(msg);
+        } else {
+            notify(msg);
+        }
+        refresh()
     }
     return (
-        record?.exceStatus == 2 ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseCircleOutlineIcon />} /> : <></>
+        record?.exceStatus == 1 ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<StopCircleOutlinedIcon />} /> : <></>
+    )
+}
+
+const ContinueButton = () => {
+    const notify = useNotify()
+    const refresh = useRefresh();
+    const record = useRecordContext();
+    const continueClick = async () => {
+        const { data: { code, data, msg } } = await request.post('/waveItem/continue/pub/' + record?.id);
+        if (code === 200) {
+            notify(msg);
+        } else {
+            notify(msg);
+        }
+        refresh()
+    }
+    return (
+        record?.exceStatus == 2 ? <Button label="toolbar.continuePub" onClick={continueClick} startIcon={<PauseCircleOutlineIcon />} /> : <></>
     )
 }
\ No newline at end of file

--
Gitblit v1.9.1