#
Junjie
2024-10-17 d835d1b51f832889929cdf69010034a30ef44d02
zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx
@@ -3,24 +3,37 @@
import { FormattedMessage, useIntl, useModel } from '@umijs/max';
import { createStyles } from 'antd-style';
import * as Utils from '../../utils'
import Http from '@/utils/http';
import ShowJson from './showJson';
const useStyles = createStyles(({ token, css }) => {
})
import ShowJson from '../showJson';
import ShelfView from './view'
const ShelfDrawer = (props) => {
    const intl = useIntl();
    const { styles } = useStyles();
    const [activeTabKey, setActiveTabKey] = useState('json');
    const { curSprite } = props;
    const { curSprite, curFloor } = props;
    const [activeTabKey, setActiveTabKey] = useState('view');
    const [curLocNo, setCurLocNo] = React.useState(''); // just used to modify the drawer title
    props.setDrawerWidth(window.innerWidth * 0.35);
    useEffect(() => {
        if (!curSprite) {
            return
        }
        props.setDrawerTitle(intl.formatMessage({ id: 'map.loc.no', defaultMessage: '库位号' }) + ': ' + curLocNo);
    }, [curLocNo]);
    const contentList = {
        view: (
            <ShelfView
                curLocNo={curLocNo}
                setCurLocNo={setCurLocNo}
                data={curSprite.data}
                curFloor={curFloor}
            />
        ),
        json: (
            <ShowJson
                curSprite={props.curSprite}
                data={curSprite.data}
            />
        ),
    };
@@ -28,10 +41,15 @@
    return (
        <>
            <Card
                className='drawer-card'
                hoverable
                bordered={false}
                type='inner'
                tabList={[
                    {
                        key: 'view',
                        tab: intl.formatMessage({ id: 'map.drawer.shelf.view.title', defaultMessage: '库位信息' }),
                    },
                    {
                        key: 'json',
                        tab: intl.formatMessage({ id: 'map.drawer.json', defaultMessage: 'JSON' }),
@@ -48,6 +66,9 @@
                    style: {
                    }
                }}
                style={{
                    height: '100%'
                }}
            >
                {contentList[activeTabKey]}
            </Card>