| | |
| | | parse={v => v} |
| | | /> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agv.ip" |
| | | source="ip" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agv.secret" |
| | |
| | | source="chargeLine" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.agv.error" |
| | | source="error" |
| | |
| | | { id: 0, name: '正常' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | </Grid> */} |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | |
| | | <Edit |
| | | redirect="list" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | actions={<CustomerTopToolBar backPrevious />} |
| | | aside={<EditBaseAside />} |
| | | > |
| | | <SimpleForm |
| | |
| | | Typography, |
| | | } from '@mui/material'; |
| | | import { formatDistance } from 'date-fns'; |
| | | import { AgvShowDetail } from "./show/AgvShowDetail"; |
| | | import { AgvShowAside } from "./show/AgvShowAside"; |
| | | |
| | | |
| | | export const AgvShow = () => { |
| | |
| | | '& .RaTabbedShowLayout-content': { p: 0 }, |
| | | }} |
| | | > |
| | | <TabbedShowLayout.Tab label="Activity"> |
| | | <TabbedShowLayout.Tab label="DETAIL"> |
| | | <AgvShowDetail /> |
| | | </TabbedShowLayout.Tab> |
| | | </TabbedShowLayout> |
| | | </CardContent> |
| | |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | const AgvShowAside = (props) => { |
| | | const { record, isPending } = useShowContext(); |
| | | |
| | | return (<> |
| | | <h1>{JSON.stringify(record)}</h1> |
| | | </>) |
| | | } |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | DateField, |
| | | EditButton, |
| | | ReferenceField, |
| | | SelectField, |
| | | ShowButton, |
| | | TextField, |
| | | UrlField, |
| | | useRecordContext, |
| | | } from 'react-admin'; |
| | | import { Link as RouterLink, useLocation } from 'react-router-dom'; |
| | | import { |
| | | Box, |
| | | Button, |
| | | Card, |
| | | CardContent, |
| | | Skeleton, |
| | | Stack, |
| | | Typography, |
| | | Divider, |
| | | } from '@mui/material'; |
| | | import { formatDistance } from 'date-fns'; |
| | | |
| | | |
| | | export const AgvShowAside = (props) => { |
| | | const { link = 'edit' } = props; |
| | | const record = useRecordContext(); |
| | | if (!record) return null; |
| | | |
| | | return (<> |
| | | <Stack ml={4} width={250} minWidth={250} spacing={2}> |
| | | <Stack direction="row" spacing={1}> |
| | | {link === 'edit' ? ( |
| | | <EditButton label="Edit Company" /> |
| | | ) : ( |
| | | <ShowButton label="Show Company" /> |
| | | )} |
| | | </Stack> |
| | | |
| | | {/* <CompanyInfo record={record} /> |
| | | |
| | | <AddressInfo record={record} /> |
| | | |
| | | <ContextInfo record={record} /> |
| | | |
| | | <AdditionalInfo record={record} /> */} |
| | | </Stack> |
| | | </>) |
| | | } |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | useDataProvider, |
| | | SortButton, |
| | | TabbedShowLayout, |
| | | useListContext, |
| | | useRecordContext, |
| | | useShowContext, |
| | | } from 'react-admin'; |
| | | import { Link as RouterLink, useLocation } from 'react-router-dom'; |
| | | import { |
| | | Box, |
| | | Button, |
| | | Card, |
| | | CardContent, |
| | | Skeleton, |
| | | Stack, |
| | | Typography, |
| | | Divider, |
| | | } from '@mui/material'; |
| | | import { formatDistance } from 'date-fns'; |
| | | |
| | | |
| | | export const AgvShowDetail = (props) => { |
| | | const { agvId, ...rest } = props; |
| | | |
| | | const dataProvider = useDataProvider(); |
| | | const [data, setData] = useState(null); |
| | | |
| | | useEffect(() => { |
| | | |
| | | }, []); |
| | | |
| | | if (!data) { |
| | | return ( |
| | | <Stack mt={0.5}> |
| | | {Array.from({ length: 5 }).map((_, index) => ( |
| | | <Stack spacing={2} sx={{ mt: 1 }} key={index}> |
| | | <Stack |
| | | direction="row" |
| | | spacing={2} |
| | | sx={{ alignItems: 'center' }} |
| | | > |
| | | <Skeleton |
| | | variant="circular" |
| | | width={20} |
| | | height={20} |
| | | /> |
| | | <Skeleton width="100%" /> |
| | | </Stack> |
| | | <Skeleton variant="rectangular" height={50} /> |
| | | <Divider /> |
| | | </Stack> |
| | | ))} |
| | | </Stack> |
| | | ); |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Card> |
| | | |
| | | </Card> |
| | | </> |
| | | ) |
| | | } |
| | |
| | | import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew'; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | |
| | | const CustomerTopToolBar = ({ ...rest }) => { |
| | | const CustomerTopToolBar = ({ backPrevious = false, ...rest }) => { |
| | | const navigate = useNavigate(); |
| | | const resource = useResourceContext(); |
| | | const translate = useTranslate(); |
| | |
| | | justifyContent: 'flex-start' |
| | | }}> |
| | | <Button |
| | | onClick={() => navigate('/' + resource)} |
| | | onClick={backPrevious ? () => navigate(-1) : () => navigate('/' + resource)} |
| | | sx={{ |
| | | border: '1px solid #ccc', |
| | | padding: '6px 12px', |