Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
sage-front-framework
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
郁骅焌
sage-front-framework
Commits
14373d7a
提交
14373d7a
authored
6月 10, 2020
作者:
郁骅焌
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化
上级
fda615ff
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
43 行增加
和
24 行删除
+43
-24
index.jsx
src/components/Business/MenuTree/index.jsx
+11
-4
AvatarDropdown.jsx
src/components/GlobalHeader/AvatarDropdown.jsx
+29
-19
index.jsx
src/pages/role/index.jsx
+3
-1
没有找到文件。
src/components/Business/MenuTree/index.jsx
浏览文件 @
14373d7a
...
...
@@ -19,13 +19,14 @@ const MenuTree = (props, ref) => {
const
[
treeData
,
setTreeData
]
=
useState
([])
const
[
expandedKeys
,
setExpandedKeys
]
=
useState
([]);
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
([]);
const
[
halfCheckedKeys
,
setHalfCheckedKeys
]
=
useState
([])
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
([]);
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
(
true
);
const
queryMenu
=
async
()
=>
{
const
res
=
await
getMenu
()
const
{
data
}
=
res
const
treeDataArr
=
data
.
slice
()
const
treeDataArr
=
data
?
data
.
slice
()
:
[]
loopTree
(
treeDataArr
)
setTreeData
(
treeDataArr
)
}
...
...
@@ -38,9 +39,10 @@ const MenuTree = (props, ref) => {
setAutoExpandParent
(
false
);
};
const
onCheck
=
checkedkeys
=>
{
const
onCheck
=
(
checkedkeys
,
e
)
=>
{
// console.log('onCheck', checkedkeys);
setCheckedKeys
(
checkedkeys
);
setHalfCheckedKeys
(
e
.
halfCheckedKeys
)
};
const
onSelect
=
(
selectedkeys
,
info
)
=>
{
...
...
@@ -52,6 +54,10 @@ const MenuTree = (props, ref) => {
return
checkedKeys
}
const
getHalfCheckedKeys
=
()
=>
{
return
halfCheckedKeys
}
useEffect
(()
=>
{
queryMenu
()
},
[])
...
...
@@ -59,13 +65,14 @@ const MenuTree = (props, ref) => {
// 暴露给外部的方法
useImperativeHandle
(
ref
,
()
=>
({
setCheckedKeys
,
getCheckedKeys
getCheckedKeys
,
getHalfCheckedKeys
}))
return
(
<
SageTree
checkable
checkStrictly
//
checkStrictly
onExpand=
{
onExpand
}
expandedKeys=
{
expandedKeys
}
autoExpandParent=
{
autoExpandParent
}
...
...
src/components/GlobalHeader/AvatarDropdown.jsx
浏览文件 @
14373d7a
import
{
LogoutOutlined
,
SettingOutlined
,
UserOutlined
}
from
'@ant-design/icons'
;
import
{
Avatar
,
Menu
,
Spin
}
from
'antd'
;
import
{
LogoutOutlined
,
SettingOutlined
,
UserOutlined
,
ExclamationCircleOutlined
}
from
'@ant-design/icons'
;
import
{
Avatar
,
Menu
,
Spin
,
Modal
}
from
'antd'
;
import
React
from
'react'
;
import
{
history
,
connect
}
from
'umi'
;
import
HeaderDropdown
from
'../HeaderDropdown'
;
...
...
@@ -8,15 +8,25 @@ import styles from './index.less';
class
AvatarDropdown
extends
React
.
Component
{
onMenuClick
=
event
=>
{
const
{
key
}
=
event
;
const
{
confirm
}
=
Modal
;
const
{
dispatch
}
=
this
.
props
;
if
(
key
===
'logout'
)
{
const
{
dispatch
}
=
this
.
props
;
if
(
dispatch
)
{
dispatch
({
type
:
'login/logout'
,
});
}
confirm
({
title
:
'退出登录'
,
icon
:
<
ExclamationCircleOutlined
/>,
content
:
'您确认要退出吗?'
,
okText
:
'确认'
,
cancelText
:
'取消'
,
onOk
()
{
if
(
dispatch
)
{
dispatch
({
type
:
'login/logout'
,
});
}
},
onCancel
()
{
},
})
return
;
}
...
...
@@ -62,16 +72,16 @@ class AvatarDropdown extends React.Component {
</
span
>
</
HeaderDropdown
>
)
:
(
<
span
className=
{
`${styles.action} ${styles.account}`
}
>
<
Spin
size=
"small"
style=
{
{
marginLeft
:
8
,
marginRight
:
8
,
}
}
/>
</
span
>
);
<
span
className=
{
`${styles.action} ${styles.account}`
}
>
<
Spin
size=
"small"
style=
{
{
marginLeft
:
8
,
marginRight
:
8
,
}
}
/>
</
span
>
);
}
}
...
...
src/pages/role/index.jsx
浏览文件 @
14373d7a
...
...
@@ -250,10 +250,12 @@ const TableList = () => {
// 保存授权菜单
const
onSaveMenuRole
=
async
()
=>
{
const
checkedKeys
=
menutreeRef
.
current
.
getCheckedKeys
()
const
halfCheckedKeys
=
menutreeRef
.
current
.
getHalfCheckedKeys
()
const
pp
=
{
...
role
,
authList
:
checkedKeys
.
checked
// authList: checkedKeys.checked // 非关联
authList
:
checkedKeys
.
concat
(
halfCheckedKeys
)
// 关联
}
const
res
=
await
updateRule
(
pp
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论