From 769f753ca8581b717bcd27c63c637fe868dd37f1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 18 十月 2024 14:03:00 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/insight/agv/index.jsx | 72 ++++++++++++++++++++++++++++++++++--
1 files changed, 68 insertions(+), 4 deletions(-)
diff --git a/zy-acs-flow/src/map/insight/agv/index.jsx b/zy-acs-flow/src/map/insight/agv/index.jsx
index 5d678c0..bfe531e 100644
--- a/zy-acs-flow/src/map/insight/agv/index.jsx
+++ b/zy-acs-flow/src/map/insight/agv/index.jsx
@@ -1,11 +1,75 @@
-
+import React, { useState, useRef, useEffect } from 'react';
+import { useTranslate } from "react-admin";
+import { Box, Typography, Tabs, Tab, Stack, useTheme, Divider } from '@mui/material';
+import AgvMain from './AgvMain';
+import AgvControl from './AgvControl';
+import JsonShow from '../../JsonShow';
const AgvInsight = (props) => {
+ const { sprite, setTitle } = props;
+ const theme = useTheme();
+ const themeMode = theme.palette.mode;
+ const translate = useTranslate();
+
+ const [activeTab, setActiveTab] = useState(0);
+ const [curAgvNo, setCurAgvNo] = useState(null);
+ const [jsonData, setJsonData] = useState(null);
+
+ const handleTabChange = (event, newValue) => {
+ setActiveTab(newValue);
+ };
+
+ useEffect(() => {
+ if (sprite) {
+ const agvNo = sprite.data.no;
+ if (agvNo) {
+ setCurAgvNo(agvNo);
+ setTitle(translate('page.map.devices.agv') + ' - ' + agvNo);
+ }
+ }
+
+ return () => {
+ setTitle(null);
+ setJsonData(null);
+ }
+ }, [sprite])
return (
- <>
- <h1>Agv</h1>
- </>
+ <Box sx={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
+ <Tabs
+ value={activeTab}
+ onChange={handleTabChange}
+ centered
+ sx={{ mb: 0 }}
+ >
+ <Tab label={translate('page.map.insight.title')} />
+ <Tab label={translate('page.map.insight.tabs.control')} />
+ <Tab label={'JSON'} />
+ </Tabs>
+
+ <Divider />
+
+ <Box flex={1} pt={2}>
+ {activeTab === 0 && (
+ <AgvMain
+ curAgvNo={curAgvNo}
+ setCurAgvNo={setCurAgvNo}
+ setJsonData={setJsonData}
+ />
+ )}
+ {activeTab === 1 && (
+ <AgvControl
+ curAgvNo={curAgvNo}
+ />
+ )}
+ {activeTab === 2 && (
+ <JsonShow
+ data={jsonData || sprite?.data}
+ height={550}
+ />
+ )}
+ </Box>
+ </Box>
)
}
--
Gitblit v1.9.1