From 014270352f8e19b51bbb4367ae2ff256050a30a2 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 22 四月 2025 14:03:42 +0800
Subject: [PATCH] #修改优化   1. 字典优化修改   2. 编码规则优化   3. 出库单编码生成为空问题修复

---
 rsf-admin/src/page/warehouseAreas/BatchModal.jsx |   70 +++++++++++++++++++++++++++-------
 1 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/rsf-admin/src/page/warehouseAreas/BatchModal.jsx b/rsf-admin/src/page/warehouseAreas/BatchModal.jsx
index 34ebb10..7b8558c 100644
--- a/rsf-admin/src/page/warehouseAreas/BatchModal.jsx
+++ b/rsf-admin/src/page/warehouseAreas/BatchModal.jsx
@@ -51,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();
 
@@ -59,7 +59,9 @@
     const notify = useNotify();
 
     const [formData, setFormData] = useState({
-        'status': null
+        'status': null,
+        'wareId': null,
+        'flagMix': null,
     });
 
     const { selectedIds, onUnselectItems } = useListContext();
@@ -75,7 +77,9 @@
 
     const reset = () => {
         setFormData({
-            'status': null
+            'status': null,
+            'wareId': null,
+            'flagMix': null,
         })
     }
 
@@ -96,17 +100,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,
+            warehouseAreas: {
+                ...removeEmptyKeys(formData)
+            }
         }
 
-        const res = await request.post(`/matnr/modify`, parmas);
+        const res = await request.post(`/warehouseAreas/batch/update`, parmas);
         if (res?.data?.code === 200) {
             handleClose()
 
@@ -116,20 +123,53 @@
     }
 
     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 === 'flagMix' &&
+                                <Grid item xs={6}>
+                                    <SelectInput
+                                        label="table.field.warehouseAreas.flagMix"
+                                        source="flagMix"
+                                        validate={[required()]}
+                                        onChange={(e) => handleChange(e.target.value, 'flagMix')}
+                                        choices={[
+                                            { id: 0, name: '鍚�' },
+                                            { id: 1, name: '鏄�' },
+                                        ]}
+                                    />
+                                </Grid>
+                            }
+                            {fieldType === 'wareId' &&
+                                <Grid item xs={6}>
+                                    <ReferenceInput
+                                        source="warehouseId"
+                                        reference="warehouse"
+
+                                    >
+                                        <AutocompleteInput
+                                            onChange={(value) => handleChange(value, 'warehouseId')}
+                                            label="table.field.warehouseAreas.wareId"
+                                            optionText="name"
+                                            validate={[required()]}
+                                            filterToQuery={(val) => ({ name: val })}
+                                        />
+                                    </ReferenceInput>
+                                </Grid>
+                            }
                         </Grid>
 
                     </Box>

--
Gitblit v1.9.1