From 1b602ba053af06651d5c8f50146866d98f82934c Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 18 三月 2025 11:12:29 +0800
Subject: [PATCH] #修改 1.库位size字段,修改为长,宽, 高(完成 2.货架批量处理(完成 3.库位初始化功能(完成 4.筛选导出(完成 5.库位可绑定多种类型(中,高,低),可使用类型批量修改库位信息(完成 6.库位信息添加一个使用状态 (出库预约,入库预约,在库,空库,禁用, 空板)(完成 7.物料模板导出添加扩展字段
---
rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx | 53 +++++++++++++++++++++++++++++++++--------------------
1 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx
index e9a9147..9f5617b 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx
@@ -4,22 +4,13 @@
SavedQueriesList,
FilterLiveSearch,
useNotify,
- FilterList,
- FilterListItem,
- useStore,
- FilterFormInput,
- FilterLiveForm,
- TextInput,
- useGetList,
useListContext
} from 'react-admin';
import BookmarkIcon from '@mui/icons-material/BookmarkBorder';
import { Box, Typography, Card, CardContent, useTheme, TextField } from '@mui/material';
import { RichTreeView } from "@mui/x-tree-view/RichTreeView";
import { TreeItem2 } from "@mui/x-tree-view/TreeItem2";
-import WcIcon from '@mui/icons-material/Wc';
-import AccessTimeIcon from '@mui/icons-material/AccessTime';
-import { useForm, Controller } from "react-hook-form";
+
const MatListAside = () => {
const theme = useTheme();
@@ -27,13 +18,35 @@
const { setFilters } = useListContext(); // 鑾峰彇鍒楄〃涓婁笅鏂�
const [selectedOption, setSelectedOption] = useState(null);
const [treeData, setTreeData] = useState([]);
+ const trees = []
+ 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);
+ }
+ }
+
+ return item;
+ };
useEffect(() => {
request.post('/matnrGroup/tree')
.then(res => {
- console.log('Tree Data:', res);
if (res?.data?.code === 200) {
- setTreeData(res.data.data);
+ let data = res.data.data;
+ let items = haveChildren(data)
+ setTreeData(items)
} else {
notify(res.data.msg);
}
@@ -41,10 +54,10 @@
.catch(error => {
notify('Error fetching tree data');
});
-
-
-
- },[]);
+
+
+
+ }, []);
@@ -88,7 +101,7 @@
// 鍦ㄨ繖閲屽彲浠ユ牴鎹� nodeId 鏇存柊涓诲唴瀹瑰尯鍩�
};
const handleSearch = () => {
- console.log('Search Input:', selectedOption);
+ console.log('Search Input:', selectedOption);
};
@@ -123,12 +136,12 @@
>
<CardContent>
<SavedQueriesList icon={<BookmarkIcon />} />
- <FilterLiveSearch source="condition" />
+ <FilterLiveSearch source="condition" />
<RichTreeView
defaultExpandedItems={['grid', 'pickers']}
expansionTrigger="iconContainer"
- items={ treeData }
- slots={ CustomTreeItem }
+ items={treeData}
+ slots={CustomTreeItem}
onItemClick={handleNodeSelect} // 鐩戝惉鑺傜偣鐐瑰嚮浜嬩欢
/>
--
Gitblit v1.9.1