| | |
| | | import { FormattedMessage, useIntl, useModel } from '@umijs/max'; |
| | | import { createStyles } from 'antd-style'; |
| | | import * as Utils from '../utils' |
| | | import Http from '@/utils/http'; |
| | | 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(''); |
| | | const [drawerWidth, setDrawerWidth] = useState(() => { |
| | | return window.innerWidth * 0.35; |
| | | }) |
| | | |
| | | useEffect(() => { |
| | | }, [props.curSprite]); |
| | | |
| | | const handleCancel = () => { |
| | | props.onCancel(); |
| | | }; |
| | | |
| | | const handleOk = () => { |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Drawer |
| | | title={drawerTitle} |
| | | open={props.open} |
| | | onClose={handleCancel} |
| | | getContainer={props.refCurr} |
| | | rootStyle={{ position: "absolute" }} |
| | | mask={false} |
| | | width={600} |
| | | width={drawerWidth} |
| | | style={{ |
| | | opacity: 1 |
| | | }} |
| | | extra={ |
| | | <Space> |
| | | <Button onClick={handleCancel}> |
| | | <FormattedMessage id='common.cancel' defaultMessage='取消' /> |
| | | </Button> |
| | | <Button onClick={handleOk} type="primary"> |
| | | <FormattedMessage id='common.submit' defaultMessage='保存' /> |
| | | </Button> |
| | | </Space> |
| | | } |
| | | > |
| | | {props.curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && ( |
| | | {(props.curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && props.curSprite?.data?.shelfType !== Utils.SHELF_TYPE.LIFT) && ( |
| | | <> |
| | | <ShelfDrawer |
| | | |
| | | curSprite={curSprite} |
| | | curFloor={curFloor} |
| | | setDrawerTitle={setDrawerTitle} |
| | | setDrawerWidth={setDrawerWidth} |
| | | /> |
| | | </> |
| | | )} |
| | | {(props.curSprite?.data?.type === Utils.SENSOR_TYPE.SHELF && props.curSprite?.data?.shelfType === Utils.SHELF_TYPE.LIFT) && ( |
| | | <> |
| | | <LiftDrawer |
| | | curSprite={curSprite} |
| | | curFloor={curFloor} |
| | | setDrawerTitle={setDrawerTitle} |
| | | setDrawerWidth={setDrawerWidth} |
| | | /> |
| | | </> |
| | | )} |
| | | {props.curSprite?.data?.type === Utils.SENSOR_TYPE.CONVEYOR && ( |
| | | <> |
| | | <ConveyorDrawer |
| | | curSprite={curSprite} |
| | | curFloor={curFloor} |
| | | setDrawerTitle={setDrawerTitle} |
| | | setDrawerWidth={setDrawerWidth} |
| | | /> |
| | | </> |
| | | )} |
| | | {props.curSprite?.data?.type === Utils.SENSOR_TYPE.SHUTTLE && ( |
| | | <> |
| | | <ShuttleDrawer |
| | | curSprite={curSprite} |
| | | curFloor={curFloor} |
| | | setDrawerTitle={setDrawerTitle} |
| | | setDrawerWidth={setDrawerWidth} |
| | | refCurr={props.refCurr} |
| | | /> |
| | | </> |
| | | )} |
| | | {props.curSprite?.data?.type === Utils.SENSOR_TYPE.POINT && ( |
| | | <> |
| | | <PointDrawer |
| | | curSprite={curSprite} |
| | | /> |
| | | </> |
| | | )} |
| | | {props.curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && ( |
| | | <> |
| | | <AgvDrawers |
| | | |
| | | <AgvDrawer |
| | | curSprite={curSprite} |
| | | /> |
| | | </> |
| | | )} |