From 7fba4f90e8f6a489bb8767fb48a8c1028fe1ed9f Mon Sep 17 00:00:00 2001 From: vincentlu <t1341870251@gmail.com> Date: 星期一, 21 四月 2025 09:23:25 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/header/FakeFab.jsx | 3 ++- zy-acs-flow/src/config/setting.js | 2 ++ zy-acs-flow/src/map/http.js | 4 ++-- zy-acs-flow/src/i18n/en.js | 2 +- zy-acs-flow/src/map/header/MoreOperate.jsx | 35 +++++++++++++++++++++++++++-------- zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java | 10 ++++++---- 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/zy-acs-flow/src/config/setting.js b/zy-acs-flow/src/config/setting.js index c558454..05cd956 100644 --- a/zy-acs-flow/src/config/setting.js +++ b/zy-acs-flow/src/config/setting.js @@ -9,6 +9,8 @@ export const HANDLE_APP_KEY = 'xltys1995'; +export const VERIFY_PASSWORD = 'root'; + export const SPA_NAME = 'COOL'; export const SPA_VERSION = '1'; diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js index bf0a276..0c1ce05 100644 --- a/zy-acs-flow/src/i18n/en.js +++ b/zy-acs-flow/src/i18n/en.js @@ -656,7 +656,7 @@ startPatrol: 'START PATROL', stopPatrol: 'STOP PATROL', moreOperation: 'More Operation', - oneClickLocate: 'One Click Locate', + oneClickLocate: 'One-click Locate', }, mode: { observer: 'OBSERVER', diff --git a/zy-acs-flow/src/map/header/FakeFab.jsx b/zy-acs-flow/src/map/header/FakeFab.jsx index 3fabf66..eb3f593 100644 --- a/zy-acs-flow/src/map/header/FakeFab.jsx +++ b/zy-acs-flow/src/map/header/FakeFab.jsx @@ -5,6 +5,7 @@ } from '@mui/material'; import LensBlurIcon from '@mui/icons-material/LensBlur'; import { getFakeSign, setFakeSign } from "../http"; +import { VERIFY_PASSWORD } from '@/config/setting'; const FakeFab = (props) => { const translate = useTranslate(); @@ -21,7 +22,7 @@ let pass = true; if (!res) { const pwd = prompt("please enter password:"); - if (pwd === 'xltys1995') { + if (pwd === VERIFY_PASSWORD) { pass = true; } else { pass = false; diff --git a/zy-acs-flow/src/map/header/MoreOperate.jsx b/zy-acs-flow/src/map/header/MoreOperate.jsx index f3d7e4e..49c7d9c 100644 --- a/zy-acs-flow/src/map/header/MoreOperate.jsx +++ b/zy-acs-flow/src/map/header/MoreOperate.jsx @@ -1,24 +1,28 @@ import React, { useState, useRef, useEffect, useMemo } from "react"; import { useTranslate } from "react-admin"; import { + Box, Select, MenuItem, Button, useTheme, ListItemIcon, ListItemText, + CircularProgress, } from '@mui/material'; -import { handleRePositionAll } from "../http"; +import { handleLocateAllAgv } from "../http"; import GpsFixedIcon from '@mui/icons-material/GpsFixed'; +import { VERIFY_PASSWORD } from '@/config/setting'; const MoreOperate = ({ }) => { const translate = useTranslate(); const theme = useTheme(); + const [loading, setLoading] = useState(false); const verifyPassword = (fn) => { let pass = true; const pwd = prompt("please enter password:"); - if (pwd === 'xltys1995') { + if (pwd === VERIFY_PASSWORD) { pass = true; } else { pass = false; @@ -33,8 +37,13 @@ } } - const handleLocateAll = () => { - alert('瀹氫綅鎴愬姛'); + const handleLocateAll = async () => { + setLoading(true) + try { + await handleLocateAllAgv(); + } finally { + setLoading(false); + } } return ( @@ -44,11 +53,17 @@ onChange={(event) => { console.log(event.target.value); }} - renderValue={(selected) => - translate('page.map.action.moreOperation') - } + renderValue={() => ( + <Box sx={{ display: 'flex', alignItems: 'center' }}> + {loading && ( + <CircularProgress size={20} sx={{ mr: 1 }} /> + )} + {translate('page.map.action.moreOperation')} + </Box> + )} variant="outlined" size="small" + disabled={loading} sx={{ ml: 2, backgroundColor: theme.palette.background.paper, @@ -61,9 +76,13 @@ onClick={() => { verifyPassword(handleLocateAll); }} + disabled={loading} > <ListItemIcon> - <GpsFixedIcon fontSize="small" /> + {loading + ? <CircularProgress size={20} /> + : <GpsFixedIcon fontSize="small" /> + } </ListItemIcon> <ListItemText>{translate('page.map.action.oneClickLocate')}</ListItemText> </MenuItem> diff --git a/zy-acs-flow/src/map/http.js b/zy-acs-flow/src/map/http.js index fe7bd49..640a9a5 100644 --- a/zy-acs-flow/src/map/http.js +++ b/zy-acs-flow/src/map/http.js @@ -311,9 +311,9 @@ return false; } -export const handleRePositionAll = async (param) => { +export const handleLocateAllAgv = async (param) => { try { - const res = await request.post('/handler/rePositionAllAgv', param, { + const res = await request.post('/handler/locateAllAgv', param, { headers: { 'appKey': HANDLE_APP_KEY } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java index ed7b01e..9b744ed 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java @@ -8,6 +8,7 @@ import com.zy.acs.framework.common.Cools; import com.zy.acs.framework.common.R; import com.zy.acs.framework.common.SnowflakeIdWorker; +import com.zy.acs.manager.common.annotation.OperationLog; import com.zy.acs.manager.common.domain.param.HandlerPublishParam; import com.zy.acs.manager.common.exception.BusinessException; import com.zy.acs.manager.core.service.*; @@ -71,12 +72,13 @@ @Autowired private PatrolService patrolService; - @PreAuthorize("hasAuthority('manager:loc:update')") - @PostMapping("/rePositionAllAgv") - public synchronized R rePositionAllAgv() { + @PreAuthorize("hasAuthority('manager:agv:update')") + @OperationLog("Locate All Agv") + @PostMapping("/locateAllAgv") + public synchronized R locateAllAgv() throws InterruptedException { final Integer MAP_DEFAULT_LEV = 1; redis.deleteValue(RedisConstant.AGV_MAP_ASTAR_DYNAMIC_FLAG, String.valueOf(MAP_DEFAULT_LEV)); -// avoidWaveCalculator.calcDynamicNodeWhenBoot(); + avoidWaveCalculator.calcDynamicNodeWhenBoot(); return R.ok(); } -- Gitblit v1.9.1