From 95c82344c563b10f55ca6163a6f3299f0f025e0f Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 19 三月 2025 08:07:01 +0800
Subject: [PATCH] Merge branch 'front' into devlop

---
 rsf-admin/src/page/basicInfo/loc/BatchModal.jsx       |   67 +++++---
 rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx |   89 ++---------
 rsf-admin/src/page/basicInfo/loc/LocList.jsx          |   49 +-----
 rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx      |    2 
 rsf-admin/src/page/basicInfo/loc/InitModal.jsx        |   15 -
 rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx     |  151 ++++++++++++++++++
 rsf-admin/src/page/components/DictionarySelect.jsx    |    3 
 rsf-admin/src/page/components/StatusSelectInput.jsx   |    7 
 rsf-admin/src/i18n/zh.js                              |    1 
 rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx      |   31 +++
 rsf-admin/src/i18n/en.js                              |    1 
 rsf-admin/.env                                        |    4 
 rsf-admin/src/page/asnOrder/AsnOrderModal.jsx         |   22 +-
 13 files changed, 275 insertions(+), 167 deletions(-)

diff --git a/rsf-admin/.env b/rsf-admin/.env
index 9669b2c..a8ce658 100644
--- a/rsf-admin/.env
+++ b/rsf-admin/.env
@@ -1,3 +1,3 @@
-# VITE_BASE_IP=192.168.4.24
-VITE_BASE_IP=47.76.147.249
+VITE_BASE_IP=192.168.4.24
+# VITE_BASE_IP=47.76.147.249
 VITE_BASE_PORT=8080
diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js
index f0994e2..f338b7e 100644
--- a/rsf-admin/src/i18n/en.js
+++ b/rsf-admin/src/i18n/en.js
@@ -353,6 +353,7 @@
                 maxPack: "MaxPack",
                 flagLabelMange: "FlagLabelMange",
                 locAttrs: "LocAttrs",
