New file |
| | |
| | | import React from 'react'; |
| | | import { |
| | | AppBar, |
| | | Toolbar, |
| | | TextField, |
| | | Select, |
| | | MenuItem, |
| | | Button, |
| | | Box, |
| | | SpeedDial, |
| | | SpeedDialAction, |
| | | } from '@mui/material'; |
| | | import { |
| | | MoreVert as MoreVertIcon, |
| | | Edit as EditIcon, |
| | | FileCopy as FileCopyIcon, |
| | | Save as SaveIcon, |
| | | Print as PrintIcon, |
| | | Share as ShareIcon, |
| | | } from '@mui/icons-material'; |
| | | |
| | | function MapPage() { |
| | | const [mode, setMode] = React.useState('monitoring'); |
| | | |
| | | const handleModeChange = (event) => { |
| | | setMode(event.target.value); |
| | | }; |
| | | |
| | | const actions = [ |
| | | { icon: <FileCopyIcon />, name: '复制' }, |
| | | { icon: <SaveIcon />, name: '保存' }, |
| | | { icon: <PrintIcon />, name: '打印' }, |
| | | { icon: <ShareIcon />, name: '分享' }, |
| | | { icon: <EditIcon />, name: '编辑' }, |
| | | ]; |
| | | |
| | | return ( |
| | | <div> |
| | | {/* 菜单栏 */} |
| | | <AppBar position="static"> |
| | | <Toolbar> |
| | | {/* 左侧搜索框 */} |
| | | <TextField |
| | | variant="outlined" |
| | | size="small" |
| | | placeholder="搜索..." |
| | | style={{ marginRight: 'auto' }} |
| | | /> |
| | | {/* 模式选择下拉框 */} |
| | | <Select |
| | | value={mode} |
| | | onChange={handleModeChange} |
| | | variant="outlined" |
| | | size="small" |
| | | style={{ marginRight: 16 }} |
| | | > |
| | | <MenuItem value="monitoring">监控模式</MenuItem> |
| | | <MenuItem value="edit">编辑模式</MenuItem> |
| | | <MenuItem value="configuration">配置模式</MenuItem> |
| | | </Select> |
| | | {/* 功能按钮 */} |
| | | <Button variant="contained" color="primary" style={{ marginRight: 8 }}> |
| | | 停止RCS运转 |
| | | </Button> |
| | | <Button variant="contained" color="secondary"> |
| | | 模拟AGV运行 |
| | | </Button> |
| | | </Toolbar> |
| | | </AppBar> |
| | | {/* 地图区域 */} |
| | | <Box |
| | | sx={{ |
| | | height: 'calc(100vh - 64px)', // 减去AppBar的高度 |
| | | position: 'relative', |
| | | }} |
| | | > |
| | | {/* 地图占位符 */} |
| | | <Box |
| | | sx={{ |
| | | width: '100%', |
| | | height: '100%', |
| | | backgroundColor: '#f0f0f0', |
| | | }} |
| | | /> |
| | | {/* Speed Dial组件 */} |
| | | <SpeedDial |
| | | ariaLabel="SpeedDial 示例" |
| | | sx={{ position: 'absolute', bottom: 16, right: 16 }} |
| | | icon={<MoreVertIcon />} |
| | | > |
| | | {actions.map((action) => ( |
| | | <SpeedDialAction |
| | | key={action.name} |
| | | icon={action.icon} |
| | | tooltipTitle={action.name} |
| | | /> |
| | | ))} |
| | | </SpeedDial> |
| | | </Box> |
| | | </div> |
| | | ); |
| | | } |
| | | |
| | | export default MapPage; |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import MapPage from "../../map/MapPage"; |
| | | import Player from "../../map/player"; |
| | | |
| | | let player; |
| | | |
| | | |
| | | const Dashboard = () => { |
| | | const mapRef = React.useRef(); |
| | | |
| | | |
| | | useEffect(() => { |
| | | player = new Player(mapRef.current) |
| | | // let player = new Player(mapRef.current) |
| | | }, []) |
| | | |
| | | return ( |
| | | <> |
| | | <h1>Hello World</h1> |
| | | <div ref={mapRef} ></div> |
| | | <MapPage /> |
| | | {/* <div ref={mapRef} ></div> */} |
| | | </> |
| | | ) |
| | | } |