Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-4
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
office
haoban-4
Commits
8fa1b415
Commit
8fa1b415
authored
Aug 13, 2020
by
无尘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改管理员角色菜单
parent
2b2549dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
21 deletions
+3
-21
edit-role.vue
src/views/enterprise/edit-role.vue
+3
-21
No files found.
src/views/enterprise/edit-role.vue
View file @
8fa1b415
...
...
@@ -195,42 +195,24 @@ export default {
// 同时更新roleData中menuIds的数据
onCheckedChange
(
checkedId
)
{
let
menuIds
=
[];
let
flatMenu
=
[];
let
allMenuIds
=
[];
for
(
let
key
in
checkedId
)
{
menuIds
=
menuIds
.
concat
(
checkedId
[
key
]);
}
this
.
tabList
=
this
.
tabList
.
map
(
el
=>
{
if
(
el
.
appType
==
this
.
activeType
)
{
el
.
checkedId
=
checkedId
;
flatMenu
=
el
.
flatMenu
;
}
return
el
;
})
// 根据任意层级的子节点向上查找全部的父节点,存入allMenuIds中,然后过滤掉重复的menuId
menuIds
.
map
(
el
=>
{
allMenuIds
=
allMenuIds
.
concat
(
getParentIds
(
el
,
flatMenu
));
})
allMenuIds
=
allMenuIds
.
filter
((
el
,
index
)
=>
index
==
allMenuIds
.
findIndex
(
item
=>
item
==
el
));
// 根据选择的菜单,设置对应选择的 ids
if
(
this
.
roleData
.
menuIds
.
some
(
el
=>
el
.
appType
==
this
.
activeType
))
{
this
.
roleData
.
menuIds
.
forEach
(
el
=>
{
if
(
el
.
appType
==
this
.
activeType
)
{
el
.
menuIds
=
allM
enuIds
;
el
.
menuIds
=
m
enuIds
;
}
})
}
else
{
this
.
roleData
.
menuIds
.
push
({
appType
:
this
.
activeType
,
menuIds
:
allMenuIds
});
}
function
getParentIds
(
menuId
,
menuList
)
{
let
result
=
[
menuId
];
menuList
.
some
(
el
=>
{
if
(
el
.
menuId
==
menuId
&&
el
.
parentId
>
0
)
{
result
=
result
.
concat
(
getParentIds
(
el
.
parentId
,
menuList
));
}
return
el
.
menuId
==
menuId
;
})
return
result
;
this
.
roleData
.
menuIds
.
push
({
appType
:
this
.
activeType
,
menuIds
:
menuIds
});
}
},
// 新建、编辑角色的保存
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment