树形部门选择组件

This commit is contained in:
禺狨
2023-03-03 18:27:47 +08:00
parent 1491af0ccd
commit 426713b661
5 changed files with 229 additions and 111 deletions

View File

@@ -1,4 +1,5 @@
export * from "./footer";
export * from "./header";
export * from "./leftMenu";
export * from "./uploadImageButton";
export * from "./uploadImageButton";
export * from ".//treeDepartment";

View File

@@ -24,7 +24,7 @@ const items = [
getItem("网校装修", "/decoration", <SettingOutlined />, null, null),
getItem(
"课程内容",
"2",
"3",
<MailOutlined />,
[
getItem("视频", "/vod", null, null, null),
@@ -35,16 +35,16 @@ const items = [
),
getItem(
"学员管理",
"3",
"4",
<AppstoreOutlined />,
[getItem("学员", "/member", null, null, null)],
null
),
getItem("证书管理", "4", <SettingOutlined />, [], null),
getItem("系统设置", "5", <SettingOutlined />, [,], null),
getItem("证书管理", "5", <SettingOutlined />, [], null),
getItem("系统设置", "6", <SettingOutlined />, [,], null),
];
const rootSubmenuKeys = ["2", "3", "4", "5"];
const rootSubmenuKeys = ["3", "4", "5", "6"];
export const LeftMenu: React.FC = () => {
//展开的subMenu

View File

@@ -0,0 +1,37 @@
import { Button, Input, message, Tree } from "antd";
import { useState, useEffect } from "react";
import { department } from "../../api/index";
interface PropInterface {
defaultExpandedKeys: any;
defaultSelectedKeys: any;
defaultCheckedKeys: any;
onUpdate: () => void;
}
export const TreeDepartment = (props: PropInterface) => {
const [treeData, setTreeData] = useState<any>([]);
const [loading, setLoading] = useState<boolean>(true);
useEffect(() => {
setLoading(true);
department.departmentList().then((res: any) => {
setTreeData(res.data);
setTimeout(() => {
setLoading(false);
}, 1000);
});
}, []);
const onSelect = () => {};
const onCheck = () => {};
return (
<Tree
checkable
defaultExpandedKeys={props.defaultExpandedKeys}
defaultSelectedKeys={props.defaultSelectedKeys}
defaultCheckedKeys={props.defaultCheckedKeys}
onSelect={onSelect}
onCheck={onCheck}
treeData={treeData}
/>
);
};