| | |
| | | agvSts: 'Agv Status', |
| | | agvModel: 'Agv Model', |
| | | agv: 'Agv', |
| | | agvDetail: 'Agv Detail', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | chargeLine: "charge battery", |
| | | error: "error", |
| | | }, |
| | | agvDetail: { |
| | | uuid: "uuid", |
| | | agvId: "agv", |
| | | title: "title", |
| | | pos: "position", |
| | | code: "code", |
| | | lastCode: "last code", |
| | | codeOffsert: "code offset", |
| | | straightVal: "straight distance", |
| | | agvAngle: "angle", |
| | | gyroAngle: "gyro angle", |
| | | encoderAngle: "encoder angle", |
| | | high: "high", |
| | | sensorSts: "sensor status", |
| | | vol: "vol", |
| | | soc: "soc", |
| | | soh: "soh", |
| | | batteryFail: "battery fail", |
| | | tempe: "temperature", |
| | | motorFail: "motor fail", |
| | | failSign: "fail sign", |
| | | bootTime: "boot time", |
| | | workTime: "work time", |
| | | workDistance: "mileage", |
| | | tempQua: "temp", |
| | | password: "password", |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | |
| | | agvSts: '车辆状态', |
| | | agvModel: '车型管理', |
| | | agv: '车辆管理', |
| | | agvDetail: '车辆详情', |
| | | |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | chargeLine: "充电电量", |
| | | error: "异常", |
| | | }, |
| | | agvDetail: { |
| | | uuid: "编号", |
| | | agvId: "车辆", |
| | | title: "标题", |
| | | pos: "定位点", |
| | | code: "地面码", |
| | | lastCode: "上次定位", |
| | | codeOffsert: "地面码偏移", |
| | | straightVal: "直行距离", |
| | | agvAngle: "当前角度", |
| | | gyroAngle: "陀螺仪角度", |
| | | encoderAngle: "编码器角度", |
| | | high: "当前高度", |
| | | sensorSts: "传感器状态", |
| | | vol: "电压", |
| | | soc: "电量", |
| | | soh: "健康", |
| | | batteryFail: "电池故障", |
| | | tempe: "温度", |
| | | motorFail: "电机故障", |
| | | failSign: "故障标识", |
| | | bootTime: "开机时间", |
| | | workTime: "工作时间", |
| | | workDistance: "累计里程", |
| | | tempQua: "暂存数量", |
| | | password: "密码", |
| | | }, |
| | | |
| | | } |
| | | } |
| | | }; |
| | |
| | | import agvSts from './agvSts'; |
| | | import agvModel from './agvModel'; |
| | | import agv from './agv'; |
| | | import agvDetail from './agvDetail'; |
| | | |
| | | const ResourceContent = (node) => { |
| | | switch (node.component) { |
| | |
| | | return agvModel; |
| | | case 'agv': |
| | | return agv; |
| | | case 'agvDetail': |
| | | return agvDetail; |
| | | 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 AgvDetailCreate = (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.agvDetail.uuid" |
| | | source="uuid" |
| | | parse={v => v} |
| | | autoFocus |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="agvId" |
| | | reference="agv" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.agvDetail.agvId" |
| | | optionText="uuid" |
| | | filterToQuery={(val) => ({ uuid: val })} |
| | | validate={required()} |
| | | /> |
| | | </ReferenceInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvDetail.title" |
| | | source="title" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.agvDetail.pos" |
| | | source="pos" |
| | | choices={[ |
| | | { id: 1, name: '是' }, |
| | | { id: 0, name: '否' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="code" |
| | | reference="code" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.agvDetail.code" |
| | | optionText="data" |
| | | filterToQuery={(val) => ({ data: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="lastCode" |
| | | reference="code" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.agvDetail.lastCode" |
| | | optionText="data" |
| | | filterToQuery={(val) => ({ data: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvDetail.codeOffsert" |
| | | source="codeOffsert" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.straightVal" |
| | | source="straightVal" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.agvAngle" |
| | | source="agvAngle" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.gyroAngle" |
| | | source="gyroAngle" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.encoderAngle" |
| | | source="encoderAngle" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.high" |
| | | source="high" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.sensorSts" |
| | | source="sensorSts" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.vol" |
| | | source="vol" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.soc" |
| | | source="soc" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.soh" |
| | | source="soh" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.batteryFail" |
| | | source="batteryFail" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvDetail.tempe" |
| | | source="tempe" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvDetail.motorFail" |
| | | source="motorFail" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvDetail.failSign" |
| | | source="failSign" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.bootTime" |
| | | source="bootTime" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.workTime" |
| | | source="workTime" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.workDistance" |
| | | source="workDistance" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.tempQua" |
| | | source="tempQua" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvDetail.password" |
| | | source="password" |
| | | 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 AgvDetailCreate; |
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 AgvDetailEdit = () => { |
| | | 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.agvDetail.uuid" |
| | | source="uuid" |
| | | parse={v => v} |
| | | autoFocus |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <ReferenceInput |
| | | source="agvId" |
| | | reference="agv" |
| | | perPage={REFERENCE_INPUT_PAGESIZE} |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.agvDetail.agvId" |
| | | optionText="uuid" |
| | | filterToQuery={(val) => ({ uuid: val })} |
| | | validate={required()} |
| | | /> |
| | | </ReferenceInput> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvDetail.title" |
| | | source="title" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <SelectInput |
| | | label="table.field.agvDetail.pos" |
| | | source="pos" |
| | | choices={[ |
| | | { id: 1, name: '是' }, |
| | | { id: 0, name: '否' }, |
| | | ]} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <ReferenceInput |
| | | source="code" |
| | | reference="code" |
| | | perPage={REFERENCE_INPUT_PAGESIZE} |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.agvDetail.code" |
| | | optionText="data" |
| | | filterToQuery={(val) => ({ data: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <ReferenceInput |
| | | source="lastCode" |
| | | reference="code" |
| | | perPage={REFERENCE_INPUT_PAGESIZE} |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.agvDetail.lastCode" |
| | | optionText="data" |
| | | filterToQuery={(val) => ({ data: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvDetail.codeOffsert" |
| | | source="codeOffsert" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.straightVal" |
| | | source="straightVal" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.agvAngle" |
| | | source="agvAngle" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.gyroAngle" |
| | | source="gyroAngle" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.encoderAngle" |
| | | source="encoderAngle" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.high" |
| | | source="high" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.sensorSts" |
| | | source="sensorSts" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.vol" |
| | | source="vol" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.soc" |
| | | source="soc" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.soh" |
| | | source="soh" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.batteryFail" |
| | | source="batteryFail" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvDetail.tempe" |
| | | source="tempe" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvDetail.motorFail" |
| | | source="motorFail" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvDetail.failSign" |
| | | source="failSign" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.bootTime" |
| | | source="bootTime" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.workTime" |
| | | source="workTime" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.workDistance" |
| | | source="workDistance" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.agvDetail.tempQua" |
| | | source="tempQua" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvDetail.password" |
| | | source="password" |
| | | 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 AgvDetailEdit; |
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 AgvDetailCreate from "./AgvDetailCreate"; |
| | | import AgvDetailPanel from "./AgvDetailPanel"; |
| | | 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.agvDetail.uuid" />, |
| | | <ReferenceInput source="agvId" label="table.field.agvDetail.agvId" reference="agv"> |
| | | <AutocompleteInput label="table.field.agvDetail.agvId" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> |
| | | </ReferenceInput>, |
| | | <TextInput source="title" label="table.field.agvDetail.title" />, |
| | | <SelectInput source="pos" label="table.field.agvDetail.pos" |
| | | choices={[ |
| | | { id: 1, name: '是' }, |
| | | { id: 0, name: '否' }, |
| | | ]} |
| | | />, |
| | | <ReferenceInput source="code" label="table.field.agvDetail.code" reference="code"> |
| | | <AutocompleteInput label="table.field.agvDetail.code" optionText="data" filterToQuery={(val) => ({ data: val })} /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="lastCode" label="table.field.agvDetail.lastCode" reference="code"> |
| | | <AutocompleteInput label="table.field.agvDetail.lastCode" optionText="data" filterToQuery={(val) => ({ data: val })} /> |
| | | </ReferenceInput>, |
| | | <NumberInput source="agvAngle" label="table.field.agvDetail.agvAngle" />, |
| | | <NumberInput source="gyroAngle" label="table.field.agvDetail.gyroAngle" />, |
| | | <NumberInput source="encoderAngle" label="table.field.agvDetail.encoderAngle" />, |
| | | <NumberInput source="high" label="table.field.agvDetail.high" />, |
| | | <NumberInput source="sensorSts" label="table.field.agvDetail.sensorSts" />, |
| | | <NumberInput source="vol" label="table.field.agvDetail.vol" />, |
| | | <NumberInput source="soc" label="table.field.agvDetail.soc" />, |
| | | <NumberInput source="soh" label="table.field.agvDetail.soh" />, |
| | | <NumberInput source="batteryFail" label="table.field.agvDetail.batteryFail" />, |
| | | <TextInput source="tempe" label="table.field.agvDetail.tempe" />, |
| | | <TextInput source="motorFail" label="table.field.agvDetail.motorFail" />, |
| | | <TextInput source="failSign" label="table.field.agvDetail.failSign" />, |
| | | <NumberInput source="workDistance" label="table.field.agvDetail.workDistance" />, |
| | | |
| | | <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 AgvDetailList = () => { |
| | | 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.agvDetail"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='agvDetail' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={25} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='agvDetail' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <AgvDetailPanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="uuid" label="table.field.agvDetail.uuid" /> |
| | | <ReferenceField source="agvId" label="table.field.agvDetail.agvId" reference="agv" link={false} sortable={false}> |
| | | <TextField source="uuid" /> |
| | | </ReferenceField> |
| | | <TextField source="title" label="table.field.agvDetail.title" /> |
| | | <TextField source="pos$" label="table.field.agvDetail.pos" sortable={false} /> |
| | | <ReferenceField source="code" label="table.field.agvDetail.code" reference="code" link={false} sortable={false}> |
| | | <TextField source="data" /> |
| | | </ReferenceField> |
| | | <ReferenceField source="lastCode" label="table.field.agvDetail.lastCode" reference="code" link={false} sortable={false}> |
| | | <TextField source="data" /> |
| | | </ReferenceField> |
| | | <TextField source="codeOffsert" label="table.field.agvDetail.codeOffsert" /> |
| | | <NumberField source="straightVal" label="table.field.agvDetail.straightVal" /> |
| | | <NumberField source="agvAngle" label="table.field.agvDetail.agvAngle" /> |
| | | <NumberField source="gyroAngle" label="table.field.agvDetail.gyroAngle" /> |
| | | <NumberField source="encoderAngle" label="table.field.agvDetail.encoderAngle" /> |
| | | <NumberField source="high" label="table.field.agvDetail.high" /> |
| | | <NumberField source="sensorSts" label="table.field.agvDetail.sensorSts" /> |
| | | <NumberField source="vol" label="table.field.agvDetail.vol" /> |
| | | <NumberField source="soc" label="table.field.agvDetail.soc" /> |
| | | <NumberField source="soh" label="table.field.agvDetail.soh" /> |
| | | <NumberField source="batteryFail" label="table.field.agvDetail.batteryFail" /> |
| | | <TextField source="tempe" label="table.field.agvDetail.tempe" /> |
| | | <TextField source="motorFail" label="table.field.agvDetail.motorFail" /> |
| | | <TextField source="failSign" label="table.field.agvDetail.failSign" /> |
| | | <NumberField source="bootTime" label="table.field.agvDetail.bootTime" /> |
| | | <NumberField source="workTime" label="table.field.agvDetail.workTime" /> |
| | | <NumberField source="workDistance" label="table.field.agvDetail.workDistance" /> |
| | | <NumberField source="tempQua" label="table.field.agvDetail.tempQua" /> |
| | | <TextField source="password" label="table.field.agvDetail.password" /> |
| | | |
| | | <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> |
| | | <AgvDetailCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <PageDrawer |
| | | title='AgvDetail Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | </Box> |
| | | ) |
| | | } |
| | | |
| | | export default AgvDetailList; |
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 AgvDetailPanel = () => { |
| | | 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.agvDetail.uuid'))}: {record.uuid} |
| | | </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.agvDetail.uuid" |
| | | property={record.uuid} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.agvId" |
| | | property={record.agvId$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.title" |
| | | property={record.title} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.pos" |
| | | property={record.pos$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.code" |
| | | property={record.code$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.lastCode" |
| | | property={record.lastCode$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.codeOffsert" |
| | | property={record.codeOffsert} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.straightVal" |
| | | property={record.straightVal} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.agvAngle" |
| | | property={record.agvAngle} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.gyroAngle" |
| | | property={record.gyroAngle} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.encoderAngle" |
| | | property={record.encoderAngle} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.high" |
| | | property={record.high} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.sensorSts" |
| | | property={record.sensorSts} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.vol" |
| | | property={record.vol} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.soc" |
| | | property={record.soc} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.soh" |
| | | property={record.soh} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.batteryFail" |
| | | property={record.batteryFail} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.tempe" |
| | | property={record.tempe} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.motorFail" |
| | | property={record.motorFail} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.failSign" |
| | | property={record.failSign} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.bootTime" |
| | | property={record.bootTime} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.workTime" |
| | | property={record.workTime} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.workDistance" |
| | | property={record.workDistance} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.tempQua" |
| | | property={record.tempQua} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.password" |
| | | property={record.password} |
| | | /> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | </CardContent> |
| | | </Card > |
| | | </> |
| | | ); |
| | | }; |
| | | |
| | | export default AgvDetailPanel; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | ListGuesser, |
| | | EditGuesser, |
| | | ShowGuesser, |
| | | } from "react-admin"; |
| | | |
| | | import AgvDetailList from "./AgvDetailList"; |
| | | import AgvDetailEdit from "./AgvDetailEdit"; |
| | | |
| | | export default { |
| | | list: AgvDetailList, |
| | | edit: AgvDetailEdit, |
| | | show: ShowGuesser, |
| | | recordRepresentation: (record) => { |
| | | return `${record.uuid}` |
| | | } |
| | | }; |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_agv"; |
| | | generator.tableDesc="Agv"; |
| | | generator.table="man_agv_detail"; |
| | | generator.tableDesc="AgvDetail"; |
| | | 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.AgvDetail; |
| | | import com.zy.acs.manager.manager.service.AgvDetailService; |
| | | 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 AgvDetailController extends BaseController { |
| | | |
| | | @Autowired |
| | | private AgvDetailService agvDetailService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:list')") |
| | | @PostMapping("/agvDetail/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<AgvDetail, BaseParam> pageParam = new PageParam<>(baseParam, AgvDetail.class); |
| | | return R.ok().add(agvDetailService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:list')") |
| | | @PostMapping("/agvDetail/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(agvDetailService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:list')") |
| | | @PostMapping({"/agvDetail/many/{ids}", "/agvDetails/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(agvDetailService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:list')") |
| | | @GetMapping("/agvDetail/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(agvDetailService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:save')") |
| | | @OperationLog("Create AgvDetail") |
| | | @PostMapping("/agvDetail/save") |
| | | public R save(@RequestBody AgvDetail agvDetail) { |
| | | agvDetail.setCreateBy(getLoginUserId()); |
| | | agvDetail.setCreateTime(new Date()); |
| | | agvDetail.setUpdateBy(getLoginUserId()); |
| | | agvDetail.setUpdateTime(new Date()); |
| | | if (!agvDetailService.save(agvDetail)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(agvDetail); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:update')") |
| | | @OperationLog("Update AgvDetail") |
| | | @PostMapping("/agvDetail/update") |
| | | public R update(@RequestBody AgvDetail agvDetail) { |
| | | agvDetail.setUpdateBy(getLoginUserId()); |
| | | agvDetail.setUpdateTime(new Date()); |
| | | if (!agvDetailService.updateById(agvDetail)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(agvDetail); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:remove')") |
| | | @OperationLog("Delete AgvDetail") |
| | | @PostMapping("/agvDetail/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!agvDetailService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:list')") |
| | | @PostMapping("/agvDetail/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<AgvDetail> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(AgvDetail::getUuid, condition); |
| | | } |
| | | agvDetailService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getUuid())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agvDetail:list')") |
| | | @PostMapping("/agvDetail/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(agvDetailService.list(), AgvDetail.class), response); |
| | | } |
| | | |
| | | } |