资源分类、部门点击展开

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>
);
};

View File

@ -430,6 +430,10 @@ textarea.ant-input {
left: 0;
bottom: 0;
}
.ant-tree-switcher_open::after,
.ant-tree-switcher_close::after {
z-index: 0;
}
.ant-modal-confirm-btns > .ant-btn-default:hover {
color: #ff4d4f !important;

View File

@ -37,9 +37,9 @@ export const DepartmentPage: React.FC = () => {
const onSelect = (selectedKeys: any, info: any) => {
setSelectKey(selectedKeys);
console.log(selectedKeys);
};
const through = (p: string) => {
if (!permisssions) {
return false;