| | |
| | | locType: 'Location Type', |
| | | loc: 'Location', |
| | | agvSts: 'Agv Status', |
| | | |
| | | agvModel: 'Agv Model', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | uuid: "uuid", |
| | | name: "name", |
| | | }, |
| | | agvModel: { |
| | | uuid: "uuid", |
| | | type: "type", |
| | | name: "name", |
| | | length: "length", |
| | | width: "width", |
| | | height: "height", |
| | | liftHeight: "lift height", |
| | | diameter: "diameter", |
| | | password: "password", |
| | | backpack: "backpack", |
| | | lowBattery: "charge battery", |
| | | quaBattery: "work battery", |
| | | travelSpeed: "travel speed", |
| | | workDirection: "work direction", |
| | | allDirection: "all direction", |
| | | protocol: "protocol", |
| | | mqttTopic: "mqtt topic", |
| | | }, |
| | | |
| | | } |
| | | } |
| | | }; |
| | |
| | | locType: '库位类型', |
| | | loc: '库位管理', |
| | | agvSts: '车辆状态', |
| | | |
| | | agvModel: '车型管理', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | uuid: "编号", |
| | | name: "名称", |
| | | }, |
| | | agvModel: { |
| | | uuid: "编号", |
| | | type: "类型", |
| | | name: "名称", |
| | | length: "长度", |
| | | width: "宽度", |
| | | height: "高度", |
| | | liftHeight: "举升高度", |
| | | diameter: "旋转直径", |
| | | password: "设备密码", |
| | | backpack: "背篓数量", |
| | | lowBattery: "充电电量", |
| | | quaBattery: "额定电量", |
| | | travelSpeed: "走行速度", |
| | | workDirection: "作业方向", |
| | | allDirection: "全向", |
| | | protocol: "协议", |
| | | mqttTopic: "mqtt", |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | |
| | | import locType from './locType'; |
| | | import loc from './loc'; |
| | | import agvSts from './agvSts'; |
| | | import agvModel from './agvModel'; |
| | | |
| | | |
| | | |
| | | const ResourceContent = (node) => { |
| | |
| | | return loc; |
| | | case 'agvSts': |
| | | return agvSts; |
| | | case 'agvModel': |
| | | return agvModel; |
| | | default: |
| | | return { |
| | | list: ListGuesser, |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SaveButton, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | Toolbar, |
| | | required, |
| | | useDataProvider, |
| | | useNotify, |
| | | Form, |
| | | useCreateController, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../components/DialogCloseButton"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | |
| | | const AgvModelCreate = (props) => { |
| | | const { open, setOpen } = props; |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | |
| | | const handleSuccess = async (data) => { |
| | | setOpen(false); |
| | | notify('common.response.success'); |
| | | }; |
| | | |
| | | const handleError = async (data) => { |
| | | notify('common.response.fail'); |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <CreateBase |
| | | record={{}} |
| | | transform={(data) => { |
| | | return data; |
| | | }} |
| | | mutationOptions={{ onSuccess: handleSuccess, onError: handleError }} |
| | | > |
| | | <Dialog |
| | | open={open} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' |
| | | > |
| | | <Form> |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | | backgroundColor: 'background.paper', |
| | | zIndex: 1000 |
| | | }} |
| | | > |
| | | {translate('create.title')} |
| | | <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent> |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvModel.uuid" |
| | | source="uuid" |
| | | parse={v => v} |
| | | autoFocus |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvModel.type" |
| | | source="type" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvModel.name" |
| | | source="name" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.length" |
| | | source="length" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.width" |
| | | source="width" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.height" |
| | | source="height" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.liftHeight" |
| | | source="liftHeight" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.diameter" |
| | | source="diameter" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvModel.password" |
| | | source="password" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.backpack" |
| | | source="backpack" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.lowBattery" |
| | | source="lowBattery" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.quaBattery" |
| | | source="quaBattery" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.travelSpeed" |
| | | source="travelSpeed" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvModel.workDirection" |
| | | source="workDirection" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.agvModel.allDirection" |
| | | source="allDirection" |
| | | choices={[ |
| | | { id: 0, name: '否' }, |
| | | { id: 1, name: '是' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvModel.protocol" |
| | | source="protocol" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvModel.mqttTopic" |
| | | source="mqttTopic" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <Stack direction="column" spacing={1} width={'100%'}> |
| | | <MemoInput /> |
| | | </Stack> |
| | | </Grid> |
| | | </Grid> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > |
| | | <SaveButton /> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | | </CreateBase> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | export default AgvModelCreate; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | Edit, |
| | | SimpleForm, |
| | | FormDataConsumer, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | SaveButton, |
| | | Toolbar, |
| | | Labeled, |
| | | NumberField, |
| | | required, |
| | | useRecordContext, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography } from '@mui/material'; |
| | | import * as Common from '@/utils/common'; |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import EditBaseAside from "../components/EditBaseAside"; |
| | | import CustomerTopToolBar from "../components/EditTopToolBar"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'space-between' }}> |
| | | <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | | ) |
| | | } |
| | | |
| | | const AgvModelEdit = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | return ( |
| | | <Edit |
| | | redirect="list" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | aside={<EditBaseAside />} |
| | | > |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={12} md={8}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvModel.uuid" |
| | | source="uuid" |
| | | parse={v => v} |
| | | autoFocus |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvModel.type" |
| | | source="type" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvModel.name" |
| | | source="name" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.length" |
| | | source="length" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.width" |
| | | source="width" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.height" |
| | | source="height" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.liftHeight" |
| | | source="liftHeight" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.diameter" |
| | | source="diameter" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvModel.password" |
| | | source="password" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.backpack" |
| | | source="backpack" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.lowBattery" |
| | | source="lowBattery" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.quaBattery" |
| | | source="quaBattery" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.travelSpeed" |
| | | source="travelSpeed" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvModel.workDirection" |
| | | source="workDirection" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <SelectInput |
| | | label="table.field.agvModel.allDirection" |
| | | source="allDirection" |
| | | choices={[ |
| | | { id: 0, name: '否' }, |
| | | { id: 1, name: '是' }, |
| | | ]} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvModel.protocol" |
| | | source="protocol" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvModel.mqttTopic" |
| | | source="mqttTopic" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | |
| | | </Grid> |
| | | <Grid item xs={12} md={4}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.common')} |
| | | </Typography> |
| | | <StatusSelectInput /> |
| | | <Box mt="2em" /> |
| | | <MemoInput /> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | | </Edit > |
| | | ) |
| | | } |
| | | |
| | | export default AgvModelEdit; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useListContext, |
| | | useCreatePath, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import AgvModelCreate from "./AgvModelCreate"; |
| | | import AgvModelPanel from "./AgvModelPanel"; |
| | | import EmptyData from "../components/EmptyData"; |
| | | import MyCreateButton from "../components/MyCreateButton"; |
| | | import MyExportButton from '../components/MyExportButton'; |
| | | import PageDrawer from "../components/PageDrawer"; |
| | | import MyField from "../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <TextInput source="uuid" label="table.field.agvModel.uuid" />, |
| | | <TextInput source="type" label="table.field.agvModel.type" />, |
| | | <TextInput source="name" label="table.field.agvModel.name" />, |
| | | <NumberInput source="length" label="table.field.agvModel.length" />, |
| | | <NumberInput source="width" label="table.field.agvModel.width" />, |
| | | <NumberInput source="height" label="table.field.agvModel.height" />, |
| | | <NumberInput source="liftHeight" label="table.field.agvModel.liftHeight" />, |
| | | <NumberInput source="diameter" label="table.field.agvModel.diameter" />, |
| | | <TextInput source="password" label="table.field.agvModel.password" />, |
| | | <NumberInput source="backpack" label="table.field.agvModel.backpack" />, |
| | | <NumberInput source="lowBattery" label="table.field.agvModel.lowBattery" />, |
| | | <NumberInput source="quaBattery" label="table.field.agvModel.quaBattery" />, |
| | | <NumberInput source="travelSpeed" label="table.field.agvModel.travelSpeed" />, |
| | | <NumberInput source="workDirection" label="table.field.agvModel.workDirection" />, |
| | | <SelectInput source="allDirection" label="table.field.agvModel.allDirection" |
| | | choices={[ |
| | | { id: 0, name: 'common.enums.true' }, |
| | | { id: 1, name: 'common.enums.false' }, |
| | | ]} |
| | | />, |
| | | <TextInput source="protocol" label="table.field.agvModel.protocol" />, |
| | | <TextInput source="mqttTopic" label="table.field.agvModel.mqttTopic" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | />, |
| | | ] |
| | | |
| | | const AgvModelList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.agvModel"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='agvModel' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={25} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='agvModel' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <AgvModelPanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'uuid', 'liftHeight', 'mqttTopic', 'password', 'updateBy', 'updateTime', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="uuid" label="table.field.agvModel.uuid" /> |
| | | <TextField source="type" label="table.field.agvModel.type" /> |
| | | <TextField source="name" label="table.field.agvModel.name" /> |
| | | <NumberField source="length" label="table.field.agvModel.length" /> |
| | | <NumberField source="width" label="table.field.agvModel.width" /> |
| | | <NumberField source="height" label="table.field.agvModel.height" /> |
| | | <NumberField source="liftHeight" label="table.field.agvModel.liftHeight" /> |
| | | <NumberField source="diameter" label="table.field.agvModel.diameter" /> |
| | | <TextField source="password" label="table.field.agvModel.password" /> |
| | | <NumberField source="backpack" label="table.field.agvModel.backpack" /> |
| | | <NumberField source="lowBattery" label="table.field.agvModel.lowBattery" /> |
| | | <NumberField source="quaBattery" label="table.field.agvModel.quaBattery" /> |
| | | <NumberField source="travelSpeed" label="table.field.agvModel.travelSpeed" /> |
| | | <NumberField source="workDirection" label="table.field.agvModel.workDirection" /> |
| | | <BooleanField source="allDirectionBool" label="table.field.agvModel.allDirection" sortable={false} /> |
| | | <TextField source="protocol" label="table.field.agvModel.protocol" /> |
| | | <TextField source="mqttTopic" label="table.field.agvModel.mqttTopic" /> |
| | | |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <AgvModelCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <PageDrawer |
| | | title='AgvModel Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | </Box> |
| | | ) |
| | | } |
| | | |
| | | export default AgvModelList; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; |
| | | import { |
| | | useTranslate, |
| | | useRecordContext, |
| | | } from 'react-admin'; |
| | | import PanelTypography from "../components/PanelTypography"; |
| | | import * as Common from '@/utils/common' |
| | | |
| | | const AgvModelPanel = () => { |
| | | const record = useRecordContext(); |
| | | if (!record) return null; |
| | | const translate = useTranslate(); |
| | | return ( |
| | | <> |
| | | <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> |
| | | <CardContent> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> |
| | | <Typography variant="h6" gutterBottom align="left" sx={{ |
| | | maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, |
| | | whiteSpace: 'nowrap', |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | }}> |
| | | {Common.camelToPascalWithSpaces(translate('table.field.agvModel.name'))}: {record.name} |
| | | </Typography> |
| | | {/* inherit, primary, secondary, textPrimary, textSecondary, error */} |
| | | <Typography variant="h6" gutterBottom align="right" > |
| | | ID: {record.id} |
| | | </Typography> |
| | | </Grid> |
| | | </Grid> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} container alignContent="flex-end"> |
| | | <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> |
| | | {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} |
| | | </Typography> |
| | | </Grid> |
| | | </Grid> |
| | | <Box height={20}> </Box> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.uuid" |
| | | property={record.uuid} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.type" |
| | | property={record.type} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.name" |
| | | property={record.name} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.length" |
| | | property={record.length} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.width" |
| | | property={record.width} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.height" |
| | | property={record.height} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.liftHeight" |
| | | property={record.liftHeight} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.diameter" |
| | | property={record.diameter} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.password" |
| | | property={record.password} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.backpack" |
| | | property={record.backpack} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.lowBattery" |
| | | property={record.lowBattery} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.quaBattery" |
| | | property={record.quaBattery} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.travelSpeed" |
| | | property={record.travelSpeed} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.workDirection" |
| | | property={record.workDirection} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.allDirection" |
| | | property={record.allDirection$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.protocol" |
| | | property={record.protocol} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvModel.mqttTopic" |
| | | property={record.mqttTopic} |
| | | /> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | </CardContent> |
| | | </Card > |
| | | </> |
| | | ); |
| | | }; |
| | | |
| | | export default AgvModelPanel; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | ListGuesser, |
| | | EditGuesser, |
| | | ShowGuesser, |
| | | } from "react-admin"; |
| | | |
| | | import AgvModelList from "./AgvModelList"; |
| | | import AgvModelEdit from "./AgvModelEdit"; |
| | | |
| | | export default { |
| | | list: AgvModelList, |
| | | edit: AgvModelEdit, |
| | | show: ShowGuesser, |
| | | recordRepresentation: (record) => { |
| | | return `${record.name}` |
| | | } |
| | | }; |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_agv_sts"; |
| | | generator.tableDesc="AgvSts"; |
| | | generator.table="man_agv_model"; |
| | | generator.tableDesc="AgvModel"; |
| | | generator.packagePath="com.zy.acs.manager.manager"; |
| | | |
| | | generator.build(); |
New file |
| | |
| | | package com.zy.acs.manager.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.manager.common.utils.ExcelUtil; |
| | | import com.zy.acs.manager.common.annotation.OperationLog; |
| | | import com.zy.acs.manager.common.domain.BaseParam; |
| | | import com.zy.acs.manager.common.domain.KeyValVo; |
| | | import com.zy.acs.manager.common.domain.PageParam; |
| | | import com.zy.acs.manager.manager.entity.AgvModel; |
| | | import com.zy.acs.manager.manager.service.AgvModelService; |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class AgvModelController extends BaseController { |
| | | |
| | | @Autowired |
| | | private AgvModelService agvModelService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:list')") |
| | | @PostMapping("/agvModel/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<AgvModel, BaseParam> pageParam = new PageParam<>(baseParam, AgvModel.class); |
| | | return R.ok().add(agvModelService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:list')") |
| | | @PostMapping("/agvModel/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(agvModelService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:list')") |
| | | @PostMapping({"/agvModel/many/{ids}", "/agvModels/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(agvModelService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:list')") |
| | | @GetMapping("/agvModel/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(agvModelService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:save')") |
| | | @OperationLog("Create AgvModel") |
| | | @PostMapping("/agvModel/save") |
| | | public R save(@RequestBody AgvModel agvModel) { |
| | | agvModel.setCreateBy(getLoginUserId()); |
| | | agvModel.setCreateTime(new Date()); |
| | | agvModel.setUpdateBy(getLoginUserId()); |
| | | agvModel.setUpdateTime(new Date()); |
| | | if (!agvModelService.save(agvModel)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(agvModel); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:update')") |
| | | @OperationLog("Update AgvModel") |
| | | @PostMapping("/agvModel/update") |
| | | public R update(@RequestBody AgvModel agvModel) { |
| | | agvModel.setUpdateBy(getLoginUserId()); |
| | | agvModel.setUpdateTime(new Date()); |
| | | if (!agvModelService.updateById(agvModel)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(agvModel); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:remove')") |
| | | @OperationLog("Delete AgvModel") |
| | | @PostMapping("/agvModel/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!agvModelService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:list')") |
| | | @PostMapping("/agvModel/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<AgvModel> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(AgvModel::getName, condition); |
| | | } |
| | | agvModelService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getName())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvModel:list')") |
| | | @PostMapping("/agvModel/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(agvModelService.list(), AgvModel.class), response); |
| | | } |
| | | |
| | | } |
| | |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getAllDirection$(){ |
| | | public Boolean getAllDirectionBool(){ |
| | | if (null == this.allDirection){ return null; } |
| | | switch (this.allDirection){ |
| | | case 0: |
| | | return "否"; |
| | | case 1: |
| | | return "是"; |
| | | default: |
| | | return String.valueOf(this.allDirection); |
| | | } |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | return true; |
| | | case 0: |
| | | return "禁用"; |
| | | return false; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |