mirror of
https://github.com/PlayEdu/backend
synced 2025-12-23 05:39:38 +08:00
树形部门选择组件
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
export * from "./footer";
|
||||
export * from "./header";
|
||||
export * from "./leftMenu";
|
||||
export * from "./uploadImageButton";
|
||||
export * from "./uploadImageButton";
|
||||
export * from ".//treeDepartment";
|
||||
@@ -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
|
||||
|
||||
0
src/compenents/treeDepartment/index.module.less
Normal file
0
src/compenents/treeDepartment/index.module.less
Normal file
37
src/compenents/treeDepartment/index.tsx
Normal file
37
src/compenents/treeDepartment/index.tsx
Normal 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}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user