From 0962e8e8675a1707ced3237170984498d688f246 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 28 五月 2025 12:38:42 +0800
Subject: [PATCH] 往来企业添加类型搜索 是否免检,添加默认值
---
rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx | 93 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 76 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..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,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,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>
--
Gitblit v1.9.1