#
luxiaotao1123
2024-11-04 7f70cb15d035f0c233b9e62b9e43aa985317c908
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,10 +69,18 @@
}
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 (
@@ -177,7 +182,7 @@
                        <MyExportButton />
                    </TopToolbar>
                )}
                perPage={25}
                perPage={DEFAULT_PAGE_SIZE}
            >
                <StyledDatagrid
                    preferenceKey='agv'