From 6103a8e5d2316af7fcf6b246e9e866e5216476f0 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期三, 18 三月 2026 11:11:34 +0800
Subject: [PATCH] #统一修改下拉框问题

---
 rsf-admin/src/page/components/DictSelect.jsx |   44 +++++++++++++++++++++++---------------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/rsf-admin/src/page/components/DictSelect.jsx b/rsf-admin/src/page/components/DictSelect.jsx
index df17b17..8f3531e 100644
--- a/rsf-admin/src/page/components/DictSelect.jsx
+++ b/rsf-admin/src/page/components/DictSelect.jsx
@@ -3,7 +3,7 @@
     useTranslate, useNotify, required
 } from 'react-admin';
 import request from '@/utils/request';
-import { Select, MenuItem, FormControl, InputLabel } from '@mui/material';
+import { Autocomplete, TextField, FormControl } from '@mui/material';
 
 const DictSelect = (props) => {
     const { dictTypeCode, label, group, value, onChange, ...params } = props;
@@ -29,33 +29,35 @@
         }
     };
 
-    const handleChange = (event) => {
-        const selectedValue = event.target.value;
+    const validValueObj = list.find(item => item.value === value) || null;
+
+    const handleChange = (event, newValue) => {
         if (onChange) {
-            onChange(event);
+            onChange({ target: { value: newValue ? newValue.value : '' } });
         }
     };
 
-    const validValue = list.some(item => item.value === value) ? value : '';
-
     return (
-        <FormControl fullWidth>
-            <InputLabel id="demo-select-small-label">{label}</InputLabel>
-            <Select
-                labelId="demo-select-small-label"
-                value={validValue}
-                variant="filled"
+        <FormControl fullWidth size="small">
+            <Autocomplete
+                value={validValueObj}
                 onChange={handleChange}
-                size='small'
-            >
-                {list.map((item) => (
-                    <MenuItem key={item.value} value={item.value}>
-                        {item.label}
-                    </MenuItem>
-                ))}
-            </Select>
+                options={list}
+                getOptionLabel={(option) => option.label || ''}
+                isOptionEqualToValue={(option, val) => option.value === val.value}
+                size="small"
+                ListboxProps={{ style: { maxHeight: '200px' } }}
+                renderInput={(p) => (
+                    <TextField
+                        {...p}
+                        label={label}
+                        variant="filled"
+                    />
+                )}
+                {...params}
+            />
         </FormControl>
     );
 };
 
-export default DictSelect;    
\ No newline at end of file
+export default DictSelect;
\ No newline at end of file

--
Gitblit v1.9.1