From 7ce0e49aecaf717480c0d679353a865773ff2cb2 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 18 十月 2024 14:12:56 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/insight/agv/index.jsx | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/zy-acs-flow/src/map/insight/agv/index.jsx b/zy-acs-flow/src/map/insight/agv/index.jsx
index bfe531e..c3e8cc2 100644
--- a/zy-acs-flow/src/map/insight/agv/index.jsx
+++ b/zy-acs-flow/src/map/insight/agv/index.jsx
@@ -4,35 +4,38 @@
import AgvMain from './AgvMain';
import AgvControl from './AgvControl';
import JsonShow from '../../JsonShow';
+import { getAgvInfo } from '../../http';
const AgvInsight = (props) => {
const { sprite, setTitle } = props;
- const theme = useTheme();
- const themeMode = theme.palette.mode;
const translate = useTranslate();
+ const theme = useTheme();
const [activeTab, setActiveTab] = useState(0);
const [curAgvNo, setCurAgvNo] = useState(null);
- const [jsonData, setJsonData] = useState(null);
-
- const handleTabChange = (event, newValue) => {
- setActiveTab(newValue);
- };
+ const [curAgvInfo, setCurAgvInfo] = useState(null);
useEffect(() => {
if (sprite) {
const agvNo = sprite.data.no;
if (agvNo) {
- setCurAgvNo(agvNo);
setTitle(translate('page.map.devices.agv') + ' - ' + agvNo);
+ setCurAgvNo(agvNo);
+ getAgvInfo(agvNo, (response) => {
+ setCurAgvInfo(response);
+ });
}
}
return () => {
setTitle(null);
- setJsonData(null);
+ setCurAgvInfo(null);
}
}, [sprite])
+
+ const handleTabChange = (event, newValue) => {
+ setActiveTab(newValue);
+ };
return (
<Box sx={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
@@ -53,8 +56,7 @@
{activeTab === 0 && (
<AgvMain
curAgvNo={curAgvNo}
- setCurAgvNo={setCurAgvNo}
- setJsonData={setJsonData}
+ curAgvInfo={curAgvInfo}
/>
)}
{activeTab === 1 && (
@@ -64,7 +66,7 @@
)}
{activeTab === 2 && (
<JsonShow
- data={jsonData || sprite?.data}
+ data={curAgvInfo || sprite?.data}
height={550}
/>
)}
--
Gitblit v1.9.1