From f2c1e96e19df67ff7ceb35233854c98aeaa39078 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期六, 21 九月 2024 09:49:42 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/agv/AgvCreate.jsx | 8 +- zy-acs-flow/src/page/agv/AgvEdit.jsx | 2 zy-acs-flow/src/page/components/EditTopToolBar.jsx | 4 zy-acs-flow/src/page/agv/AgvShow.jsx | 13 +--- zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx | 66 ++++++++++++++++++++++ zy-acs-flow/src/page/agv/show/AgvShowAside.jsx | 50 ++++++++++++++++ 6 files changed, 127 insertions(+), 16 deletions(-) diff --git a/zy-acs-flow/src/page/agv/AgvCreate.jsx b/zy-acs-flow/src/page/agv/AgvCreate.jsx index 414863f..bc7aad1 100644 --- a/zy-acs-flow/src/page/agv/AgvCreate.jsx +++ b/zy-acs-flow/src/page/agv/AgvCreate.jsx @@ -111,13 +111,13 @@ 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" @@ -149,7 +149,7 @@ 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" @@ -158,7 +158,7 @@ { id: 0, name: '姝e父' }, ]} /> - </Grid> + </Grid> */} <Grid item xs={6} display="flex" gap={1}> <StatusSelectInput /> diff --git a/zy-acs-flow/src/page/agv/AgvEdit.jsx b/zy-acs-flow/src/page/agv/AgvEdit.jsx index d369d00..69ddb72 100644 --- a/zy-acs-flow/src/page/agv/AgvEdit.jsx +++ b/zy-acs-flow/src/page/agv/AgvEdit.jsx @@ -47,7 +47,7 @@ <Edit redirect="list" mutationMode={EDIT_MODE} - actions={<CustomerTopToolBar />} + actions={<CustomerTopToolBar backPrevious />} aside={<EditBaseAside />} > <SimpleForm diff --git a/zy-acs-flow/src/page/agv/AgvShow.jsx b/zy-acs-flow/src/page/agv/AgvShow.jsx index d758cea..d381e4d 100644 --- a/zy-acs-flow/src/page/agv/AgvShow.jsx +++ b/zy-acs-flow/src/page/agv/AgvShow.jsx @@ -24,6 +24,8 @@ Typography, } from '@mui/material'; import { formatDistance } from 'date-fns'; +import { AgvShowDetail } from "./show/AgvShowDetail"; +import { AgvShowAside } from "./show/AgvShowAside"; export const AgvShow = () => { @@ -58,7 +60,8 @@ '& .RaTabbedShowLayout-content': { p: 0 }, }} > - <TabbedShowLayout.Tab label="Activity"> + <TabbedShowLayout.Tab label="DETAIL"> + <AgvShowDetail /> </TabbedShowLayout.Tab> </TabbedShowLayout> </CardContent> @@ -69,11 +72,3 @@ </> ) } - -const AgvShowAside = (props) => { - const { record, isPending } = useShowContext(); - - return (<> - <h1>{JSON.stringify(record)}</h1> - </>) -} \ No newline at end of file diff --git a/zy-acs-flow/src/page/agv/show/AgvShowAside.jsx b/zy-acs-flow/src/page/agv/show/AgvShowAside.jsx new file mode 100644 index 0000000..f3a60b7 --- /dev/null +++ b/zy-acs-flow/src/page/agv/show/AgvShowAside.jsx @@ -0,0 +1,50 @@ +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> + </>) +} \ No newline at end of file diff --git a/zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx b/zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx new file mode 100644 index 0000000..78eae42 --- /dev/null +++ b/zy-acs-flow/src/page/agv/show/AgvShowDetail.jsx @@ -0,0 +1,66 @@ +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> + </> + ) +} \ No newline at end of file diff --git a/zy-acs-flow/src/page/components/EditTopToolBar.jsx b/zy-acs-flow/src/page/components/EditTopToolBar.jsx index 2e3d628..c238797 100644 --- a/zy-acs-flow/src/page/components/EditTopToolBar.jsx +++ b/zy-acs-flow/src/page/components/EditTopToolBar.jsx @@ -4,7 +4,7 @@ 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(); @@ -15,7 +15,7 @@ justifyContent: 'flex-start' }}> <Button - onClick={() => navigate('/' + resource)} + onClick={backPrevious ? () => navigate(-1) : () => navigate('/' + resource)} sx={{ border: '1px solid #ccc', padding: '6px 12px', -- Gitblit v1.9.1