From 58276de8b0a75f4ba80a2a237e4d7984c6c2768b Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期二, 25 三月 2025 18:04:05 +0800 Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop --- rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx | 92 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 75 insertions(+), 17 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx b/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx index 25a484e..8c10825 100644 --- a/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx @@ -43,7 +43,6 @@ } from '@mui/material'; import DialogCloseButton from "../../components/DialogCloseButton"; -import DictionarySelect from "../../components/DictionarySelect"; import { useForm, Controller, useWatch, FormProvider, useFormContext } from "react-hook-form"; import SaveIcon from '@mui/icons-material/Save'; import request from '@/utils/request'; @@ -52,7 +51,7 @@ import { DataGrid } from '@mui/x-data-grid'; import StatusSelectInput from "../../components/StatusSelectInput"; -const InitModal = ({ open, setOpen }) => { +const InitModal = ({ open, setOpen, fieldType }) => { const refresh = useRefresh(); const translate = useTranslate(); @@ -60,7 +59,11 @@ const notify = useNotify(); const [formData, setFormData] = useState({ - 'status': null + 'status': null, + 'stockLevel': null, + 'validWarn': null, + 'valid': null, + 'flagCheck': null, }); const { selectedIds, onUnselectItems } = useListContext(); @@ -76,7 +79,11 @@ const reset = () => { setFormData({ - 'status': null + 'status': null, + 'stockLevel': null, + 'validWarn': null, + 'valid': null, + 'flagCheck': null, }) } @@ -87,7 +94,7 @@ const handleChange = (value, name) => { setFormData((prevData) => ({ ...prevData, - [name]: ['locType', 'type'].includes(name) ? value : +value + [name]: value })); }; @@ -97,17 +104,20 @@ const newObj = removeEmptyKeys(value); return !_.isEmpty(newObj); } - return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value)); + return !_.isNil(value); }); } + const handleSubmit = async () => { const parmas = { - id: selectedIds, - matnr: removeEmptyKeys(formData) + ids: selectedIds, + matnr: { + ...removeEmptyKeys(formData) + } } - const res = await request.post(`/matnr/modify`, parmas); + const res = await request.post(`/matnr/batch/update`, parmas); if (res?.data?.code === 200) { handleClose() @@ -117,20 +127,68 @@ } 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}> - <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> + } + {fieldType === 'stockLevel' && + <Grid item xs={6}> + <SelectInput + label="table.field.matnr.stockLevel" + source="stockLevel" + onChange={(e) => handleChange(e.target.value, 'stockLevel')} + choices={[ + { id: 0, name: ' A' }, + { id: 1, name: ' B' }, + { id: 2, name: 'C' }, + ]} + validate={required()} + /> + </Grid> + } + {fieldType === 'validWarn' && + <Grid item xs={6}> + <NumberInput + onChange={(e) => handleChange(e.target.value, 'validWarn')} + label="table.field.matnr.validWarn" + source="validWarn" + /> + </Grid> + } + {fieldType === 'validWarn' && + <Grid item xs={6}> + <NumberInput + onChange={(e) => handleChange(e.target.value, 'valid')} + label="table.field.matnr.valid" + source="valid" + /> + </Grid> + } + {fieldType === 'flagCheck' && + <Grid item xs={6}> + <SelectInput + onChange={(e) => handleChange(e.target.value, 'flagCheck')} + label="table.field.matnr.flagCheck" + source="flagCheck" + choices={[ + { id: 0, name: ' 鍚�' }, + { id: 1, name: ' 鏄�' }, + ]} + /> + </Grid> + } </Grid> </Box> -- Gitblit v1.9.1