|
@@ -1,5 +1,5 @@
|
|
|
import React, { useState, useEffect } from 'react'
|
|
import React, { useState, useEffect } from 'react'
|
|
|
-import { Button, message } from 'antd'
|
|
|
|
|
|
|
+import { Button, message, Tree } from 'antd'
|
|
|
import { PlusOutlined } from '@ant-design/icons'
|
|
import { PlusOutlined } from '@ant-design/icons'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
import { apiaddDepartment } from '@/services/department'
|
|
import { apiaddDepartment } from '@/services/department'
|
|
@@ -10,13 +10,13 @@ const RoleMenu = props => {
|
|
|
const { dispatch, departments = [] } = props
|
|
const { dispatch, departments = [] } = props
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
const [activeId, setActiveId] = useState('')
|
|
const [activeId, setActiveId] = useState('')
|
|
|
|
|
+ const { DirectoryTree } = Tree
|
|
|
|
|
|
|
|
const initData = () => {
|
|
const initData = () => {
|
|
|
dispatch({
|
|
dispatch({
|
|
|
type: 'staff/fetchDepartments'
|
|
type: 'staff/fetchDepartments'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
const handleAddDepartment = async values => {
|
|
const handleAddDepartment = async values => {
|
|
|
const { code = -1 } = await apiaddDepartment({ ...values })
|
|
const { code = -1 } = await apiaddDepartment({ ...values })
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
@@ -32,6 +32,14 @@ const RoleMenu = props => {
|
|
|
}
|
|
}
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
+ const onSelect = (keys, info) => {
|
|
|
|
|
+ console.log('Trigger Select', keys, info)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const onExpand = () => {
|
|
|
|
|
+ console.log('Trigger Expand')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className="h-full w-max-234px rounded-4px roleMenu">
|
|
<div className="h-full w-max-234px rounded-4px roleMenu">
|
|
|
<div className="p-4 border-b-1 border-solid border-black border-opacity-10 bg-[#f7f9fa] flex justify-around items-center">
|
|
<div className="p-4 border-b-1 border-solid border-black border-opacity-10 bg-[#f7f9fa] flex justify-around items-center">
|
|
@@ -61,7 +69,14 @@ const RoleMenu = props => {
|
|
|
</ModalForm>
|
|
</ModalForm>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="p-4 bg-white" style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>
|
|
<div className="p-4 bg-white" style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>
|
|
|
- <ul className="p-0 m-0 list-none text-primary flex flex-col flex-1">
|
|
|
|
|
|
|
+ <DirectoryTree
|
|
|
|
|
+ multiple
|
|
|
|
|
+ defaultExpandAll
|
|
|
|
|
+ onSelect={onSelect}
|
|
|
|
|
+ onExpand={onExpand}
|
|
|
|
|
+ treeData={departments}
|
|
|
|
|
+ />
|
|
|
|
|
+ {/* <ul className="p-0 m-0 list-none text-primary flex flex-col flex-1">
|
|
|
{departments.map(item => (
|
|
{departments.map(item => (
|
|
|
<li
|
|
<li
|
|
|
key={item.id}
|
|
key={item.id}
|
|
@@ -70,7 +85,7 @@ const RoleMenu = props => {
|
|
|
<span>{item.name}</span>
|
|
<span>{item.name}</span>
|
|
|
</li>
|
|
</li>
|
|
|
))}
|
|
))}
|
|
|
- </ul>
|
|
|
|
|
|
|
+ </ul> */}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|