资源分类、部门点击展开

This commit is contained in:
禺狨
2023-03-15 11:00:03 +08:00
parent 3f9f6abf03
commit 35ea9e8877
4 changed files with 25 additions and 3 deletions

View File

@@ -67,6 +67,15 @@ export const TreeCategory = (props: PropInterface) => {
setSelectKey(selectedKeys);
};
const onExpand = (selectedKeys: any, info: any) => {
let label = "全部" + props.text;
if (info) {
label = info.node.title;
}
props.onUpdate(selectedKeys, label);
setSelectKey(selectedKeys);
};
return (
<div>
<div
@@ -79,7 +88,7 @@ export const TreeCategory = (props: PropInterface) => {
>
{props.text}
</div>
<Tree onSelect={onSelect} treeData={treeData} />
<Tree onSelect={onSelect} onExpand={onExpand} treeData={treeData} />
</div>
);
};

View File

@@ -68,6 +68,15 @@ export const TreeDepartment = (props: PropInterface) => {
setSelectKey(selectedKeys);
};
const onExpand = (selectedKeys: any, info: any) => {
let label = "全部" + props.text;
if (info) {
label = info.node.title;
}
props.onUpdate(selectedKeys, label);
setSelectKey(selectedKeys);
};
return (
<div>
<div
@@ -80,7 +89,7 @@ export const TreeDepartment = (props: PropInterface) => {
>
{props.text}
</div>
<Tree onSelect={onSelect} treeData={treeData} />
<Tree onSelect={onSelect} onExpand={onExpand} treeData={treeData} />
</div>
);
};