From 0d3a5be1512815a38f37ae81e7d9fc0948fd3f16 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期二, 25 三月 2025 13:54:57 +0800 Subject: [PATCH] 1 --- rsf-admin/src/page/basicInfo/loc/BatchModal.jsx | 44 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 35 insertions(+), 9 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx b/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx index a3448a2..4a4c023 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 }) => { const refresh = useRefresh(); const translate = useTranslate(); @@ -62,25 +63,29 @@ const notify = useNotify(); const [formData, setFormData] = useState({ + "warehouseId": null, "areaId": null, "type": null, 'status': null }); - const { selectedIds } = useListContext(); + const { selectedIds, onUnselectItems } = useListContext(); const handleClose = (event, reason) => { if (reason !== "backdropClick") { setOpen(false); reset() refresh(); + onUnselectItems() } }; const reset = () => { setFormData({ + "warehouseId": null, "areaId": null, "type": null, + "typeIds": null, 'status': null }) } @@ -94,6 +99,7 @@ ...prevData, [name]: value })); + refresh() }; const removeEmptyKeys = (obj) => { @@ -131,8 +137,25 @@ <Grid container spacing={2}> <Grid item xs={4}> <ReferenceInput + source="warehouseId" + reference="warehouse" + > + <AutocompleteInput + label="table.field.loc.warehouseId" + optionText="name" + onChange={(value) => handleChange(value, 'warehouseId')} + value={formData.warehouseId} + filterToQuery={(val) => ({ name: val })} + /> + </ReferenceInput> + + </Grid> + + <Grid item xs={4}> + <ReferenceInput source="areaId" reference="warehouseAreas" + filter={{ warehouseId: formData.warehouseId }} > <AutocompleteInput label="table.field.loc.areaId" @@ -146,14 +169,17 @@ </Grid> <Grid item xs={4}> - <DictionarySelect + {/* <DictionarySelect label={translate("table.field.loc.type")} name="type" value={formData.type} - onChange={(e) => handleChange(+e.target.value, 'type')} + onChange={(e) => handleChange(e.target.value, 'type')} size="small" dictTypeCode="sys_loc_type" - /> + /> */} + <ReferenceArrayInput source="typeIds" reference="locType" > + <SelectArrayInput label="table.field.loc.type" onChange={(e) => handleChange(e.target.value, 'typeIds')} /> + </ReferenceArrayInput> </Grid> <Grid item xs={4}> @@ -171,7 +197,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> @@ -180,4 +206,4 @@ ); } -export default InitModal; \ No newline at end of file +export default BatchModal; \ No newline at end of file -- Gitblit v1.9.1