From 4d5c3bd8bfea7a5ae0b3cd606156a1e83e633bd9 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 18 三月 2026 12:37:22 +0800
Subject: [PATCH] lsh#

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

diff --git a/rsf-admin/src/page/components/DictSelect.jsx b/rsf-admin/src/page/components/DictSelect.jsx
index 72c9d76..8f3531e 100644
--- a/rsf-admin/src/page/components/DictSelect.jsx
+++ b/rsf-admin/src/page/components/DictSelect.jsx
@@ -1,12 +1,12 @@
 import { useState, useEffect } from 'react';
 import {
-    useTranslate, useNotify
+    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, value, onChange, ...params } = props;
+    const { dictTypeCode, label, group, value, onChange, ...params } = props;
     const translate = useTranslate();
     const notify = useNotify();
     const [list, setList] = useState([]);
@@ -16,7 +16,7 @@
     }, [dictTypeCode]);
 
     const http = async () => {
-        const res = await request.post('/dictData/page', { dictTypeCode });
+        const res = await request.post('/dictData/page', { dictTypeCode, group });
         if (res?.data?.code === 200) {
             setList(res.data.data.records.map((item) => {
                 return {
@@ -29,32 +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}
+        <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