import React, { useState, useRef, useEffect } from 'react'; 
 | 
import { Drawer, Space, Button } from 'antd'; 
 | 
import { FormattedMessage, useIntl, useModel } from '@umijs/max'; 
 | 
import { createStyles } from 'antd-style'; 
 | 
import * as Utils from '../utils' 
 | 
import ShelfDrawer from './shelf'; 
 | 
import ConveyorDrawer from './conveyor'; 
 | 
import AgvDrawer from './agv'; 
 | 
import PointDrawer from './point' 
 | 
import ShuttleDrawer from './shuttle' 
 | 
import LiftDrawer from './lift' 
 | 
  
 | 
const useStyles = createStyles(({ token, css }) => { 
 | 
  
 | 
}) 
 | 
  
 | 
const MapDrawer = (props) => { 
 | 
    const intl = useIntl(); 
 | 
    const { styles } = useStyles(); 
 | 
    const { curSprite, curFloor } = props; 
 | 
  
 | 
    const [drawerTitle, setDrawerTitle] = useState(''); 
 | 
  
 | 
    useEffect(() => { 
 | 
    }, [props.curSprite]); 
 | 
  
 | 
    const handleCancel = () => { 
 | 
        props.onCancel(); 
 | 
    }; 
 | 
  
 | 
    return ( 
 | 
        <> 
 | 
            <Drawer 
 | 
                title={drawerTitle} 
 | 
                open={props.open} 
 | 
                onClose={handleCancel} 
 | 
                getContainer={props.refCurr} 
 | 
                rootStyle={{ position: "absolute" }} 
 | 
                mask={false} 
 | 
                width={window.innerWidth * 0.35} 
 | 
                style={{ 
 | 
                    opacity: 1 
 | 
                }} 
 | 
                extra={ 
 | 
                    <Space> 
 | 
                        <Button onClick={handleCancel}> 
 | 
                            <FormattedMessage id='common.cancel' defaultMessage='取消' /> 
 | 
                        </Button> 
 | 
                    </Space> 
 | 
                } 
 | 
            > 
 | 
                {(props.curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && props.curSprite?.data?.shelfType !== Utils.SHELF_TYPE.LIFT) && ( 
 | 
                    <> 
 | 
                        <ShelfDrawer 
 | 
                            curSprite={curSprite} 
 | 
                            curFloor={curFloor} 
 | 
                            setDrawerTitle={setDrawerTitle} 
 | 
                        /> 
 | 
                    </> 
 | 
                )} 
 | 
                {(props.curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && props.curSprite?.data?.shelfType === Utils.SHELF_TYPE.LIFT) && ( 
 | 
                    <> 
 | 
                        <LiftDrawer 
 | 
                            curSprite={curSprite} 
 | 
                            curFloor={curFloor} 
 | 
                            setDrawerTitle={setDrawerTitle} 
 | 
                        /> 
 | 
                    </> 
 | 
                )} 
 | 
                {props.curSprite?.data?.type === Utils.SENSOR_TYPE.CONVEYOR && ( 
 | 
                    <> 
 | 
                        <ConveyorDrawer 
 | 
                            curSprite={curSprite} 
 | 
                            curFloor={curFloor} 
 | 
                            setDrawerTitle={setDrawerTitle} 
 | 
                        /> 
 | 
                    </> 
 | 
                )} 
 | 
                {props.curSprite?.data?.type === Utils.SENSOR_TYPE.SHUTTLE && ( 
 | 
                    <> 
 | 
                        <ShuttleDrawer 
 | 
                            curSprite={curSprite} 
 | 
                            curFloor={curFloor} 
 | 
                            setDrawerTitle={setDrawerTitle} 
 | 
                        /> 
 | 
                    </> 
 | 
                )} 
 | 
                {props.curSprite?.data?.type === Utils.SENSOR_TYPE.POINT && ( 
 | 
                    <> 
 | 
                        <PointDrawer 
 | 
                            curSprite={curSprite} 
 | 
                        /> 
 | 
                    </> 
 | 
                )} 
 | 
                {props.curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && ( 
 | 
                    <> 
 | 
                        <AgvDrawer 
 | 
                            curSprite={curSprite} 
 | 
                        /> 
 | 
                    </> 
 | 
                )} 
 | 
            </Drawer> 
 | 
        </> 
 | 
    ) 
 | 
} 
 | 
  
 | 
export default MapDrawer; 
 |