From ce7cab3f73e46f76b10efd7f8ff8dd5ce712482b Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 12 十一月 2024 14:39:43 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/agv/AgvList.jsx | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/zy-acs-flow/src/page/agv/AgvList.jsx b/zy-acs-flow/src/page/agv/AgvList.jsx
index d4ec3f7..b0855da 100644
--- a/zy-acs-flow/src/page/agv/AgvList.jsx
+++ b/zy-acs-flow/src/page/agv/AgvList.jsx
@@ -8,7 +8,7 @@
SelectColumnsButton,
EditButton,
FilterButton,
- CreateButton,
+ useRefresh,
ExportButton,
BulkDeleteButton,
WrapperField,
@@ -36,7 +36,7 @@
Pagination,
ListToolbar,
} from 'react-admin';
-import { Box, Typography, Card, Stack } from '@mui/material';
+import { Box, Typography, LinearProgress, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
import AgvCreate from "./AgvCreate";
import AgvPanel from "./AgvPanel";
@@ -45,20 +45,17 @@
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 { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, CUSTOM_PAGES_DATA_INTERVAL } from '@/config/setting';
import * as Common from '@/utils/common';
import { ImageList } from "./GridList";
-
+import { AgvListFilter } from "./AgvListFilter";
export const AgvGrid = () => {
- const { identity } = useGetIdentity();
const [createDialog, setCreateDialog] = useState(false);
-
- if (!identity) return null;
return (
<>
- <ListBase perPage={50} sort={{ field: "uuid", order: "asc" }}>
+ <ListBase perPage={50} sort={{ field: "create_time", order: "asc" }}>
<AgvGridLayout
setCreateDialog={setCreateDialog}
/>
@@ -72,14 +69,23 @@
}
const AgvGridLayout = ({ setCreateDialog }) => {
- const { data, isPending, filterValues } = useListContext();
+ const { data, isPending, filterValues, refetch } = useListContext();
const hasFilters = filterValues && Object.keys(filterValues).length > 0;
- if (isPending) return null;
+ React.useEffect(() => {
+ const intervalId = setInterval(() => {
+ refetch();
+ }, CUSTOM_PAGES_DATA_INTERVAL);
+
+ return () => clearInterval(intervalId);
+ }, [refetch]);
+
+ if (isPending) return <LinearProgress />;
if (!data?.length && !hasFilters) return <EmptyData onClick={() => { setCreateDialog(true) }} />;
return (
<Stack direction="row" component="div">
+ <AgvListFilter />
<Stack sx={{ width: '100%' }}>
<Title title={"menu.agv"} />
<ListToolbar actions={(
@@ -176,7 +182,7 @@
<MyExportButton />
</TopToolbar>
)}
- perPage={25}
+ perPage={DEFAULT_PAGE_SIZE}
>
<StyledDatagrid
preferenceKey='agv'
--
Gitblit v1.9.1