#
luxiaotao1123
2024-10-18 7ce0e49aecaf717480c0d679353a865773ff2cb2
#
2个文件已修改
49 ■■■■■ 已修改文件
zy-acs-flow/src/map/insight/agv/AgvMain.jsx 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/insight/agv/index.jsx 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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) => {
@@ -77,32 +77,19 @@
}
const AgvMain = (props) => {
    const { curAgvNo, setCurAgvNo, setJsonData } = 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 (curAgvNo) {
            getAgvInfo(curAgvNo, (response) => {
                setInfo(response);
            });
        }
    }, [curAgvNo]);
    useEffect(() => {
        if (info) {
            setJsonData(info);
            endThree();
            setLoading(true);
            setTimeout(() => {
                startThree(containerRef.current);
                three.handleClick = (objName) => {
                    setCurAgvNo(objName);
                };
                renderThree(info, curAgvNo);
                renderThree(curAgvNo);
                setLoading(false);
            }, 200);
        }
@@ -208,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>
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}
                    />
                )}