From 5333624bc0a4162b26cf1915c007ab92abbe7dd3 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 09 十月 2024 12:40:26 +0800
Subject: [PATCH] #
---
zy-acs-flow/public/map/direction.svg | 0
zy-acs-flow/public/map/code.svg | 0
zy-acs-flow/public/map/charge.svg | 0
zy-acs-flow/public/map/shelf.svg | 0
zy-acs-flow/src/map/MapPage.jsx | 1
zy-acs-flow/src/map/Device.jsx | 65 +++++++++++++++++++++++++++++++-
6 files changed, 63 insertions(+), 3 deletions(-)
diff --git "a/zy-acs-flow/public/map/\345\205\205\347\224\265\346\241\251.svg" b/zy-acs-flow/public/map/charge.svg
similarity index 100%
rename from "zy-acs-flow/public/map/\345\205\205\347\224\265\346\241\251.svg"
rename to zy-acs-flow/public/map/charge.svg
diff --git "a/zy-acs-flow/public/map/\345\234\260\345\233\276\347\202\271.svg" b/zy-acs-flow/public/map/code.svg
similarity index 100%
rename from "zy-acs-flow/public/map/\345\234\260\345\233\276\347\202\271.svg"
rename to zy-acs-flow/public/map/code.svg
diff --git "a/zy-acs-flow/public/map/\346\226\271\345\220\221\346\214\207\347\244\272.svg" b/zy-acs-flow/public/map/direction.svg
similarity index 100%
rename from "zy-acs-flow/public/map/\346\226\271\345\220\221\346\214\207\347\244\272.svg"
rename to zy-acs-flow/public/map/direction.svg
diff --git "a/zy-acs-flow/public/map/\350\264\247\346\236\266.svg" b/zy-acs-flow/public/map/shelf.svg
similarity index 100%
rename from "zy-acs-flow/public/map/\350\264\247\346\236\266.svg"
rename to zy-acs-flow/public/map/shelf.svg
diff --git a/zy-acs-flow/src/map/Device.jsx b/zy-acs-flow/src/map/Device.jsx
index 56a2ebb..0bb2b95 100644
--- a/zy-acs-flow/src/map/Device.jsx
+++ b/zy-acs-flow/src/map/Device.jsx
@@ -1,8 +1,21 @@
import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
-import { Drawer, Box, Typography, Card, IconButton, Stack } from '@mui/material';
+import { Drawer, Box, Typography, Grid, IconButton, Stack } from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';
import * as Common from '@/utils/common';
import { PAGE_DRAWER_WIDTH } from '@/config/setting';
+
+import shelf from '/map/shelf.svg';
+import charge from '/map/charge.svg';
+import direction from '/map/direction.svg';
+
+const items = [
+ { src: shelf, label: 'map.device.type.shelf', type: 'SHELF' },
+ { src: charge, label: 'map.device.type.charge', type: 'CHARGE' },
+ { src: direction, label: 'map.device.type.direction', type: 'DIRECTION' },
+ // { src: point, label: 'map.device.type.point', type: 'POINT' },
+ // { src: agv, label: 'map.device.type.agv', type: 'AGV' },
+ // { src: conveyor, label: 'map.device.type.conveyor', type: 'CONVEYOR' },
+];
const Device = (props) => {
const {
@@ -27,7 +40,7 @@
open={open}
anchor="right"
onClose={handleClose}
- sx={{ zIndex: 100 }}
+ sx={{ zIndex: 100, opacity: .8 }}
>
{open && (
<Box pt={12} width={{ xs: '100vW', sm: width }} height={'calc(100vh - 200px);'} mt={{ xs: 2, sm: 1 }} sx={{
@@ -40,11 +53,57 @@
<CloseIcon />
</IconButton>
</Stack>
- {children}
+ <DeviceContent />
</Box>
)}
</Drawer>
)
}
+const DeviceContent = (props) => {
+
+ const onDragStart = (e, type) => {
+ // setDragging(true);
+ // setDragSpriteType(type);
+ // 鏍规嵁闇�瑕佸鐞嗘嫋鎷介�昏緫
+ };
+
+ return (
+ <Grid container spacing={2}>
+ {items.map((item, index) => {
+ return (
+ <Grid
+ key={index}
+ item
+ xs={4}
+ onDragStart={(e) => onDragStart(e, item.type)}
+ draggable="true"
+ >
+ <Box
+ sx={{
+ display: 'flex',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ alignItems: 'center',
+ p: 2,
+ cursor: 'pointer',
+ border: '1px solid',
+ borderColor: 'divider',
+ '&:hover': {
+ boxShadow: 3,
+ },
+ }}
+ >
+ <img src={item.src} alt={item.label} width="50px" />
+ {/* <Typography variant="body2" sx={{ mt: 1 }}>
+ <FormattedMessage id={item.label} defaultMessage={item.type} />
+ </Typography> */}
+ </Box>
+ </Grid>
+ )
+ })}
+ </Grid>
+ )
+}
+
export default Device;
\ No newline at end of file
diff --git a/zy-acs-flow/src/map/MapPage.jsx b/zy-acs-flow/src/map/MapPage.jsx
index c4267e8..73f9769 100644
--- a/zy-acs-flow/src/map/MapPage.jsx
+++ b/zy-acs-flow/src/map/MapPage.jsx
@@ -242,6 +242,7 @@
setDeviceVisible(false);
}}
onDrop={onDrop}
+ width={378}
/>
</Box>
--
Gitblit v1.9.1