From 14466bd111a43a723e0bdbe945c31e3993e7ab60 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 18 九月 2024 15:38:39 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/loc/LocInit.jsx | 139 ++++++++++++++++++++++++++-------------------- 1 files changed, 78 insertions(+), 61 deletions(-) diff --git a/zy-acs-flow/src/page/loc/LocInit.jsx b/zy-acs-flow/src/page/loc/LocInit.jsx index 503cd2d..d57670b 100644 --- a/zy-acs-flow/src/page/loc/LocInit.jsx +++ b/zy-acs-flow/src/page/loc/LocInit.jsx @@ -1,12 +1,10 @@ import React, { useState, useRef, useEffect, useMemo } from "react"; import { - CreateBase, useTranslate, TextInput, NumberInput, BooleanInput, DateInput, - SaveButton, SelectInput, ReferenceInput, ReferenceArrayInput, @@ -16,7 +14,6 @@ useDataProvider, useNotify, Form, - useCreateController, } from 'react-admin'; import { Dialog, @@ -26,8 +23,11 @@ Stack, Grid, Box, + Button, } from '@mui/material'; import DialogCloseButton from "../components/DialogCloseButton"; +import CheckIcon from '@mui/icons-material/Check'; +import request from '@/utils/request' const LocInit = (props) => { const { open, setOpen } = props; @@ -41,6 +41,20 @@ } }; + const onSubmit = (data) => { + request.post('/loc/init', { ...data }).then(res => { + const { code, msg, data } = res.data; + if (code === 200) { + setOpen(false); + notify('common.response.success', { type: 'success' }); + } else { + notify(msg, { type: 'error', messageArgs: { _: msg } }); + } + }).catch(error => { + notify(error, { type: 'error', messageArgs: { _: error } }); + }) + }; + return ( <> <Dialog @@ -51,7 +65,7 @@ disableRestoreFocus maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' > - <Form> + <Form onSubmit={onSubmit}> <DialogTitle id="form-dialog-title" sx={{ position: 'sticky', top: 0, @@ -80,56 +94,6 @@ </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" @@ -144,15 +108,68 @@ </Grid> <Grid item xs={6} display="flex" gap={1}> <NumberInput - label="table.field.loc.offset" - source="offset" + label="page.loc.start.row" + source="startRow" + validate={required()} /> </Grid> <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.loc.barcode" - source="barcode" - parse={v => v} + <NumberInput + label="page.loc.end.row" + source="endRow" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="page.loc.start.bay" + source="startBay" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="page.loc.end.bay" + source="endBay" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="page.loc.start.lev" + source="startLev" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="page.loc.end.lev" + source="endLev" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="page.loc.levOffset" + source="levOffset" + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="page.loc.bottomOffset" + source="bottom" + validate={required()} + /> + </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}> @@ -171,7 +188,7 @@ </DialogContent> <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > - <SaveButton /> + <Button variant="contained" type="submit" startIcon={<CheckIcon />}>{translate('ra.action.confirm')}</Button> </Toolbar> </DialogActions> </Form> -- Gitblit v1.9.1