|
|
<template>
|
|
|
<Menu class="sidebar-menu" active-name="1-2" theme="light" width="auto" :open-names="['1']">
|
|
|
<MenuItem name="1">
|
|
|
<a href="/">
|
|
|
<Icon type="ios-home"></Icon>
|
|
|
Dashboard
|
|
|
</a>
|
|
|
</MenuItem>
|
|
|
<Submenu name="2">
|
|
|
<template slot="title">
|
|
|
<Icon type="document-text"></Icon>
|
|
|
日志查询
|
|
|
</template>
|
|
|
|
|
|
<MenuItem name="2-1">
|
|
|
<router-link to="/logs/node">
|
|
|
Node 日志
|
|
|
<Menu class="sidebar-menu" theme="light" width="auto">
|
|
|
<template v-for="(menu, index) in menus">
|
|
|
<Submenu v-if="menu.subMenus" :name="index">
|
|
|
<template slot="title">
|
|
|
<Icon :type="menu.icon"></Icon>
|
|
|
{{menu.title}}
|
|
|
</template>
|
|
|
<template v-for="(subMenu, subIndex) in menu.subMenus">
|
|
|
<MenuItem :name="`${index}-${subIndex}`">
|
|
|
<a v-if="subMenu.isClassic" :href="subMenu.link">
|
|
|
<Icon :type="subMenu.icon"></Icon>
|
|
|
{{subMenu.title}}
|
|
|
</a>
|
|
|
<router-link v-else :to="subMenu.link">
|
|
|
{{subMenu.title}}
|
|
|
</router-link>
|
|
|
</MenuItem>
|
|
|
</template>
|
|
|
</Submenu>
|
|
|
<MenuItem v-else :name="index">
|
|
|
<a v-if="menu.isClassic" :href="menu.link">
|
|
|
<Icon :type="menu.icon"></Icon>
|
|
|
{{menu.title}}
|
|
|
</a>
|
|
|
<router-link v-else :to="menu.link">
|
|
|
<Icon :type="menu.icon"></Icon>
|
|
|
{{menu.title}}
|
|
|
</router-link>
|
|
|
</MenuItem>
|
|
|
</Submenu>
|
|
|
</template>
|
|
|
</Menu>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
normalMenus,
|
|
|
masterMenus,
|
|
|
businessMenus
|
|
|
} from '../../../../config/menus' // 考虑与原有业务复用
|
|
|
|
|
|
export default {
|
|
|
props: ['user']
|
|
|
props: ['user'],
|
|
|
computed: {
|
|
|
isMaster: function() {
|
|
|
return this.user.role === '1000'
|
|
|
},
|
|
|
isBusiness: function() {
|
|
|
return this.user.role === '3000'
|
|
|
},
|
|
|
menus: function() {
|
|
|
if (this.isBusiness) {
|
|
|
return businessMenus
|
|
|
}
|
|
|
if (this.isMaster) {
|
|
|
return [...normalMenus, ...masterMenus]
|
|
|
}
|
|
|
return normalMenus
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
...
|
...
|
|