#
luxiaotao1123
2024-10-18 9c5567aaa3bd765e350a9a9773ca510f76410210
#
2个文件已修改
56 ■■■■ 已修改文件
zy-acs-flow/src/map/insight/shelf/ShelfMain.jsx 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/insight/shelf/index.jsx 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/insight/shelf/ShelfMain.jsx
@@ -80,26 +80,17 @@
}
const ShelfMain = (props) => {
    const { data, curLocNo, setCurLocNo } = props;
    const { curLocNo, curShelfInfo: info, setCurLocNo } = props;
    const translate = useTranslate();
    const dataProvider = useDataProvider();
    const containerRef = useRef();
    const [loading, setLoading] = useState(true);
    const [info, setInfo] = useState(null);
    const [selectedLoc, setSelectedLoc] = useState(null);
    useEffect(() => {
        if (data) {
            getLocGroup(data.row, data.bay, (response) => {
                setInfo(response);
                setCurLocNo(response[0]?.locNo);
                setSelectedLoc(response[0]);
            });
        }
    }, [data]);
    const [selectedLoc, setSelectedLoc] = useState(null);   // loc obj
    const [loading, setLoading] = useState(true);
    useEffect(() => {
        if (info) {
            setSelectedLoc(info[0]);
            endThree();
            setLoading(true);
            setTimeout(() => {
zy-acs-flow/src/map/insight/shelf/index.jsx
@@ -3,15 +3,48 @@
import { Box, Typography, Tabs, Tab, Stack, useTheme, Divider } from '@mui/material';
import ShelfMain from './ShelfMain';
import JsonShow from '../../JsonShow';
import { getLocGroup } from '../../http';
const ShelfInsight = (props) => {
    const { sprite, setTitle } = props;
    const theme = useTheme();
    const themeMode = theme.palette.mode;
    const translate = useTranslate();
    const [activeTab, setActiveTab] = useState(0);
    const [curShelfInfo, setCurShelfInfo] = useState(null);
    const [curLocNo, setCurLocNo] = useState(null);
    const fetchShelfInfo = (row, bay) => {
        getLocGroup(row, bay, (response) => {
            setCurShelfInfo(response);
            const defaultLocNo = response[0]?.locNo;
            setCurLocNo(defaultLocNo);
        });
    }
    useEffect(() => {
        if (sprite) {
            const { row, bay } = sprite.data;
            if (row && bay) {
                fetchShelfInfo(row, bay);
            }
        }
        return () => {
            setCurLocNo(null);
            setCurShelfInfo(null);
        }
    }, [sprite]);
    useEffect(() => {
        if (curLocNo) {
            setTitle(translate('page.map.devices.shelf') + ' - ' + curLocNo);
        }
        return () => {
            setTitle(null);
        }
    }, [curLocNo])
    const handleTabChange = (event, newValue) => {
        setActiveTab(newValue);
@@ -34,14 +67,14 @@
            <Box flex={1} pt={2}>
                {activeTab === 0 && (
                    <ShelfMain
                        data={sprite?.data}
                        curLocNo={curLocNo}
                        curShelfInfo={curShelfInfo}
                        setCurLocNo={setCurLocNo}
                    />
                )}
                {activeTab === 1 && (
                    <JsonShow
                        data={sprite?.data}
                        data={curShelfInfo || sprite?.data}
                        height={550}
                    />
                )}