#
luxiaotao1123
2024-09-18 ff23dad9cd3b86e926c66f33c3e4c86fa5e481e1
#
1个文件已修改
1个文件已添加
1个文件已删除
225 ■■■■ 已修改文件
zy-acs-flow/src/page/loc/InitButton.jsx 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/loc/LocInit.jsx 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/loc/LocList.jsx 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/loc/InitButton.jsx
File was deleted
zy-acs-flow/src/page/loc/LocInit.jsx
New file
@@ -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;
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>
    )
}