Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sgaqgl-vue
Project
Project
Details
Activity
Releases
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
李苏
sgaqgl-vue
Commits
666b6a5e
Commit
666b6a5e
authored
Nov 15, 2022
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
router
parent
14cb589a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
permission.js
src/store/modules/permission.js
+26
-2
No files found.
src/store/modules/permission.js
View file @
666b6a5e
import
auth
from
'@/plugins/auth'
import
router
,
{
constantRoutes
,
dynamicRoutes
}
from
'@/router'
import
router
,
{
constantRoutes
,
dynamicRoutes
,
powerRoutes
}
from
'@/router'
import
{
getRouters
}
from
'@/api/menu'
import
Layout
from
'@/layout/index'
import
ParentView
from
'@/components/ParentView'
...
...
@@ -79,7 +79,31 @@ const permission = {
getRouters
({}).
then
(
res
=>
{
let
menus
=
res
.
data
.
menu
console
.
log
(
res
.
data
.
mk
,
res
.
data
.
menu
,
'look'
)
/* 权限路由*/
console
.
log
(
menus
,
'权限路由——————————————————————————————'
,
powerRoutes
)
/* */
let
mapTree
=
function
(
arr
){
/* 逻辑判断*/
arr
.
forEach
((
item
,
index
)
=>
{
let
mkid
=
item
.
meta
.
mkid
let
hasMkid
=
false
menus
.
forEach
(
e
=>
{
if
(
e
.
mkid
==
mkid
){
hasMkid
=
true
}
})
/* 存在权限*/
if
(
hasMkid
){
}
else
{
arr
.
splice
(
index
,
1
)
}
if
(
item
.
children
&&
item
.
children
.
length
>
0
){
mapTree
(
item
.
children
)
}
})
return
arr
}
/* 转化菜单格式*/
let
delArr
=
[]
menus
.
forEach
((
item
,
index
)
=>
{
...
...
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