From 9b254255cf7aaded5e236615ea5be48deb64b8ce Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 16 十月 2024 15:35:26 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/insight/shelf/ShelfMain.jsx | 66 ++++++-------------------------- 1 files changed, 13 insertions(+), 53 deletions(-) diff --git a/zy-acs-flow/src/map/insight/shelf/ShelfMain.jsx b/zy-acs-flow/src/map/insight/shelf/ShelfMain.jsx index db4f07b..3e50bb9 100644 --- a/zy-acs-flow/src/map/insight/shelf/ShelfMain.jsx +++ b/zy-acs-flow/src/map/insight/shelf/ShelfMain.jsx @@ -12,7 +12,6 @@ Stack, } from '@mui/material'; import ShelfThree from './ShelfThree'; -import request from '@/utils/request'; import { getLocGroup } from '../../http'; let shelfThree; @@ -41,30 +40,23 @@ mesh.position.set(0, singleHeight * (lev - 1), 0); mesh.scale.set(5, 5, 5); mesh.name = item.locNo; - mesh.traverse(function (child) { + mesh.traverse((child) => { if (child.isMesh) { - if (child.name === '璐ф灦') { - child.material.color.set(0x4680BF); - } - let palletVisible = true, cargoVisible = true; - switch (item.locStsEl) { - case 'STOCK': - cargoVisible = false; + switch (child.name) { + case '璐ф灦': + child.material.color.set(0x4680BF); break; - case 'IDLE': - palletVisible = false; - cargoVisible = false; + case '鎵樼洏': + child.visible = item.locStsEl === 'STOCK' || item.locStsEl === 'PAKOUT'; + child.material.color.set(0xBEBEBE); + break; + case '涓嶈鍒�': + child.visible = item.locStsEl === 'STOCK' || item.locStsEl === 'PAKOUT'; + // child.visible = !['STOCK', 'IDLE'].includes(item.locStsEl); + child.material.color.set(0xE8B67E); break; default: break; - } - if (child.name === '鎵樼洏') { - child.visible = palletVisible; - child.material.color.set(0xBEBEBE); - } - if (child.name === '涓嶈鍒�') { - child.visible = cargoVisible; - child.material.color.set(0xE8B67E); } child.name = item.locNo child.castShadow = true; @@ -84,7 +76,6 @@ }).catch(error => { console.error(error); }); - }) } } @@ -94,10 +85,7 @@ const translate = useTranslate(); const containerRef = useRef(); const [loading, setLoading] = useState(true); - const [shelfThree, setShelfThree] = useState(null); const [info, setInfo] = useState(null); - - useEffect(() => { if (data) { @@ -112,7 +100,6 @@ if (info) { endThree(); setLoading(true); - setTimeout(() => { startThree(containerRef.current); shelfThree.handleClick = (objName) => { @@ -120,37 +107,10 @@ }; renderThree(info, curLocNo); setLoading(false); - }, 300) - + }, 200) } - return endThree; }, [info]); - - - - useEffect(() => { - const initThree = () => { - const shelfThreeInstance = new ShelfThree(containerRef.current); - shelfThreeInstance.startup(); - shelfThreeInstance.handleClick = (objName) => { - setCurLocNo(objName); - }; - setShelfThree(shelfThreeInstance); - setLoading(false); - // Fetch initial data - }; - - initThree(); - - return () => { - if (shelfThree) { - shelfThree.destroy(); - } - }; - }, []); - - return ( <Box display="flex" height="500px"> -- Gitblit v1.9.1