From b9d414bc2d61b4824ce6a019b1c10f526f71ced1 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 21 四月 2025 12:56:12 +0800 Subject: [PATCH] #修改 1. 新增DO单,DO单明细 --- rsf-admin/src/page/basicInfo/loc/BatchModal.jsx | 93 ++++++++++++++++++++++++++++++---------------- 1 files changed, 60 insertions(+), 33 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx b/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx index cee27c7..64cc36a 100644 --- a/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx +++ b/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx @@ -19,6 +19,7 @@ useCreateController, useListContext, useRefresh, + SelectArrayInput } from 'react-admin'; import { Dialog, @@ -38,7 +39,8 @@ TableCell, Tooltip, IconButton, - styled + styled, + } from '@mui/material'; @@ -53,8 +55,7 @@ import StatusSelectInput from "../../components/StatusSelectInput"; - -const InitModal = ({ open, setOpen }) => { +const BatchModal = ({ open, setOpen, fieldType }) => { const refresh = useRefresh(); const translate = useTranslate(); @@ -62,6 +63,7 @@ const notify = useNotify(); const [formData, setFormData] = useState({ + "warehouseId": null, "areaId": null, "type": null, 'status': null @@ -80,8 +82,10 @@ const reset = () => { setFormData({ + "warehouseId": null, "areaId": null, "type": null, + "typeIds": null, 'status': null }) } @@ -95,6 +99,7 @@ ...prevData, [name]: value })); + refresh() }; const removeEmptyKeys = (obj) => { @@ -123,48 +128,70 @@ } return ( - <Dialog open={open} maxWidth="md" fullWidth> + <Dialog open={open} maxWidth="xs" fullWidth> <Form onSubmit={handleSubmit}> <DialogCloseButton onClose={handleClose} /> <DialogTitle>{translate('toolbar.batch')}</DialogTitle> <DialogContent sx={{ mt: 2 }}> <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> <Grid container spacing={2}> - <Grid item xs={4}> - <ReferenceInput - source="areaId" - reference="warehouseAreas" - > - <AutocompleteInput - label="table.field.loc.areaId" - optionText="name" - onChange={(value) => handleChange(value, 'areaId')} - value={formData.areaId} - filterToQuery={(val) => ({ name: val })} - /> - </ReferenceInput> + {fieldType === 'warehouseId' && + <Grid item xs={6}> + <ReferenceInput + source="warehouseId" + reference="warehouse" + > + <AutocompleteInput + label="table.field.loc.warehouseId" + optionText="name" + value={formData.warehouseId} + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> + </Grid> + } + {fieldType === 'areaId' && + <Grid item xs={6}> + <ReferenceInput + source="areaId" + reference="warehouseAreas" + > + <AutocompleteInput + label="table.field.loc.areaId" + optionText="name" + onChange={(value) => handleChange(value, 'areaId')} + value={formData.areaId} + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> - </Grid> - - <Grid item xs={4}> - <DictionarySelect + </Grid> + } + {fieldType === 'typeIds' && + <Grid item xs={6}> + {/* <DictionarySelect label={translate("table.field.loc.type")} name="type" value={formData.type} onChange={(e) => handleChange(e.target.value, 'type')} size="small" dictTypeCode="sys_loc_type" - /> - </Grid> + /> */} + <ReferenceArrayInput source="typeIds" reference="locType" > + <SelectArrayInput label="table.field.loc.type" onChange={(e) => handleChange(e.target.value, 'typeIds')} /> + </ReferenceArrayInput> + </Grid> + } - <Grid item xs={4}> - <StatusSelectInput - onChange={(e) => handleChange(e.target.value, 'status')} - defaultValue={''} - require={false} - /> - </Grid> - + {fieldType === 'status' && + <Grid item xs={6}> + <StatusSelectInput + onChange={(e) => handleChange(e.target.value, 'status')} + defaultValue={''} + require={false} + /> + </Grid> + } </Grid> </Box> @@ -172,7 +199,7 @@ <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> <Button type="submit" variant="contained" startIcon={<SaveIcon />}> - 纭 + {translate('toolbar.confirm')} </Button> </Box> </DialogActions> @@ -181,4 +208,4 @@ ); } -export default InitModal; \ No newline at end of file +export default BatchModal; \ No newline at end of file -- Gitblit v1.9.1