From c4afa5b32a272947c094516a52a45fe9d1c74719 Mon Sep 17 00:00:00 2001 From: vincentlu <t1341870251@gmail.com> Date: 星期一, 21 四月 2025 08:41:34 +0800 Subject: [PATCH] # --- /dev/null | 40 ------------- zy-acs-flow/src/i18n/en.js | 1 zy-acs-flow/src/map/header/MoreOperate.jsx | 82 +++++++++++++++++++++++++++ zy-acs-flow/src/i18n/zh.js | 1 zy-acs-flow/src/map/MapPage.jsx | 4 5 files changed, 86 insertions(+), 42 deletions(-) diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js index 66cf082..c034b8f 100644 --- a/zy-acs-flow/src/i18n/en.js +++ b/zy-acs-flow/src/i18n/en.js @@ -655,6 +655,7 @@ restoreALl: 'Restore All', startPatrol: 'START PATROL', stopPatrol: 'STOP PATROL', + moreOperation: 'More Operation', }, mode: { observer: 'OBSERVER', diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js index a1f933e..d6dd737 100644 --- a/zy-acs-flow/src/i18n/zh.js +++ b/zy-acs-flow/src/i18n/zh.js @@ -655,6 +655,7 @@ restoreALl: '鎭㈠鎵�鏈�', startPatrol: '寮�鍚� 宸¢��', stopPatrol: '鍋滄 宸¢��', + moreOperation: '鏇村鎿嶄綔', }, mode: { observer: '瑙傚療妯″紡', diff --git a/zy-acs-flow/src/map/MapPage.jsx b/zy-acs-flow/src/map/MapPage.jsx index a92cbe7..84cb23f 100644 --- a/zy-acs-flow/src/map/MapPage.jsx +++ b/zy-acs-flow/src/map/MapPage.jsx @@ -25,7 +25,7 @@ import PulseSignal from "../page/components/PulseSignal"; import FakeFab from "./header/FakeFab"; import RouteFab from "./header/RouteFab"; -import RePositionBtn from "./header/RePositionBtn"; +import MoreOperate from "./header/MoreOperate"; let player; let websocket; @@ -283,10 +283,10 @@ > {rcsStatus ? translate('page.map.action.shutdown') : translate('page.map.action.startup')} </Button> - <RePositionBtn /> <Button variant="contained" color="primary"> {translate('page.map.action.monitor')} </Button> + <MoreOperate /> </> )} diff --git a/zy-acs-flow/src/map/header/MoreOperate.jsx b/zy-acs-flow/src/map/header/MoreOperate.jsx new file mode 100644 index 0000000..6fc63c9 --- /dev/null +++ b/zy-acs-flow/src/map/header/MoreOperate.jsx @@ -0,0 +1,82 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { useTranslate } from "react-admin"; +import { + Select, + MenuItem, + Button, + useTheme, + ListItemIcon, + ListItemText, +} from '@mui/material'; +import { handleRePositionAll } from "../http"; +import VisibilityIcon from '@mui/icons-material/Visibility'; + +const RePositionBtn = ({ }) => { + const translate = useTranslate(); + const theme = useTheme(); + + const handleToggle = () => { + let pass = true; + const pwd = prompt("please enter password:"); + if (pwd === 'xltys1995') { + pass = true; + } else { + pass = false; + if (pwd) { + alert('Incorrect password'); + } + } + if (pass) { + handleRePositionAll(null, (res) => { + console.log(res); + }); + } + } + + return ( + <> + <Select + value={translate('page.map.action.moreOperation')} + onChange={(event) => { + console.log(event.target.value); + }} + renderValue={(selected) => + translate('page.map.action.moreOperation') + } + variant="outlined" + size="small" + sx={{ + ml: 2, + backgroundColor: theme.palette.background.paper, + color: theme.palette.text.primary, + borderRadius: 1, + }} + > + <MenuItem value={translate('page.map.action.moreOperation')} sx={{ display: 'none' }} /> + <MenuItem + onClick={() => { + alert(1) + }} + > + <ListItemIcon> + <VisibilityIcon fontSize="small" /> + </ListItemIcon> + <ListItemText>瑙傚療妯″紡</ListItemText> + </MenuItem> + <MenuItem >{translate('page.map.mode.movable')}</MenuItem> + <MenuItem >{translate('page.map.mode.settings')}</MenuItem> + </Select> + {/* <Button + variant="contained" + color="primary" + onClick={handleToggle} + sx={{ mr: 2 }} + > + 閲嶆柊瀹氫綅 + </Button> */} + </> + + ); +} + +export default RePositionBtn; \ No newline at end of file diff --git a/zy-acs-flow/src/map/header/RePositionBtn.jsx b/zy-acs-flow/src/map/header/RePositionBtn.jsx deleted file mode 100644 index 2dedf87..0000000 --- a/zy-acs-flow/src/map/header/RePositionBtn.jsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { useState, useRef, useEffect, useMemo } from "react"; -import { useTranslate } from "react-admin"; -import { - Button, -} from '@mui/material'; -import { handleRePositionAll } from "../http"; - -const RePositionBtn = ({ onClick }) => { - - const handleToggle = () => { - let pass = true; - const pwd = prompt("please enter password:"); - if (pwd === 'xltys1995') { - pass = true; - } else { - pass = false; - if (pwd) { - alert('Incorrect password'); - } - } - if (pass) { - handleRePositionAll(null, (res) => { - console.log(res); - }); - } - } - - return ( - <Button - variant="contained" - color="primary" - onClick={handleToggle} - sx={{ mr: 2 }} - > - 閲嶆柊瀹氫綅 - </Button> - ); -} - -export default RePositionBtn; \ No newline at end of file -- Gitblit v1.9.1