From ecdc2cadd4a21b80de4e30e38878fdeb39084e3f Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期一, 23 六月 2025 17:05:12 +0800
Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop

---
 rsf-admin/src/page/orders/wave/WaveList.jsx |   47 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/rsf-admin/src/page/orders/wave/WaveList.jsx b/rsf-admin/src/page/orders/wave/WaveList.jsx
index 3407d5c..f8576d0 100644
--- a/rsf-admin/src/page/orders/wave/WaveList.jsx
+++ b/rsf-admin/src/page/orders/wave/WaveList.jsx
@@ -25,7 +25,7 @@
     useRedirect,
     Button,
 } from 'react-admin';
-import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
+import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_WAVE_AUTO_EXCE } from '@/config/setting';
 import PlayArrowOutlinedIcon from '@mui/icons-material/PlayArrowOutlined';
 import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline';
 import { Box, Typography, Card, Stack } from '@mui/material';
@@ -89,9 +89,21 @@
 const WaveList = () => {
     const translate = useTranslate();
     const [createDialog, setCreateDialog] = useState(false);
+    const [autoExce, setAutoExce] = useState(false);
     const [detailDialog, setDetailDialog] = useState(false);
     const [select, setSelectIds] = useState({});
     const [drawerVal, setDrawerVal] = useState(false);
+
+    useEffect(() => {
+        getConfig()
+    }, [])
+
+    const getConfig = async () => {
+        const { data: { code, data, msg } } = await request.get('/config/flag/' + DEFAULT_WAVE_AUTO_EXCE);
+        if (code === 200) {
+            setAutoExce(JSON.parse(data?.val))
+        } 
+    }
 
     return (
         <Box display="flex">
@@ -110,8 +122,8 @@
                 sort={{ field: "create_time", order: "desc" }}
                 actions={(
                     <TopToolbar>
-                        <BulkStartButton />
-                        <BulkPauseButton />
+                        <BulkStartButton autoExce={autoExce} setAutoExce={setAutoExce} />
+                        <BulkPauseButton autoExce={autoExce} setAutoExce={setAutoExce} />
                         <FilterButton />
                         <SelectColumnsButton preferenceKey='wave' />
                     </TopToolbar>
@@ -182,24 +194,39 @@
     );
 }
 
-const BulkStartButton = () => {
+const BulkStartButton = ({ autoExce, setAutoExce }) => {
     const { data, selectedIds, onUnselectItems } = useListContext();
-
-    const startClick = () => {
+    const notify = useNotify();
+    const startClick = async () => {
         onUnselectItems()
+        setAutoExce(true)
+        const { data: { code, data, msg } } = await request.post('/config/byFlag', { val: true, flag: 'WaveAutoExce' });
+        if (code === 200) {
+            notify(msg);
+        } else {
+            notify(msg);
+        }
     }
     return (
-        <Button label="toolbar.start" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />}  />
+        !autoExce ? <Button label="toolbar.start" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} /> : <></>
     )
 }
 
-const BulkPauseButton = () => {
+const BulkPauseButton = ({ autoExce, setAutoExce }) => {
+    const notify = useNotify();
     const { data, selectedIds, onUnselectItems } = useListContext();
 
-    const pauseClick = () => {
+    const pauseClick = async () => {
         onUnselectItems()
+        const { data: { code, data, msg } } = await request.post('/config/byFlag', { val: false, flag: 'WaveAutoExce' });
+        if (code === 200) {
+            notify(msg);
+            setAutoExce(false)
+        } else {
+            notify(msg);
+        }
     }
     return (
-        <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseCircleOutlineIcon />}  />
+        autoExce ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseCircleOutlineIcon />} /> : <></>
     )
 }
\ No newline at end of file

--
Gitblit v1.9.1