From e96aaddc59b17e86beb08cc8f3aa64957cdd57cf Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 19 三月 2026 15:45:04 +0800
Subject: [PATCH] #备货

---
 rsf-admin/src/page/components/WarehouseSelect.jsx |   56 +++++++++++++++++++++++---------------------------------
 1 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/rsf-admin/src/page/components/WarehouseSelect.jsx b/rsf-admin/src/page/components/WarehouseSelect.jsx
index 33ead33..b09fee1 100644
--- a/rsf-admin/src/page/components/WarehouseSelect.jsx
+++ b/rsf-admin/src/page/components/WarehouseSelect.jsx
@@ -1,12 +1,11 @@
 import { useState, useEffect } from 'react';
 import {
-    useTranslate, useNotify, required
+    useTranslate, useNotify, required, AutocompleteInput
 } from 'react-admin';
 import request from '@/utils/request';
-import { Select, MenuItem, FormControl, InputLabel } from '@mui/material';
 
 const WarehouseSelect = (props) => {
-    const { dictTypeCode, label, value, onChange, ...params } = props;
+    const { dictTypeCode, label, name, validate, onChange, ...params } = props;
     const translate = useTranslate();
     const notify = useNotify();
     const [list, setList] = useState([]);
@@ -16,7 +15,7 @@
     }, [dictTypeCode]);
 
     const http = async () => {
-        const res = await request.post('/warehouseAreas/page', {current: 1, pageSize: 100});
+        const res = await request.post('/warehouseAreas/page', { current: 1, pageSize: 100 });
         if (res?.data?.code === 200) {
             setList(res.data.data.records.map((item) => {
                 return {
@@ -29,36 +28,27 @@
         }
     };
 
-    const handleChange = (event) => {
-        const selectedValue = event.target.value;
-        console.log(event);
-        if (onChange) {
-            onChange(event);
-        }
-    };
-
-    const validValue = list.some(item => item.id === value) ? value : '';
-
     return (
-        <FormControl fullWidth>
-            <InputLabel id="demo-select-small-label">{label}</InputLabel>
-            <Select
-                labelId="demo-select-small-label"
-                value={validValue}
-                variant="filled"
-                onChange={handleChange}
-                size='small'
-            >
-                {list.map((item) => (
-                    <MenuItem
-                        key={item.id}
-                        value={item.id}>
-                        {item.name}
-                    </MenuItem>
-                ))}
-            </Select>
-        </FormControl>
+        <AutocompleteInput
+            source={name}
+            label={label}
+            choices={list}
+            validate={validate}
+            onChange={(val) => {
+                if (onChange) {
+                    onChange({ target: { value: val } });
+                }
+            }}
+            options={{
+                ListboxProps: {
+                    style: { maxHeight: '200px' }
+                },
+                ...(params.options || {})
+            }}
+            fullWidth
+            {...params}
+        />
     );
 };
 
-export default WarehouseSelect;    
\ No newline at end of file
+export default WarehouseSelect;
\ No newline at end of file

--
Gitblit v1.9.1