From a7cd95a949a3752897d94ce3316c36bef068d2eb Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期一, 24 三月 2025 09:47:46 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/loc/LocList.jsx | 71 +++++++++++++++++++++++++----------
1 files changed, 50 insertions(+), 21 deletions(-)
diff --git a/zy-acs-flow/src/page/loc/LocList.jsx b/zy-acs-flow/src/page/loc/LocList.jsx
index 4a4e0e7..83bdbc5 100644
--- a/zy-acs-flow/src/page/loc/LocList.jsx
+++ b/zy-acs-flow/src/page/loc/LocList.jsx
@@ -30,6 +30,8 @@
ReferenceArrayInput,
AutocompleteInput,
DeleteButton,
+ Button,
+ Pagination,
} from 'react-admin';
import { Box, Typography, Card, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
@@ -40,8 +42,13 @@
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 } from '@/config/setting';
import * as Common from '@/utils/common';
+import CorporateFareIcon from '@mui/icons-material/CorporateFare';
+import LocInit from "./LocInit";
+import rowSx from "./rowSx";
+import BulkUpdateButton from "../components/BulkUpdateButton";
+import LocBulkUpdateContent from './LocBulkUpdateContent';
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
@@ -50,7 +57,8 @@
'& .RaDatagrid-row': {
cursor: 'auto'
},
- '& .column-name': {
+ '& .column-locNo': {
+ minWidth: 180
},
'& .opt': {
width: 200
@@ -58,26 +66,25 @@
}));
const filters = [
+ <TextInput source="locNo" label="table.field.loc.locNo" alwaysOn />,
+ <ReferenceInput source="locSts" label="table.field.loc.locSts" reference="locSts" alwaysOn>
+ <AutocompleteInput label="table.field.loc.locSts" optionText="name" filterToQuery={(val) => ({ name: val })} />
+ </ReferenceInput>,
+ <NumberInput source="row" label="table.field.loc.row" alwaysOn />,
+ <NumberInput source="bay" label="table.field.loc.bay" alwaysOn />,
+ <NumberInput source="lev" label="table.field.loc.lev" alwaysOn />,
<SearchInput source="condition" alwaysOn />,
- <DateInput label='common.time.after' source="timeStart" alwaysOn />,
- <DateInput label='common.time.before' source="timeEnd" alwaysOn />,
-
+ <ReferenceInput source="code" label="table.field.loc.code" reference="code" alwaysOn>
+ <AutocompleteInput label="table.field.loc.code" optionText="data" filterToQuery={(val) => ({ data: val })} />
+ </ReferenceInput>,
+ <DateInput label='common.time.after' source="timeStart" />,
+ <DateInput label='common.time.before' source="timeEnd" />,
<TextInput source="uuid" label="table.field.loc.uuid" />,
<ReferenceInput source="zoneId" label="table.field.loc.zoneId" reference="zone">
<AutocompleteInput label="table.field.loc.zoneId" optionText="name" filterToQuery={(val) => ({ name: val })} />
</ReferenceInput>,
- <TextInput source="locNo" label="table.field.loc.locNo" alwaysOn />,
<TextInput source="name" label="table.field.loc.name" />,
- <ReferenceInput source="code" label="table.field.loc.code" reference="code" alwaysOn>
- <AutocompleteInput label="table.field.loc.code" optionText="data" filterToQuery={(val) => ({ data: val })} />
- </ReferenceInput>,
- <ReferenceInput source="locSts" label="table.field.loc.locSts" reference="locSts" alwaysOn>
- <AutocompleteInput label="table.field.loc.locSts" optionText="name" filterToQuery={(val) => ({ name: val })} />
- </ReferenceInput>,
<NumberInput source="offset" label="table.field.loc.offset" />,
- <NumberInput source="row" label="table.field.loc.row" alwaysOn />,
- <NumberInput source="bay" label="table.field.loc.bay" alwaysOn />,
- <NumberInput source="lev" label="table.field.loc.lev" alwaysOn />,
<TextInput source="barcode" label="table.field.loc.barcode" />,
<TextInput source="zpallet" label="table.field.loc.zpallet" />,
<ReferenceInput source="locType" label="table.field.loc.locType" reference="locType">
@@ -95,11 +102,24 @@
/>,
]
+const LocBulkActionButtons = () => {
+ return (
+ <>
+ <BulkUpdateButton>
+ <LocBulkUpdateContent />
+ </BulkUpdateButton>
+ <BulkDeleteButton mutationMode={OPERATE_MODE} />
+ </>
+ );
+};
+
+
const LocList = () => {
const translate = useTranslate();
const [createDialog, setCreateDialog] = useState(false);
const [drawerVal, setDrawerVal] = useState(false);
+ const [initDialog, setInitDialog] = useState(false);
return (
<Box display="flex">
@@ -115,24 +135,29 @@
title={"menu.loc"}
empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
filters={filters}
- sort={{ field: "create_time", order: "desc" }}
+ sort={{ field: "locNo", order: "asc" }}
actions={(
<TopToolbar>
<FilterButton />
+ <Button label='page.loc.init' onClick={(event) => {
+ setInitDialog(true);
+ }}><CorporateFareIcon /></Button>
<MyCreateButton onClick={() => { setCreateDialog(true) }} />
<SelectColumnsButton preferenceKey='loc' />
<MyExportButton />
</TopToolbar>
)}
- perPage={25}
+ pagination={<Pagination rowsPerPageOptions={[10, 20, 50, 100, 300, 500]} />}
+ perPage={20}
>
<StyledDatagrid
preferenceKey='loc'
- bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
+ bulkActionButtons={<LocBulkActionButtons />}
rowClick={(id, resource, record) => false}
expand={() => <LocPanel />}
expandSingle={true}
- omit={['id', 'locType', 'uuid', 'updateBy', 'createTime', 'createBy', 'memo']}
+ omit={['id', 'locType', 'uuid', 'statusBool', 'updateBy', 'createTime', 'createBy', 'memo']}
+ rowSx={rowSx(drawerVal || null)}
>
<NumberField source="id" />
<TextField source="locNo" label="table.field.loc.locNo" />
@@ -146,7 +171,7 @@
<TextField source="data" />
</ReferenceField>
{/* <TextField source="compDirect$" label="table.field.loc.compDirect" sortable={false} /> */}
- <ReferenceField source="locSts" label="table.field.loc.locSts" reference="locSts" link={false} sortable={false}>
+ <ReferenceField source="locSts" label="table.field.loc.locSts" reference="locSts" link={false} sortable={true}>
<TextField source="name" />
</ReferenceField>
<NumberField source="row" label="table.field.loc.row" />
@@ -171,7 +196,7 @@
<TextField source="memo" label="common.field.memo" sortable={false} />
<WrapperField cellClassName="opt" label="common.field.opt">
<EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
- <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
+ <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={'optimistic'} />
</WrapperField>
</StyledDatagrid>
</List>
@@ -185,6 +210,10 @@
setDrawerVal={setDrawerVal}
>
</PageDrawer>
+ <LocInit
+ open={initDialog}
+ setOpen={setInitDialog}
+ />
</Box>
)
}
--
Gitblit v1.9.1