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/AgvMain.jsx |   26 ++++++--------------------
 1 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/zy-acs-flow/src/map/insight/agv/AgvMain.jsx b/zy-acs-flow/src/map/insight/agv/AgvMain.jsx
index f507cd5..cba0967 100644
--- a/zy-acs-flow/src/map/insight/agv/AgvMain.jsx
+++ b/zy-acs-flow/src/map/insight/agv/AgvMain.jsx
@@ -31,8 +31,8 @@
     }
 }
 
-const renderThree = (info, curAgvNo) => {
-    if (info && three) {
+const renderThree = (curAgvNo) => {
+    if (curAgvNo && three) {
         three.generateMesh((loader, addObject) => {
             const loadModel = (path) => {
                 return new Promise((resolve, reject) => {
@@ -67,7 +67,7 @@
 
                 addObject(agvGroup);
 
-                three.rePerspective(350, 450);
+                three?.rePerspective(350, 450);
 
             }).catch((error) => {
                 console.error(error);
@@ -77,33 +77,19 @@
 }
 
 const AgvMain = (props) => {
-    const { data, curAgvNo, setCurAgvNo } = props;
+    const { curAgvNo, curAgvInfo: info } = props;
     const theme = useTheme();
     const translate = useTranslate();
     const containerRef = useRef();
     const [loading, setLoading] = useState(true);
-    const [info, setInfo] = useState(null);
-
-    useEffect(() => {
-        if (data) {
-            getAgvInfo(data.no, (response) => {
-                setInfo(response);
-                setCurAgvNo(data.no);
-            });
-        }
-    }, [data]);
 
     useEffect(() => {
         if (info) {
-            // console.log(info);
             endThree();
             setLoading(true);
             setTimeout(() => {
                 startThree(containerRef.current);
-                three.handleClick = (objName) => {
-                    setCurAgvNo(objName);
-                };
-                renderThree(info, curAgvNo);
+                renderThree(curAgvNo);
                 setLoading(false);
             }, 200);
         }
@@ -209,7 +195,7 @@
             <Stack direction="row" alignItems="center" spacing={1} sx={{ mb: 1 }}>
                 <Typography
                     variant="body2"
-                    sx={{ width: '80px', fontWeight: 'bold', color: 'text.secondary', textAlign: 'left' }}
+                    sx={{ minWidth: '80px', fontWeight: 'bold', color: 'text.secondary', textAlign: 'left' }}
                 >
                     {label}:
                 </Typography>

--
Gitblit v1.9.1