From 87fda255732e4709e923f5b4c1e6b401e20c6002 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 09 十一月 2024 15:25:20 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/insight/agv/AgvMain.jsx |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/zy-acs-flow/src/map/insight/agv/AgvMain.jsx b/zy-acs-flow/src/map/insight/agv/AgvMain.jsx
index c5aaf5b..2c981e6 100644
--- a/zy-acs-flow/src/map/insight/agv/AgvMain.jsx
+++ b/zy-acs-flow/src/map/insight/agv/AgvMain.jsx
@@ -14,7 +14,7 @@
 } from '@mui/material';
 import { useNotification } from '../../Notification';
 import AgvThree from './AgvThree';
-import { handleRestoreAgvAll } from '../../http';
+import { handleRestoreAgvAll, handleAgvPatrol } from '../../http';
 import BoolValueIcon from '../BoolValueIcon';
 import ConfirmButton from '../../../page/components/ConfirmButton';
 import { grey } from '@mui/material/colors';
@@ -122,6 +122,13 @@
         });
     }
 
+    const patrolControl = async () => {
+        const res = await handleAgvPatrol({ agvNo: info.agvNo })
+        if (res) {
+            fetchAgvInfo(curAgvNo);
+        }
+    }
+
     return (
         <Box display="flex" height="100%">
             <Box
@@ -193,7 +200,8 @@
                     }}>
                         <Grid container spacing={2} style={{ marginTop: '0px' }}>
                             <Grid item xs={12}>
-                                <Stack spacing={2} mt={2}>
+                                <Stack spacing={1} mt={2}>
+                                    {/* more */}
                                     <Button
                                         color="primary"
                                         variant="contained"
@@ -203,8 +211,33 @@
                                     >
                                         {translate('page.map.settings.map.more.title')}
                                     </Button>
+                                    {/* patrol */}
                                     {info && (
-                                        info.status === 1
+                                        info.patrol
+                                            ?
+                                            <Button variant="contained" color="error" fullWidth onClick={() => {
+                                                patrolControl();
+                                            }}>
+                                                {translate('page.map.action.stopPatrol')}
+                                            </Button>
+                                            :
+                                            // <Button variant="contained" fullWidth onClick={() => {
+                                            //     patrolControl();
+                                            // }}>
+                                            //     {translate('page.map.action.startPatrol')}
+                                            // </Button>
+                                            <ConfirmButton
+                                                label="page.map.action.startPatrol"
+                                                color="primary"
+                                                variant="contained"
+                                                onConfirm={() => {
+                                                    patrolControl();
+                                                }}
+                                            />
+                                    )}
+                                    {/* status */}
+                                    {info && (
+                                        info.status === 0
                                             ? <Button variant="contained" color="error" fullWidth onClick={() => {
                                                 updateStatus();
                                             }}>
@@ -216,6 +249,7 @@
                                                 {translate('page.map.action.enable')}
                                             </Button>
                                     )}
+                                    {/* restore all */}
                                     <ConfirmButton
                                         label="page.map.action.restoreALl"
                                         color="inherit"

--
Gitblit v1.9.1