From 53411e80007ce3a1cc268141a4cf7495fa6d265a Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 21 三月 2025 10:59:07 +0800
Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
---
rsf-admin/src/page/basicInfo/loc/BatchModal.jsx | 103 +++++++++++++++++++++++++++++++++++++--------------
1 files changed, 74 insertions(+), 29 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx b/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx
index 5e9cfb7..92b5fe3 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';
@@ -50,8 +52,7 @@
import { Add, Edit, Delete } from '@mui/icons-material';
import _ from 'lodash';
import { DataGrid } from '@mui/x-data-grid';
-
-
+import StatusSelectInput from "../../components/StatusSelectInput";
const InitModal = ({ open, setOpen }) => {
@@ -62,16 +63,32 @@
const notify = useNotify();
const [formData, setFormData] = useState({
- "areaId": undefined,
- "locType": "",
- "type": ""
+ "warehouseId": null,
+ "areaId": null,
+ "type": null,
+ 'status': null
});
+
+ 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
+ })
+ }
const handleReset = (e) => {
e.preventDefault();
@@ -80,20 +97,35 @@
const handleChange = (value, name) => {
setFormData((prevData) => ({
...prevData,
- [name]: ['locType', 'type'].includes(name) ? value : +value
+ [name]: value
}));
+ refresh()
};
+ const removeEmptyKeys = (obj) => {
+ return _.pickBy(obj, (value) => {
+ if (_.isObject(value)) {
+ const newObj = removeEmptyKeys(value);
+ return !_.isEmpty(newObj);
+ }
+ return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value));
+ });
+ }
+
const handleSubmit = async () => {
- const res = await request.post(`/loc/init`, formData);
+ const parmas = {
+ id: selectedIds,
+ loc: removeEmptyKeys(formData)
+ }
+
+ const res = await request.post(`/loc/modify`, parmas);
if (res?.data?.code === 200) {
- setOpen(false);
- refresh();
+ handleClose()
+
} else {
notify(res.data.msg);
}
}
-
return (
<Dialog open={open} maxWidth="md" fullWidth>
@@ -105,15 +137,14 @@
<Grid container spacing={2}>
<Grid item xs={4}>
<ReferenceInput
- source="areaId"
- reference="warehouseAreas"
+ source="warehouseId"
+ reference="warehouse"
>
<AutocompleteInput
- label="table.field.loc.areaId"
+ label="table.field.loc.warehouseId"
optionText="name"
- onChange={(value) => handleChange(value, 'areaId')}
- value={formData.areaId}
- validate={[required()]}
+ onChange={(value) => handleChange(value, 'warehouseId')}
+ value={formData.warehouseId}
filterToQuery={(val) => ({ name: val })}
/>
</ReferenceInput>
@@ -121,29 +152,43 @@
</Grid>
<Grid item xs={4}>
- <DictionarySelect
- label={translate("table.field.loc.locType")}
- name="locType"
- value={formData.locType}
- onChange={(e) => handleChange(e.target.value, 'locType')}
- size="small"
- validate={[required()]}
- dictTypeCode="sys_width_type"
- />
+ <ReferenceInput
+ source="areaId"
+ reference="warehouseAreas"
+ filter={{ warehouseId: formData.warehouseId }}
+ >
+ <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
+ {/* <DictionarySelect
label={translate("table.field.loc.type")}
name="type"
value={formData.type}
onChange={(e) => handleChange(e.target.value, 'type')}
size="small"
- validate={[required()]}
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}>
+ <StatusSelectInput
+ onChange={(e) => handleChange(e.target.value, 'status')}
+ defaultValue={''}
+ require={false}
+ />
+ </Grid>
</Grid>
--
Gitblit v1.9.1