+                useStatus: 'useStatus'
             },
             container: {
                 code: "Code",
diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js
index 0b3480c..3b6756e 100644
--- a/rsf-admin/src/i18n/zh.js
+++ b/rsf-admin/src/i18n/zh.js
@@ -352,6 +352,7 @@
                 startBay: "璧峰鍒�",
                 startLev: "璧峰灞�",
                 startRow: "璧峰鎺�",
+                useStatus: '搴撲綅鐘舵��'
             },
 
             container: {
diff --git a/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx b/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx
index 1b23e74..01da591 100644
--- a/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx
+++ b/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx
@@ -53,6 +53,7 @@
 import { Add, Edit, Delete } from '@mui/icons-material';
 import _ from 'lodash';
 import { DataGrid } from '@mui/x-data-grid';
+import DictionarySelect from "../components/DictionarySelect";
 
 const AsnOrderModal = (props) => {
     const { open, setOpen, asnId } = props;
@@ -84,8 +85,8 @@
 
     const [tabelData, setTableData] = useState([]);
 
-    const handleChange = (e) => {
-        const { name, value } = e.target;
+
+    const handleChange = (value, name) => {
         setFormData((prevData) => ({
             ...prevData,
             [name]: value
@@ -171,20 +172,19 @@
                     </Box>
                 </DialogTitle>
                 <DialogContent sx={{ mt: 2 }}>
-                    <Box component="form" sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
-                        <form>
+                    <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
+                        <Form>
                             <Grid container spacing={2}>
                                 <Grid item xs={4}>
-                                    <TextField
-                                        label={translate('table.field.asnOrder.type')}
+                                    <DictionarySelect
+                                        label={translate("table.field.asnOrder.type")}
                                         name="type"
                                         value={formData.type}
-                                        onChange={handleChange}
-                                        onBlur={requestSetHead}
-                                        variant="outlined"
+                                        onChange={(e) => handleChange(+e.target.value, 'type')}
                                         size="small"
-                                        required
+                                        dictTypeCode="sys_bill_type"
                                     />
+
                                 </Grid>
 
                                 {/* <Grid item xs={4}>
@@ -198,7 +198,7 @@
                                 />
                             </Grid> */}
                             </Grid>
-                        </form>
+                        </Form>
                     </Box>
 
                     <Box sx={{ mt: 2 }}>
diff --git a/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx b/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx
index 5e9cfb7..a3448a2 100644
--- a/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx
+++ b/rsf-admin/src/page/basicInfo/loc/BatchModal.jsx
@@ -50,7 +50,7 @@
 import { Add, Edit, Delete } from '@mui/icons-material';
 import _ from 'lodash';
 import { DataGrid } from '@mui/x-data-grid';
-
+import StatusSelectInput from "../../components/StatusSelectInput";
 
 
 
@@ -62,16 +62,28 @@
     const notify = useNotify();
 
     const [formData, setFormData] = useState({
-        "areaId": undefined,
-        "locType": "",
-        "type": ""
+        "areaId": null,
+        "type": null,
+        'status': null
     });
+
+    const { selectedIds } = useListContext();
 
     const handleClose = (event, reason) => {
         if (reason !== "backdropClick") {
             setOpen(false);
+            reset()
+            refresh();
         }
     };
+
+    const reset = () => {
+        setFormData({
+            "areaId": null,
+            "type": null,
+            'status': null
+        })
+    }
 
     const handleReset = (e) => {
         e.preventDefault();
@@ -80,20 +92,34 @@
     const handleChange = (value, name) => {
         setFormData((prevData) => ({
             ...prevData,
-            [name]: ['locType', 'type'].includes(name) ? value : +value
+            [name]: value
         }));
     };
 
+    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>
@@ -113,7 +139,6 @@
                                         optionText="name"
                                         onChange={(value) => handleChange(value, 'areaId')}
                                         value={formData.areaId}
-                                        validate={[required()]}
                                         filterToQuery={(val) => ({ name: val })}
                                     />
                                 </ReferenceInput>
@@ -122,28 +147,22 @@
 
                             <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"
-                                />
-                            </Grid>
-
-                            <Grid item xs={4}>
-                                <DictionarySelect
                                     label={translate("table.field.loc.type")}
                                     name="type"
                                     value={formData.type}
-                                    onChange={(e) => handleChange(e.target.value, 'type')}
+                                    onChange={(e) => handleChange(+e.target.value, 'type')}
                                     size="small"
-                                    validate={[required()]}
                                     dictTypeCode="sys_loc_type"
                                 />
                             </Grid>
 
+                            <Grid item xs={4}>
+                                <StatusSelectInput
+                                    onChange={(e) => handleChange(e.target.value, 'status')}
+                                    defaultValue={''}
+                                    require={false}
+                                />
+                            </Grid>
 
                         </Grid>
 
diff --git a/rsf-admin/src/page/basicInfo/loc/InitModal.jsx b/rsf-admin/src/page/basicInfo/loc/InitModal.jsx
index f0c4c48..80c6a2b 100644
--- a/rsf-admin/src/page/basicInfo/loc/InitModal.jsx
+++ b/rsf-admin/src/page/basicInfo/loc/InitModal.jsx
@@ -86,7 +86,7 @@
     const handleChange = (value, name) => {
         setFormData((prevData) => ({
             ...prevData,
-            [name]: ['locType', 'type'].includes(name) ? value : +value
+            [name]: value
         }));
     };
 
@@ -133,7 +133,6 @@
                                     value={formData.locType}
                                     onChange={(e) => handleChange(e.target.value, 'locType')}
                                     size="small"
-                                    validate={[required()]}
                                     dictTypeCode="sys_width_type"
                                 />
                             </Grid>
@@ -155,7 +154,7 @@
                                     label={translate("table.field.loc.startBay")}
                                     name="startBay"
                                     value={formData.startBay}
-                                    onChange={(e) => handleChange(e.target.value, 'startBay')}
+                                    onChange={(e) => handleChange(+e.target.value, 'startBay')}
                                     size="small"
                                     type="number"
                                     validate={[required()]}
@@ -167,7 +166,7 @@
                                     label={translate("table.field.loc.startLev")}
                                     name="startLev"
                                     value={formData.startLev}
-                                    onChange={(e) => handleChange(e.target.value, 'startLev')}
+                                    onChange={(e) => handleChange(+e.target.value, 'startLev')}
                                     size="small"
                                     type="number"
                                     validate={[required()]}
@@ -179,7 +178,7 @@
                                     label={translate("table.field.loc.startRow")}
                                     name="startRow"
                                     value={formData.startRow}
-                                    onChange={(e) => handleChange(e.target.value, 'startRow')}
+                                    onChange={(e) => handleChange(+e.target.value, 'startRow')}
                                     size="small"
                                     type="number"
                                     validate={[required()]}
@@ -191,7 +190,7 @@
                                     label={translate("table.field.loc.endBay")}
                                     name="endBay"
                                     value={formData.endBay}
-                                    onChange={(e) => handleChange(e.target.value, 'endBay')}
+                                    onChange={(e) => handleChange(+e.target.value, 'endBay')}
                                     size="small"
                                     type="number"
                                     validate={[required()]}
@@ -203,7 +202,7 @@
                                     label={translate("table.field.loc.endLev")}
                                     name="endLev"
                                     value={formData.endLev}
-                                    onChange={(e) => handleChange(e.target.value, 'endLev')}
+                                    onChange={(e) => handleChange(+e.target.value, 'endLev')}
                                     size="small"
                                     type="number"
                                     validate={[required()]}
@@ -215,7 +214,7 @@
                                     label={translate("table.field.loc.endRow")}
                                     name="endRow"
                                     value={formData.endRow}
-                                    onChange={(e) => handleChange(e.target.value, 'endRow')}
+                                    onChange={(e) => handleChange(+e.target.value, 'endRow')}
                                     size="small"
                                     type="number"
                                     validate={[required()]}
diff --git a/rsf-admin/src/page/basicInfo/loc/LocList.jsx b/rsf-admin/src/page/basicInfo/loc/LocList.jsx
index b9b2578..720770f 100644
--- a/rsf-admin/src/page/basicInfo/loc/LocList.jsx
+++ b/rsf-admin/src/page/basicInfo/loc/LocList.jsx
@@ -142,22 +142,22 @@
                     }
                     rowClick={() => false}
                     expand={() => <LocPanel />}
-                    omit={['id', 'createTime', 'createBy', 'memo']}
+                    omit={['id', 'createTime', 'createBy', 'memo', 'updateTime', 'updateBy']}
                 >
                     <NumberField source="id" />
                     <NumberField source="warehouseId$" label="table.field.loc.warehouseId" />
                     <NumberField source="areaId$" label="table.field.loc.areaId" />
                     <TextField source="code" label="table.field.loc.code" />
-                    <TextField source="type" label="table.field.loc.type" />
+                    <TextField source="type$" label="table.field.loc.type" />
                     <TextField source="name" label="table.field.loc.name" />
                     <NumberField source="flagLogic" label="table.field.loc.flagLogic" />
                     <TextField source="fucAtrrs" label="table.field.loc.fucAtrrs" />
                     <TextField source="barcode" label="table.field.loc.barcode" />
                     <TextField source="unit" label="table.field.loc.unit" />
-                    <TextField source="size" label="table.field.loc.length" />
-                    <TextField source="size" label="table.field.loc.width" />
-                    <TextField source="size" label="table.field.loc.height" />
-                    <NumberField source="lrow" label="table.field.loc.row" />
+                    <TextField source="length" label="table.field.loc.length" />
+                    <TextField source="width" label="table.field.loc.width" />
+                    <TextField source="height" label="table.field.loc.height" />
+                    <NumberField source="row" label="table.field.loc.row" />
                     <NumberField source="col" label="table.field.loc.col" />
                     <NumberField source="lev" label="table.field.loc.lev" />
                     <NumberField source="channel" label="table.field.loc.channel" />
@@ -165,6 +165,7 @@
                     <NumberField source="maxPack" label="table.field.loc.maxPack" />
                     <NumberField source="flagLabelMange" label="table.field.loc.flagLabelMange" />
                     <TextField source="locAttrs" label="table.field.loc.locAttrs" />
+                    <TextField source="useStatus$" label="table.field.loc.useStatus" />
                     <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}>
                         <TextField source="nickname" />
                     </ReferenceField>
@@ -228,8 +229,7 @@
     const record = useRecordContext();
     const notify = useNotify();
     const refresh = useRefresh();
-    const { selectedIds } = useListContext();
-    console.log(selectedIds)
+
 
     const [createDialog, setCreateDialog] = useState(false);
 
@@ -246,35 +246,4 @@
         </>
 
     )
-}
-const CustomBulkActionButton = () => {
-    const { selectedIds } = useListContext();
-    const notify = useNotify();
-    const refresh = useRefresh();
-
-    const handleCustomBulkAction = async () => {
-        if (selectedIds.length === 0) {
-            notify('璇烽�夋嫨瑕佹搷浣滅殑璁板綍');
-            return;
-        }
-        // 杩欓噷鍐欏叿浣撶殑鎵归噺鎿嶄綔閫昏緫锛屼緥濡傚悜鏈嶅姟鍣ㄥ彂閫佽姹�
-        try {
-            const res = await request.post('/loc/bulk-action', { ids: selectedIds });
-            if (res?.data?.code === 200) {
-                refresh();
-                notify('鎵归噺鎿嶄綔鎴愬姛');
-            } else {
-                notify(res.data.msg);
-            }
-        } catch (error) {
-            notify('鎵归噺鎿嶄綔澶辫触锛岃绋嶅悗閲嶈瘯');
-        }
-    };
-
-    return (
-        <Button onClick={handleCustomBulkAction} label="鑷畾涔夋壒閲忔搷浣�">
-            {/* 鍙互娣诲姞鑷畾涔夊浘鏍� */}
-            <EditIcon />
-        </Button>
-    );
-};
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx b/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx
new file mode 100644
index 0000000..c185cbf
--- /dev/null
+++ b/rsf-admin/src/page/basicInfo/matnr/BatchModal.jsx
@@ -0,0 +1,151 @@
+import React, { useState, useRef, useEffect, useMemo } from "react";
+import {
+    CreateBase,
+    useTranslate,
+    TextInput,
+    NumberInput,
+    BooleanInput,
+    DateInput,
+    SaveButton,
+    SelectInput,
+    ReferenceInput,
+    ReferenceArrayInput,
+    AutocompleteInput,
+    Toolbar,
+    required,
+    useDataProvider,
+    useNotify,
+    Form,
+    useCreateController,
+    useListContext,
+    useRefresh,
+} from 'react-admin';
+import {
+    Dialog,
+    DialogActions,
+    DialogContent,
+    DialogTitle,
+    Grid,
+    TextField,
+    Box,
+    Button,
+    Paper,
+    TableContainer,
+    Table,
+    TableHead,
+    TableBody,
+    TableRow,
+    TableCell,
+    Tooltip,
+    IconButton,
+    styled
+
+
+} 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';
+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 }) => {
+    const refresh = useRefresh();
+    const translate = useTranslate();
+
+
+    const notify = useNotify();
+
+    const [formData, setFormData] = useState({
+        'status': null
+    });
+
+    const { selectedIds } = useListContext();
+
+    const handleClose = (event, reason) => {
+        if (reason !== "backdropClick") {
+            setOpen(false);
+            reset()
+            refresh();
+        }
+    };
+
+    const reset = () => {
+        setFormData({
+            'status': null
+        })
+    }
+
+    const handleReset = (e) => {
+        e.preventDefault();
+    };
+
+    const handleChange = (value, name) => {
+        setFormData((prevData) => ({
+            ...prevData,
+            [name]: ['locType', 'type'].includes(name) ? value : +value
+        }));
+    };
+
+    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 parmas = {
+            id: selectedIds,
+            matnr: removeEmptyKeys(formData)
+        }
+
+        const res = await request.post(`/matnr/modify`, parmas);
+        if (res?.data?.code === 200) {
+            handleClose()
+
+        } else {
+            notify(res.data.msg);
+        }
+    }
+
+    return (
+        <Dialog open={open} maxWidth="md" 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>
+                        </Grid>
+
+                    </Box>
+                </DialogContent>
+                <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 />}>
+                            纭
+                        </Button>
+                    </Box>
+                </DialogActions>
+            </Form>
+        </Dialog>
+    );
+}
+
+export default InitModal;
\ No newline at end of file
diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx
index cb35859..bffec91 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrEdit.jsx
@@ -90,7 +90,7 @@
                 defaultValues={{}}
             // validate={(values) => { }}
             >
