| | |
| | | }, |
| | | config: { |
| | | title: 'Config Parameters', |
| | | base: { |
| | | no: 'No', |
| | | }, |
| | | shelf: { |
| | | row: 'Row', |
| | | bay: 'Bay', |
| | | }, |
| | | }, |
| | | }, |
| | | insight: { |
| | |
| | | }, |
| | | config: { |
| | | title: '系统参数', |
| | | base: { |
| | | no: '编号', |
| | | }, |
| | | shelf: { |
| | | row: '排', |
| | | bay: '列', |
| | | }, |
| | | }, |
| | | }, |
| | | insight: { |
New file |
| | |
| | | import React, { useEffect } from 'react'; |
| | | import { useForm, Controller } from 'react-hook-form'; |
| | | import { |
| | | Box, |
| | | Grid, |
| | | Typography, |
| | | TextField, |
| | | Slider, |
| | | Button, |
| | | Select, |
| | | MenuItem, |
| | | InputLabel, |
| | | FormControl, |
| | | Stack, |
| | | Divider, |
| | | } from '@mui/material'; |
| | | import { useTranslate } from 'react-admin'; |
| | | import * as Tool from '../tool'; |
| | | import ConfirmButton from '../../page/components/ConfirmButton'; |
| | | import { |
| | | DEVICE_TYPE, |
| | | DEVICE_Z_INDEX, |
| | | } from '../constants'; |
| | | |
| | | const ConfigSettings = (props) => { |
| | | const { sprite, setSpriteSettings, onSubmit } = props; |
| | | const translate = useTranslate(); |
| | | |
| | | const { control, handleSubmit, reset, watch } = useForm({ |
| | | defaultValues: { |
| | | ...sprite.data |
| | | }, |
| | | }); |
| | | |
| | | const updateSprite = (data) => { |
| | | }; |
| | | |
| | | const onFormSubmit = (data) => { |
| | | console.log(data); |
| | | if (onSubmit) { |
| | | onSubmit(data); |
| | | } |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <Box component="form" onSubmit={handleSubmit(onFormSubmit)} noValidate sx={{ mt: 0 }}> |
| | | <Grid container spacing={1.4}> |
| | | |
| | | {sprite?.data?.type === DEVICE_TYPE.SHELF && ( |
| | | <> |
| | | <Grid item xs={6} pt={0} sx={{ |
| | | paddingTop: '8px !important', |
| | | }}> |
| | | <Controller |
| | | name="row" |
| | | control={control} |
| | | render={({ field }) => ( |
| | | <TextField |
| | | {...field} |
| | | label={translate('page.map.settings.config.shelf.row')} |
| | | type="number" |
| | | fullWidth |
| | | onChange={(e) => { |
| | | const value = e.target.value; |
| | | field.onChange(e); |
| | | updateSprite(); |
| | | }} |
| | | /> |
| | | )} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} pt={0} sx={{ |
| | | paddingTop: '8px !important', |
| | | }}> |
| | | <Controller |
| | | name="bay" |
| | | control={control} |
| | | render={({ field }) => ( |
| | | <TextField |
| | | {...field} |
| | | label={translate('page.map.settings.config.shelf.bay')} |
| | | type="number" |
| | | fullWidth |
| | | onChange={(e) => { |
| | | const value = e.target.value; |
| | | field.onChange(e); |
| | | }} |
| | | /> |
| | | )} |
| | | /> |
| | | </Grid> |
| | | </> |
| | | )} |
| | | |
| | | {sprite?.data?.type === DEVICE_TYPE.CHARGE && ( |
| | | <> |
| | | </> |
| | | )} |
| | | |
| | | {sprite?.data?.type === DEVICE_TYPE.STATION && ( |
| | | <> |
| | | </> |
| | | )} |
| | | |
| | | {sprite?.data?.type === DEVICE_TYPE.POINT && ( |
| | | <> |
| | | </> |
| | | )} |
| | | |
| | | <Grid item xs={12}> |
| | | <Divider /> |
| | | </Grid> |
| | | |
| | | {/* <Grid item xs={12}> |
| | | <Typography variant="inherit"> |
| | | {translate('page.map.settings.config.base.no')} |
| | | </Typography> |
| | | </Grid> */} |
| | | <Grid item xs={6} pt={0} sx={{ |
| | | paddingTop: '8px !important', |
| | | }}> |
| | | |
| | | <Controller |
| | | name="no" |
| | | control={control} |
| | | render={({ field }) => ( |
| | | <TextField |
| | | {...field} |
| | | label="No" |
| | | type="text" |
| | | fullWidth |
| | | onChange={(e) => { |
| | | const value = e.target.value; |
| | | field.onChange(e); |
| | | }} |
| | | /> |
| | | )} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={12} mt={2}> |
| | | <Stack direction="row" spacing={2}> |
| | | <Button variant="contained" color="primary" onClick={() => { |
| | | }}> |
| | | {translate('ra.action.confirm')} |
| | | </Button> |
| | | </Stack> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | </Box> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | |
| | | export default ConfigSettings; |
| | |
| | | import CloseIcon from '@mui/icons-material/Close'; |
| | | import { PAGE_DRAWER_WIDTH } from '@/config/setting'; |
| | | import MapSettings from './MapSettings'; |
| | | import ConfigSettings from './ConfigSettings'; |
| | | |
| | | const Settings = (props) => { |
| | | const { open, onCancel, sprite, width = PAGE_DRAWER_WIDTH, title, setSpriteSettings } = props; |
| | |
| | | <Stack direction="row" p={2}> |
| | | <Typography variant="h6" flex="1"> |
| | | {sprite |
| | | ? 'No.' + sprite?.data?.uuid + ' - ' + translate(`page.map.devices.${sprite?.data?.type?.toLowerCase()}`) |
| | | ? translate(`page.map.devices.${sprite?.data?.type?.toLowerCase()}`) + ' - ' + sprite?.data?.uuid |
| | | : translate('page.map.settings.title')} |
| | | </Typography> |
| | | <IconButton onClick={handleClose} size="small"> |
| | |
| | | <ConfigSettings |
| | | sprite={sprite} |
| | | onSubmit={() => { |
| | | alert('ConfigSettings') |
| | | }} |
| | | /> |
| | | )} |
| | |
| | | )} |
| | | </Drawer> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | const ConfigSettings = () => { |
| | | |
| | | return ( |
| | | <h1>ConfigSettings</h1> |
| | | ) |
| | | } |
| | | |