|
|
@ -1,7 +1,6 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-menu |
|
|
|
<el-menu class="sidebar-el-menu" |
|
|
|
class="sidebar-el-menu" |
|
|
|
|
|
|
|
:default-active="onRoutes" |
|
|
|
:default-active="onRoutes" |
|
|
|
background-color="#324157" |
|
|
|
background-color="#324157" |
|
|
|
text-color="#bfcbd9" |
|
|
|
text-color="#bfcbd9" |
|
|
@ -9,38 +8,33 @@ |
|
|
|
unique-opened |
|
|
|
unique-opened |
|
|
|
mode="horizontal" |
|
|
|
mode="horizontal" |
|
|
|
router |
|
|
|
router |
|
|
|
@select="handleSelect" |
|
|
|
@select="handleSelect"> |
|
|
|
> |
|
|
|
|
|
|
|
<template v-for="item in menus"> |
|
|
|
<template v-for="item in menus"> |
|
|
|
<template v-if="item.subs"> |
|
|
|
<template v-if="item.subs"> |
|
|
|
<el-submenu :index="item.index" :key="item.index"> |
|
|
|
<el-submenu :index="item.index" |
|
|
|
|
|
|
|
:key="item.index"> |
|
|
|
<template slot="title"> |
|
|
|
<template slot="title"> |
|
|
|
<i :class="item.icon"></i> |
|
|
|
<i :class="item.icon"></i> |
|
|
|
<span slot="title">{{ item.title }}</span> |
|
|
|
<span slot="title">{{ item.title }}</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<template v-for="subItem in item.subs"> |
|
|
|
<template v-for="subItem in item.subs"> |
|
|
|
<el-submenu |
|
|
|
<el-submenu v-if="subItem.subs" |
|
|
|
v-if="subItem.subs" |
|
|
|
|
|
|
|
:index="subItem.index" |
|
|
|
:index="subItem.index" |
|
|
|
:key="subItem.index" |
|
|
|
:key="subItem.index"> |
|
|
|
> |
|
|
|
|
|
|
|
<template slot="title">{{ subItem.title }}</template> |
|
|
|
<template slot="title">{{ subItem.title }}</template> |
|
|
|
<el-menu-item |
|
|
|
<el-menu-item v-for="(threeItem,i) in subItem.subs" |
|
|
|
v-for="(threeItem,i) in subItem.subs" |
|
|
|
|
|
|
|
:key="i" |
|
|
|
:key="i" |
|
|
|
:index="threeItem.index" |
|
|
|
:index="threeItem.index">{{ threeItem.title }}</el-menu-item> |
|
|
|
>{{ threeItem.title }}</el-menu-item> |
|
|
|
|
|
|
|
</el-submenu> |
|
|
|
</el-submenu> |
|
|
|
<el-menu-item |
|
|
|
<el-menu-item v-else |
|
|
|
v-else |
|
|
|
|
|
|
|
:index="subItem.index" |
|
|
|
:index="subItem.index" |
|
|
|
:key="subItem.index" |
|
|
|
:key="subItem.index">{{ subItem.title }}</el-menu-item> |
|
|
|
>{{ subItem.title }}</el-menu-item> |
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-submenu> |
|
|
|
</el-submenu> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<template v-else> |
|
|
|
<template v-else> |
|
|
|
<el-menu-item :index="item.index" :key="item.index"> |
|
|
|
<el-menu-item :index="item.index" |
|
|
|
|
|
|
|
:key="item.index"> |
|
|
|
<i :class="item.icon"></i> |
|
|
|
<i :class="item.icon"></i> |
|
|
|
<span slot="title">{{ item.title }}</span> |
|
|
|
<span slot="title">{{ item.title }}</span> |
|
|
|
</el-menu-item> |
|
|
|
</el-menu-item> |
|
|
@ -54,7 +48,7 @@ |
|
|
|
import Setting from '@/setting' |
|
|
|
import Setting from '@/setting' |
|
|
|
import addRoutes from '@/libs/route/addRoutes' |
|
|
|
import addRoutes from '@/libs/route/addRoutes' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
menuList: [ |
|
|
|
menuList: [ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -127,29 +121,29 @@ export default { |
|
|
|
onRoutes: this.$route.path |
|
|
|
onRoutes: this.$route.path |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
watch: { |
|
|
|
"$route.path":function(val){ |
|
|
|
"$route.path": function (val) { |
|
|
|
this.menuList.map(e=>{ |
|
|
|
this.menuList.map(e => { |
|
|
|
if(val.replace('/', '')===e.index){ |
|
|
|
if (val.replace('/', '') === e.index) { |
|
|
|
this.handleSelect(val.replace('/', '')) |
|
|
|
this.handleSelect(val.replace('/', '')) |
|
|
|
this.$forceUpdate(); |
|
|
|
this.$forceUpdate(); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted () { |
|
|
|
sessionStorage.getItem('sideBar') && this.handleSelect(sessionStorage.getItem('sideBar')) |
|
|
|
// sessionStorage.getItem('sideBar') && this.handleSelect(sessionStorage.getItem('sideBar')) |
|
|
|
sessionStorage.getItem('token') && this.getPer() // 登录了才获取权限 |
|
|
|
sessionStorage.getItem('token') && this.getPer() // 登录了才获取权限 |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
methods: { |
|
|
|
handleSelect(index){ |
|
|
|
handleSelect (index) { |
|
|
|
this.onRoutes = index |
|
|
|
this.onRoutes = index |
|
|
|
this.$store.commit('setOrderParam', null) |
|
|
|
this.$store.commit('setOrderParam', null) |
|
|
|
this.$store.commit('setInfoTab', '1') |
|
|
|
this.$store.commit('setInfoTab', '1') |
|
|
|
this.$store.commit('setColumnId', '') |
|
|
|
this.$store.commit('setColumnId', '') |
|
|
|
sessionStorage.setItem('sideBar',index) |
|
|
|
sessionStorage.setItem('sideBar', index) |
|
|
|
}, |
|
|
|
}, |
|
|
|
initMenu() { |
|
|
|
initMenu () { |
|
|
|
if (Setting.dynamicRoute) { |
|
|
|
if (Setting.dynamicRoute) { |
|
|
|
const routes = this.$store.state.routes |
|
|
|
const routes = this.$store.state.routes |
|
|
|
const menus = [] |
|
|
|
const menus = [] |
|
|
@ -162,7 +156,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取权限列表 |
|
|
|
// 获取权限列表 |
|
|
|
getPer() { |
|
|
|
getPer () { |
|
|
|
this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => { |
|
|
|
this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => { |
|
|
|
const routes = res.permissionMenu[0].children |
|
|
|
const routes = res.permissionMenu[0].children |
|
|
|
addRoutes(routes) |
|
|
|
addRoutes(routes) |
|
|
|