From f6ba6151e53a9cd4bd46f56edcb6d88ec86a92bd Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 20 九月 2024 09:32:37 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/agv/AgvList.jsx | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 56 insertions(+), 3 deletions(-) diff --git a/zy-acs-flow/src/page/agv/AgvList.jsx b/zy-acs-flow/src/page/agv/AgvList.jsx index 7a9a0c0..4f03c6c 100644 --- a/zy-acs-flow/src/page/agv/AgvList.jsx +++ b/zy-acs-flow/src/page/agv/AgvList.jsx @@ -30,6 +30,10 @@ ReferenceArrayInput, AutocompleteInput, DeleteButton, + useGetIdentity, + ListBase, + Title, + Pagination, } from 'react-admin'; import { Box, Typography, Card, Stack } from '@mui/material'; import { styled } from '@mui/material/styles'; @@ -42,6 +46,57 @@ import MyField from "../components/MyField"; import { PAGE_DRAWER_WIDTH, OPERATE_MODE } from '@/config/setting'; import * as Common from '@/utils/common'; +import { ImageList } from "./GridList"; + + +export const AgvGrid = () => { + const { identity } = useGetIdentity(); + if (!identity) return null; + const [createDialog, setCreateDialog] = useState(false); + + return ( + <> + <ListBase perPage={50} sort={{ field: "uuid", order: "asc" }}> + <AgvGridLayout + setCreateDialog={setCreateDialog} + /> + </ListBase> + <AgvCreate + open={createDialog} + setOpen={setCreateDialog} + /> + </> + ) +} + +const AgvGridLayout = (props) => { + const { data, isPending, filterValues } = useListContext(); + const hasFilters = filterValues && Object.keys(filterValues).length > 0; + + if (isPending) return null; + if (!data?.length && !hasFilters) return <EmptyData onClick={() => { props.setCreateDialog(true) }} />; + + return ( + <Stack direction="row" component="div"> + <Stack sx={{ width: '100%' }}> + <Title title={'Companies'} /> + <ListToolbar actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <MyExportButton /> + </TopToolbar> + )} /> + <ImageList /> + <Pagination rowsPerPageOptions={[10, 25, 50, 100]} /> + </Stack> + </Stack> + ); +} + + + + const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ '& .css-1vooibu-MuiSvgIcon-root': { @@ -92,7 +147,7 @@ />, ] -const AgvList = () => { +export const AgvList = () => { const translate = useTranslate(); const [createDialog, setCreateDialog] = useState(false); @@ -174,5 +229,3 @@ </Box> ) } - -export default AgvList; -- Gitblit v1.9.1