菜单权限

This commit is contained in:
Captain.B 2020-03-05 10:52:14 +08:00
parent acab2ab535
commit 2f003a1d74
1 changed files with 11 additions and 10 deletions

View File

@ -5,7 +5,8 @@
class="header-user-menu align-right"
background-color="#2c2a48"
text-color="#fff">
<el-submenu index="1" popper-class="submenu">
<el-submenu index="1" popper-class="submenu"
v-permission="['org_admin', 'test_manager', 'test_user', 'test_viewer']">
<template slot="title">组织{{currentOrganizationName}}</template>
<label v-for="(item,index) in organizationList" :key="index">
<el-menu-item @click="changeOrg(item)">{{item.name}}
@ -41,7 +42,7 @@
</template>
<script>
import { ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER, TokenKey} from '../../common/constants';
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER, TokenKey} from '../../common/constants';
export default {
name: "MsUser",
@ -90,14 +91,14 @@
initMenuData() {
let roles = this.currentUser.roles.map(r => r.id);
// if (roles.indexOf(ROLE_ORG_ADMIN) > -1) {
this.$get("/organization/list/userorg/" + this.currentUserId, response => {
let data = response.data;
this.organizationList = data;
let org = data.filter(r => r.id === this.currentUser.lastOrganizationId);
if (org.length > 0) {
this.currentOrganizationName = org[0].name;
}
});
this.$get("/organization/list/userorg/" + this.currentUserId, response => {
let data = response.data;
this.organizationList = data;
let org = data.filter(r => r.id === this.currentUser.lastOrganizationId);
if (org.length > 0) {
this.currentOrganizationName = org[0].name;
}
});
// }
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
if (!this.currentUser.lastOrganizationId) {