From ff23dad9cd3b86e926c66f33c3e4c86fa5e481e1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 18 九月 2024 13:41:35 +0800
Subject: [PATCH] #
---
/dev/null | 30 -------
zy-acs-flow/src/page/loc/LocList.jsx | 12 ++
zy-acs-flow/src/page/loc/LocInit.jsx | 183 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 193 insertions(+), 32 deletions(-)
diff --git a/zy-acs-flow/src/page/loc/InitButton.jsx b/zy-acs-flow/src/page/loc/InitButton.jsx
deleted file mode 100644
index 28ed0c4..0000000
--- a/zy-acs-flow/src/page/loc/InitButton.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import * as React from 'react';
-import {
- Button
-} from 'react-admin';
-
-const InitButton = (props) => {
- const {
- onClick,
- label,
- icon,
- ...rest
- } = props;
-
- return (
- <Button
- label={label}
- onClick={handleClick}
- {...sanitizeRestProps(rest)}
- >
- {icon}
- </Button>
- );
-};
-
-const sanitizeRestProps = ({
- resource,
- ...rest
-}) => rest;
-
-export default InitButton;
diff --git a/zy-acs-flow/src/page/loc/LocInit.jsx b/zy-acs-flow/src/page/loc/LocInit.jsx
new file mode 100644
index 0000000..503cd2d
--- /dev/null
+++ b/zy-acs-flow/src/page/loc/LocInit.jsx
@@ -0,0 +1,183 @@
+import React, { useState, useRef, useEffect, useMemo } from "react";
+import {
+ CreateBase,
+ useTranslate,
+ TextInput,
+ NumberInput,
+ BooleanInput,
+ DateInput,
+ SaveButton,
+ SelectInput,
+ ReferenceInput,
+ ReferenceArrayInput,
+ AutocompleteInput,
+ Toolbar,
+ required,
+ useDataProvider,
+ useNotify,
+ Form,
+ useCreateController,
+} from 'react-admin';
+import {
+ Dialog,
+ DialogActions,
+ DialogContent,
+ DialogTitle,
+ Stack,
+ Grid,
+ Box,
+} from '@mui/material';
+import DialogCloseButton from "../components/DialogCloseButton";
+
+const LocInit = (props) => {
+ const { open, setOpen } = props;
+
+ const translate = useTranslate();
+ const notify = useNotify();
+
+ const handleClose = (event, reason) => {
+ if (reason !== "backdropClick") {
+ setOpen(false);
+ }
+ };
+
+ return (
+ <>
+ <Dialog
+ open={open}
+ onClose={handleClose}
+ aria-labelledby="form-dialog-title"
+ fullWidth
+ disableRestoreFocus
+ maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
+ >
+ <Form>
+ <DialogTitle id="form-dialog-title" sx={{
+ position: 'sticky',
+ top: 0,
+ backgroundColor: 'background.paper',
+ zIndex: 1000
+ }}
+ >
+ {translate('page.loc.init')}
+ <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}>
+ <DialogCloseButton onClose={handleClose} />
+ </Box>
+ </DialogTitle>
+ <DialogContent>
+ <Grid container rowSpacing={2} columnSpacing={2}>
+ <Grid item xs={6} display="flex" gap={1}>
+ <ReferenceInput
+ source="zoneId"
+ reference="zone"
+ >
+ <AutocompleteInput
+ label="table.field.loc.zoneId"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ validate={required()}
+ />
+ </ReferenceInput>
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.loc.locNo"
+ source="locNo"
+ parse={v => v}
+ validate={required()}
+ />
+ </Grid>
+ <Grid item xs={12} display="flex" gap={1}>
+ <Grid item xs={4} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.loc.row"
+ source="row"
+ />
+ </Grid>
+ <Grid item xs={4} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.loc.bay"
+ source="bay"
+ />
+ </Grid>
+ <Grid item xs={4} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.loc.lev"
+ source="lev"
+ />
+ </Grid>
+ </Grid>
+ <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}>
+ <SelectInput
+ label="table.field.loc.compDirect"
+ source="compDirect"
+ choices={[
+ { id: 1, name: '澶т簬' },
+ { id: 0, name: '灏忎簬' },
+ ]}
+ />
+ </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 })}
+ validate={required()}
+ />
+ </ReferenceInput>
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <NumberInput
+ label="table.field.loc.offset"
+ source="offset"
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.loc.barcode"
+ source="barcode"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <ReferenceInput
+ source="locType"
+ reference="locType"
+ >
+ <AutocompleteInput
+ label="table.field.loc.locType"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>
+ </Grid>
+ </Grid>
+ </DialogContent>
+ <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
+ <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} >
+ <SaveButton />
+ </Toolbar>
+ </DialogActions>
+ </Form>
+ </Dialog>
+ </>
+ )
+}
+
+export default LocInit;
\ 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 20bf815..eaf3fcd 100644
--- a/zy-acs-flow/src/page/loc/LocList.jsx
+++ b/zy-acs-flow/src/page/loc/LocList.jsx
@@ -30,6 +30,7 @@
ReferenceArrayInput,
AutocompleteInput,
DeleteButton,
+ Button,
} from 'react-admin';
import { Box, Typography, Card, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
@@ -42,8 +43,8 @@
import MyField from "../components/MyField";
import { PAGE_DRAWER_WIDTH, OPERATE_MODE } from '@/config/setting';
import * as Common from '@/utils/common';
-import InitButton from "./InitButton";
import RepartitionIcon from '@mui/icons-material/Repartition';
+import LocInit from "./LocInit";
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
@@ -103,6 +104,7 @@
const [createDialog, setCreateDialog] = useState(false);
const [drawerVal, setDrawerVal] = useState(false);
+ const [initDialog, setInitDialog] = useState(false);
return (
<Box display="flex">
@@ -122,7 +124,9 @@
actions={(
<TopToolbar>
<FilterButton />
- <InitButton label='page.loc.init' icon={<RepartitionIcon />} />
+ <Button label='page.loc.init' onClick={(event) => {
+ setInitDialog(true);
+ }}><RepartitionIcon /></Button>
<MyCreateButton onClick={() => { setCreateDialog(true) }} />
<SelectColumnsButton preferenceKey='loc' />
<MyExportButton />
@@ -189,6 +193,10 @@
setDrawerVal={setDrawerVal}
>
</PageDrawer>
+ <LocInit
+ open={initDialog}
+ setOpen={setInitDialog}
+ />
</Box>
)
}
--
Gitblit v1.9.1