From 6faab23aa66f4c29f9f83458d2d899341f5725b0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 08 十一月 2024 14:26:40 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/loc/LocBulkUpdateContent.jsx | 56 ++++++++++++++++++++++++++++
zy-acs-flow/src/page/components/BulkUpdateButton.jsx | 43 +--------------------
zy-acs-flow/src/page/loc/LocList.jsx | 11 ++++-
3 files changed, 67 insertions(+), 43 deletions(-)
diff --git a/zy-acs-flow/src/page/loc/BulkUpdateButton.jsx b/zy-acs-flow/src/page/components/BulkUpdateButton.jsx
similarity index 62%
rename from zy-acs-flow/src/page/loc/BulkUpdateButton.jsx
rename to zy-acs-flow/src/page/components/BulkUpdateButton.jsx
index 572f8ee..eeeccbb 100644
--- a/zy-acs-flow/src/page/loc/BulkUpdateButton.jsx
+++ b/zy-acs-flow/src/page/components/BulkUpdateButton.jsx
@@ -16,11 +16,10 @@
} from 'react-admin';
import { Dialog, DialogActions, DialogContent, DialogTitle, Grid, Stack, Divider } from '@mui/material';
import UpdateIcon from '@mui/icons-material/Update';
-import MemoInput from "../components/MemoInput";
import ContentSave from '@mui/icons-material/Save';
import CloseIcon from '@mui/icons-material/Close';
-const BulkUpdateButton = ({ label = 'ra.action.update' }) => {
+const BulkUpdateButton = ({ label = 'ra.action.update', children }) => {
const [open, setOpen] = useState(false);
const refresh = useRefresh();
@@ -36,7 +35,7 @@
const [updateMany, { loading }] = useUpdateMany();
const handleSubmit = (data) => {
- delete filteredData['memoWrap'];
+ delete data['memoWrap'];
const filteredData = Object.fromEntries(
Object.entries(data).filter(([key, value]) => value !== null && value !== undefined)
);
@@ -71,43 +70,7 @@
<Form onSubmit={handleSubmit}>
<DialogTitle>{translate('ra.action.update')}</DialogTitle>
<DialogContent>
- <Grid container rowSpacing={2} columnSpacing={2}>
- <Grid item xs={6} display="flex" gap={1}>
- <ReferenceInput
- source="code"
- reference="code"
- >
- <AutocompleteInput
- label="table.field.loc.code"
- optionText="data"
- filterToQuery={(val) => ({ data: val })}
- />
- </ReferenceInput>
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <ReferenceInput
- source="locSts"
- reference="locSts"
- >
- <AutocompleteInput
- label="table.field.loc.locSts"
- optionText="name"
- filterToQuery={(val) => ({ name: val })}
- />
- </ReferenceInput>
- </Grid>
- <Grid item xs={6} display="flex" gap={1}>
- <NumberInput
- label="table.field.loc.offset"
- source="offset"
- />
- </Grid>
- <Grid item xs={12} display="flex" gap={1}>
- <Stack direction="column" spacing={1} width={'100%'}>
- <MemoInput />
- </Stack>
- </Grid>
- </Grid>
+ {children}
</DialogContent>
<Divider sx={{ mb: 1 }} />
<DialogActions sx={{ mb: 1 }}>
diff --git a/zy-acs-flow/src/page/loc/LocBulkUpdateContent.jsx b/zy-acs-flow/src/page/loc/LocBulkUpdateContent.jsx
new file mode 100644
index 0000000..f6ba7b6
--- /dev/null
+++ b/zy-acs-flow/src/page/loc/LocBulkUpdateContent.jsx
@@ -0,0 +1,56 @@
+import React, { useState } from 'react';
+import {
+ Form,
+ ReferenceInput,
+ AutocompleteInput,
+ NumberInput,
+} from 'react-admin';
+import { Grid, Stack } from '@mui/material';
+import MemoInput from "../components/MemoInput";
+
+const LocBulkUpdateContent = () => {
+
+ return (
+ <>
+ <Grid container rowSpacing={2} columnSpacing={2}>
+ <Grid item xs={6} display="flex" gap={1}>
+ <ReferenceInput
+ source="code"
+ reference="code"
+ >
+ <AutocompleteInput
+ label="table.field.loc.code"
+ optionText="data"
+ filterToQuery={(val) => ({ data: val })}
+ />
+ </ReferenceInput>
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <ReferenceInput
+ source="locSts"
+ reference="locSts"
+ >
+ <AutocompleteInput
+ label="table.field.loc.locSts"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.loc.offset"
+ source="offset"
+ />
+ </Grid>
+ <Grid item xs={12} display="flex" gap={1}>
+ <Stack direction="column" spacing={1} width={'100%'}>
+ <MemoInput />
+ </Stack>
+ </Grid>
+ </Grid>
+ </>
+ )
+}
+
+export default LocBulkUpdateContent;
\ No newline at end of file
diff --git a/zy-acs-flow/src/page/loc/LocList.jsx b/zy-acs-flow/src/page/loc/LocList.jsx
index 753e1f2..83bdbc5 100644
--- a/zy-acs-flow/src/page/loc/LocList.jsx
+++ b/zy-acs-flow/src/page/loc/LocList.jsx
@@ -31,6 +31,7 @@
AutocompleteInput,
DeleteButton,
Button,
+ Pagination,
} from 'react-admin';
import { Box, Typography, Card, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
@@ -46,7 +47,8 @@
import CorporateFareIcon from '@mui/icons-material/CorporateFare';
import LocInit from "./LocInit";
import rowSx from "./rowSx";
-import BulkUpdateButton from "./BulkUpdateButton";
+import BulkUpdateButton from "../components/BulkUpdateButton";
+import LocBulkUpdateContent from './LocBulkUpdateContent';
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
@@ -103,7 +105,9 @@
const LocBulkActionButtons = () => {
return (
<>
- <BulkUpdateButton />
+ <BulkUpdateButton>
+ <LocBulkUpdateContent />
+ </BulkUpdateButton>
<BulkDeleteButton mutationMode={OPERATE_MODE} />
</>
);
@@ -143,7 +147,8 @@
<MyExportButton />
</TopToolbar>
)}
- perPage={DEFAULT_PAGE_SIZE}
+ pagination={<Pagination rowsPerPageOptions={[10, 20, 50, 100, 300, 500]} />}
+ perPage={20}
>
<StyledDatagrid
preferenceKey='loc'
--
Gitblit v1.9.1