-                <Grid container width={{ xs: '20%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
+                <Grid container rowSpacing={3} columnSpacing={3}>
 
                     <Grid item xs={12} md={10}>
                         <Typography variant="h6" gutterBottom>
diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
index 4182da5..af3b2c8 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
@@ -50,7 +50,9 @@
 import MatListAside from './MatnrListAside';
 import { display, height } from "@mui/system";
 import DashboardIcon from '@mui/icons-material/Dashboard';
+import EditIcon from '@mui/icons-material/Edit';
 import request from '@/utils/request';
+import BatchModal from './BatchModal';
 
 const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
     '& .css-1vooibu-MuiSvgIcon-root': {
@@ -64,7 +66,7 @@
         width: '200px'
     },
     '& .RaList-main': {
-        minHeight: '80vh'
+        minHeight: '90vh'
     },
     '& .column-name': {
     },
@@ -147,7 +149,7 @@
     const { isLoading } = useListContext();
 
     return (
-        <Box sx={{ position: 'relative', minHeight: "40vh", }}>
+        <Box sx={{ position: 'relative', minHeight: "60vh", }}>
             {isLoading && (
                 <LinearProgress
                     sx={{
@@ -162,7 +164,7 @@
 
             <StyledDatagrid
                 preferenceKey='matnr'
-                bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
+                bulkActionButtons={<> <BatchButton /><BulkDeleteButton mutationMode={OPERATE_MODE} /></>}
                 rowClick={(id, resource, record) => false}
                 expand={() => <MatnrPanel />}
                 expandSingle={true}
@@ -304,4 +306,27 @@
             </Button>)
 
     )
+}
+
+const BatchButton = () => {
+    const record = useRecordContext();
+    const notify = useNotify();
+    const refresh = useRefresh();
+
+
+    const [createDialog, setCreateDialog] = useState(false);
+
+    return (
+        <>
+            <Button onClick={() => setCreateDialog(true)} label={"toolbar.batch"}>
+                <EditIcon />
+            </Button>
+
+            <BatchModal
+                open={createDialog}
+                setOpen={setCreateDialog}
+            />
+        </>
+
+    )
 }
\ No newline at end of file
diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx
index e20ce92..3a836ee 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx
@@ -11,41 +11,25 @@
 import { RichTreeView } from "@mui/x-tree-view/RichTreeView";
 import { TreeItem2 } from "@mui/x-tree-view/TreeItem2";
 
+
 const MatListAside = () => {
     const theme = useTheme();
     const notify = useNotify();
     const { setFilters } = useListContext(); // 鑾峰彇鍒楄〃涓婁笅鏂�
     const [selectedOption, setSelectedOption] = useState(null);
     const [treeData, setTreeData] = useState([]);
-    // 鐢ㄤ簬绠$悊灞曞紑椤圭殑鐘舵��
-    const [expandedItems, setExpandedItems] = useState([]);
-
-    // 閫掑綊鏀堕泦鎵�鏈夎妭鐐圭殑 id
-    const collectAllNodeIds = (nodes) => {
-        let allIds = [];
-        nodes.forEach((node) => {
-            allIds.push(node.id.toString());
-            if (node.children && Array.isArray(node.children)) {
-                allIds = allIds.concat(collectAllNodeIds(node.children));
-            }
-        });
-        return allIds;
-    };
+    const [defaultIds, setDefaultIds] = useState(['29']);
 
     const haveChildren = (item) => {
-        // 濡傛灉 item 鏄竴涓暟缁勶紝閬嶅巻鏁扮粍涓殑姣忎釜鍏冪礌
         if (Array.isArray(item)) {
             return item.map((k) => haveChildren(k));
         }
 
-        // 濡傛灉 item 鏄竴涓璞�
         if (item && typeof item === 'object') {
-            // 灏� id 杞崲涓哄瓧绗︿覆
             if (item.id !== undefined) {
                 item.id = item.id.toString();
             }
 
-            // 濡傛灉瀛樺湪 children锛岄�掑綊澶勭悊 children
             if (item.children && Array.isArray(item.children)) {
                 item.children = haveChildren(item.children);
             }
@@ -53,16 +37,17 @@
 
         return item;
     };
-
     useEffect(() => {
         request.post('/matnrGroup/tree')
             .then(res => {
                 if (res?.data?.code === 200) {
                     let data = res.data.data;
-                    let items = haveChildren(data);
-                    setTreeData(items);
-                    // 褰撴爲鏁版嵁鏇存柊鏃讹紝鏇存柊灞曞紑椤圭姸鎬�
-                    setExpandedItems(collectAllNodeIds(items));
+                    let items = haveChildren(data)
+
+                    setTreeData(items)
+                    setDefaultIds([items.at(0).id])
+
+
                 } else {
                     notify(res.data.msg);
                 }
@@ -70,56 +55,15 @@
             .catch(error => {
                 notify('Error fetching tree data');
             });
+
     }, []);
-
-    const treeData1 = [
-        {
-            id: '19',
-            label: '鍗婃垚鍝� ',
-            editable: true,
-            children: [
-                {
-                    id: 'grid-community',
-                    label: '@mui/x-data-grid',
-                    editable: true,
-                    children: [
-                        { id: 'grid-community22', label: '@mui/x-data-grid', editable: true },
-                    ],
-                },
-                { id: 'grid-pro', label: '@mui/x-data-grid-pro', editable: true },
-                { id: 'grid-premium', label: '@mui/x-data-grid-premium', editable: true },
-            ],
-        },
-        {
-            id: '18',
-            label: '鍘熸潗鏂�',
-        },
-        {
-            id: 'charts',
-            label: 'Charts',
-            children: [{ id: 'charts-community', label: '@mui/x-charts' }],
-        },
-        {
-            id: 'tree-view',
-            label: 'Tree View',
-            children: [{ id: 'tree-view-community', label: '@mui/x-tree-view' }],
-        },
-        {
-            id: 'tree-view2',
-            label: 'Tree View3',
-            children: [{ id: 'tree-view-community1', label: '@mui/x-tree-view' }],
-        },
-    ];
-
     const handleNodeSelect = (event, nodeId) => {
-        console.log('Selected Node ID:', nodeId);
         setFilters({ groupId: nodeId });
-        // 鍦ㄨ繖閲屽彲浠ユ牴鎹� nodeId 鏇存柊涓诲唴瀹瑰尯鍩�
     };
-
     const handleSearch = () => {
         console.log('Search Input:', selectedOption);
     };
+
 
     const CustomCheckbox = React.forwardRef(function CustomCheckbox(props, ref) {
         return <input type="checkbox" ref={ref} {...props} />;
@@ -136,6 +80,7 @@
             />
         );
     });
+
 
     return (
         <Card
@@ -154,18 +99,16 @@
                 <SavedQueriesList icon={<BookmarkIcon />} />
                 <FilterLiveSearch source="condition" />
                 <RichTreeView
-                    // 浣跨敤 expandedItems 鎺у埗灞曞紑鐘舵��
-                    expandedItems={expandedItems}
-                    // 澶勭悊灞曞紑椤圭姸鎬佺殑鍙樺寲
-                    onExpandedItemsChange={(newExpandedItems) => setExpandedItems(newExpandedItems)}
+                    defaultExpandedItems={defaultIds}
                     expansionTrigger="iconContainer"
                     items={treeData}
                     slots={CustomTreeItem}
                     onItemClick={handleNodeSelect} // 鐩戝惉鑺傜偣鐐瑰嚮浜嬩欢
                 />
+
             </CardContent>
         </Card>
-    );
-};
+    )
+}
 
-export default MatListAside;
\ No newline at end of file
+export default MatListAside;
diff --git a/rsf-admin/src/page/components/DictionarySelect.jsx b/rsf-admin/src/page/components/DictionarySelect.jsx
index 43dc811..2523c5d 100644
--- a/rsf-admin/src/page/components/DictionarySelect.jsx
+++ b/rsf-admin/src/page/components/DictionarySelect.jsx
@@ -9,7 +9,6 @@
 
 const DictionarySelect = (props) => {
     const { dictTypeCode, name, ...parmas } = props;
-    const { selectedIds } = useListContext();
     const translate = useTranslate();
     const notify = useNotify();
     const [list, setList] = useState([])
@@ -25,7 +24,7 @@
             setList(res.data.data.records.map((item) => {
                 return {
                     id: item.value,
-                    name: item.value
+                    name: item.label
                 }
             }))
         } else {
diff --git a/rsf-admin/src/page/components/StatusSelectInput.jsx b/rsf-admin/src/page/components/StatusSelectInput.jsx
index 46f787c..11031ca 100644
--- a/rsf-admin/src/page/components/StatusSelectInput.jsx
+++ b/rsf-admin/src/page/components/StatusSelectInput.jsx
@@ -5,20 +5,21 @@
 } from 'react-admin';
 
 const StatusSelectInput = (props) => {
+    const { require = true, defaultValue = 1, ...rest } = props
     const translate = useTranslate();
 
     return (
         <SelectInput
             label={translate('common.field.status')}
             source="status"
-            validate={[required()]}
+            validate={[require && required()]}
             choices={[
                 { id: '1', name: 'common.enums.statusTrue' },
                 { id: '0', name: 'common.enums.statusFalse' },
             ]}
-            defaultValue={1}
+            defaultValue={defaultValue}
             helperText={false}
-            {...props}
+            {...rest}
         />
     )
 }

--
Gitblit v1.9.1