From ffc423dc5ab1318370ea8e3b63e9213172f805bb Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 11 六月 2025 09:46:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/devlop' into devlop
---
rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx | 100 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 79 insertions(+), 21 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx b/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx
index c185cbf..f150390 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,9 +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();
@@ -62,22 +59,31 @@
const notify = useNotify();
const [formData, setFormData] = useState({
- 'status': null
+ 'status': null,
+ 'stockLevel': null,
+ 'validWarn': null,
+ 'valid': null,
+ 'flagCheck': null,
});
- const { selectedIds } = useListContext();
+ const { selectedIds, onUnselectItems } = useListContext();
const handleClose = (event, reason) => {
if (reason !== "backdropClick") {
setOpen(false);
reset()
refresh();
+ onUnselectItems()
}
};
const reset = () => {
setFormData({
- 'status': null
+ 'status': null,
+ 'stockLevel': null,
+ 'validWarn': null,
+ 'valid': null,
+ 'flagCheck': null,
})
}
@@ -88,7 +94,7 @@
const handleChange = (value, name) => {
setFormData((prevData) => ({
...prevData,
- [name]: ['locType', 'type'].includes(name) ? value : +value
+ [name]: value
}));
};
@@ -98,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()
@@ -118,20 +127,69 @@
}
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"
+ defaultValue={1}
+ choices={[
+ { id: 0, name: ' 鍚�' },
+ { id: 1, name: ' 鏄�' },
+ ]}
+ />
+ </Grid>
+ }
</Grid>
</Box>
@@ -139,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>
--
Gitblit v1.9.1