From b30fa5efb91d667ed67feacc3c4888cbbd578e74 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期五, 21 三月 2025 14:46:36 +0800 Subject: [PATCH] fix:物料分组搜索 --- rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx index 3a836ee..9f4d75c 100644 --- a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx @@ -4,10 +4,11 @@ SavedQueriesList, FilterLiveSearch, useNotify, - useListContext + useListContext, + SearchInput } from 'react-admin'; import BookmarkIcon from '@mui/icons-material/BookmarkBorder'; -import { Box, Typography, Card, CardContent, useTheme, TextField } from '@mui/material'; +import { Box, Typography, Card, CardContent, useTheme, Input } from '@mui/material'; import { RichTreeView } from "@mui/x-tree-view/RichTreeView"; import { TreeItem2 } from "@mui/x-tree-view/TreeItem2"; @@ -19,6 +20,7 @@ const [selectedOption, setSelectedOption] = useState(null); const [treeData, setTreeData] = useState([]); const [defaultIds, setDefaultIds] = useState(['29']); + const [condition, setCondition] = useState(''); const haveChildren = (item) => { if (Array.isArray(item)) { @@ -38,15 +40,17 @@ return item; }; useEffect(() => { - request.post('/matnrGroup/tree') + http() + }, [condition]); + + const http = () => { + request.post('/matnrGroup/tree', { condition }) .then(res => { if (res?.data?.code === 200) { let data = res.data.data; let items = haveChildren(data) - setTreeData(items) setDefaultIds([items.at(0).id]) - } else { notify(res.data.msg); @@ -56,12 +60,12 @@ notify('Error fetching tree data'); }); - }, []); + } const handleNodeSelect = (event, nodeId) => { setFilters({ groupId: nodeId }); }; - const handleSearch = () => { - console.log('Search Input:', selectedOption); + const handleSearch = (e) => { + setCondition(e.target.value) }; @@ -96,8 +100,11 @@ }} > <CardContent> - <SavedQueriesList icon={<BookmarkIcon />} /> - <FilterLiveSearch source="condition" /> + <Input + placeholder="鎼滅储鐗╂枡鍒嗗尯" + sx={{ '--Input-focused': 1, marginBottom: '10px' }} + onChange={handleSearch} + /> <RichTreeView defaultExpandedItems={defaultIds} expansionTrigger="iconContainer" -- Gitblit v1.9.1