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
b965e9a1
Commit
b965e9a1
authored
Aug 13, 2020
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整菜单配置交互
parent
41a0e6f1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
edit-role.vue
src/views/enterprise/edit-role.vue
+11
-1
No files found.
src/views/enterprise/edit-role.vue
View file @
b965e9a1
...
@@ -147,7 +147,7 @@ export default {
...
@@ -147,7 +147,7 @@ export default {
if
(
allMenuIds
.
some
(
item
=>
item
==
el
.
menuId
))
{
if
(
allMenuIds
.
some
(
item
=>
item
==
el
.
menuId
))
{
let
allSubId
=
[];
let
allSubId
=
[];
if
(
Array
.
isArray
(
el
.
children
))
{
if
(
Array
.
isArray
(
el
.
children
))
{
allSubId
=
el
.
children
.
map
(
item
=>
item
.
menuId
);
allSubId
=
getAllSubMenuIds
(
el
.
children
);
}
}
// 如果el的allSubId都在allMenuIds中,则认为el需要被勾选,需要把el.menuId放入result中
// 如果el的allSubId都在allMenuIds中,则认为el需要被勾选,需要把el.menuId放入result中
if
(
allSubId
.
length
==
0
||
allSubId
.
every
(
el
=>
allMenuIds
.
some
(
item
=>
item
==
el
)))
{
if
(
allSubId
.
length
==
0
||
allSubId
.
every
(
el
=>
allMenuIds
.
some
(
item
=>
item
==
el
)))
{
...
@@ -160,6 +160,16 @@ export default {
...
@@ -160,6 +160,16 @@ export default {
})
})
return
result
;
return
result
;
}
}
function
getAllSubMenuIds
(
menuList
)
{
let
result
=
[];
menuList
.
forEach
(
el
=>
{
result
.
push
(
el
.
menuId
);
if
(
Array
.
isArray
(
el
.
children
))
{
result
=
result
.
concat
(
getAllSubMenuIds
(
el
.
children
));
}
})
return
result
;
}
},
},
// 将平铺的数据转为树形结构
// 将平铺的数据转为树形结构
flatDataToTree
(
data
)
{
flatDataToTree
(
data
)
{
...
...
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