refactor(权限管理): 使用v-permission
This commit is contained in:
parent
a0b4e315ac
commit
e1eaecff17
|
@ -7,7 +7,9 @@
|
||||||
text-color="#fff">
|
text-color="#fff">
|
||||||
<el-menu-item index="1" v-show="false">Placeholder</el-menu-item>
|
<el-menu-item index="1" v-show="false">Placeholder</el-menu-item>
|
||||||
<el-submenu index="1" popper-class="org-ws-submenu"
|
<el-submenu index="1" popper-class="org-ws-submenu"
|
||||||
v-roles="['org_admin', 'test_manager', 'test_user', 'test_viewer']">
|
v-permission="['PROJECT_TRACK_CASE:READ','PROJECT_TRACK_PLAN:READ','PROJECT_TRACK_REVIEW:READ',
|
||||||
|
'PROJECT_API_DEFINITION:READ','PROJECT_API_SCENARIO:READ','PROJECT_API_REPORT:READ',
|
||||||
|
'PROJECT_PERFORMANCE_TEST:READ','PROJECT_PERFORMANCE_REPORT:READ', 'ORGANIZATION_USER:READ']">
|
||||||
<template v-slot:title>{{ $t('commons.organization') }}:
|
<template v-slot:title>{{ $t('commons.organization') }}:
|
||||||
<span class="org-ws-name" :title="currentOrganizationName">
|
<span class="org-ws-name" :title="currentOrganizationName">
|
||||||
{{ currentOrganizationName }}
|
{{ currentOrganizationName }}
|
||||||
|
@ -29,7 +31,11 @@
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</div>
|
</div>
|
||||||
</el-submenu>
|
</el-submenu>
|
||||||
<el-submenu index="2" popper-class="submenu" v-roles="['test_manager', 'test_user', 'test_viewer']">
|
<el-submenu index="2" popper-class="submenu"
|
||||||
|
v-permission="['PROJECT_TRACK_CASE:READ','PROJECT_TRACK_PLAN:READ','PROJECT_TRACK_REVIEW:READ',
|
||||||
|
'PROJECT_API_DEFINITION:READ','PROJECT_API_SCENARIO:READ','PROJECT_API_REPORT:READ',
|
||||||
|
'PROJECT_PERFORMANCE_TEST:READ','PROJECT_PERFORMANCE_REPORT:READ','WORKSPACE_USER:READ']"
|
||||||
|
>
|
||||||
<template v-slot:title>{{ $t('commons.workspace') }}:
|
<template v-slot:title>{{ $t('commons.workspace') }}:
|
||||||
<span class="org-ws-name" :title="currentWorkspaceName">
|
<span class="org-ws-name" :title="currentWorkspaceName">
|
||||||
{{ currentWorkspaceName }}
|
{{ currentWorkspaceName }}
|
||||||
|
@ -87,7 +93,7 @@ export default {
|
||||||
searchWs: '',
|
searchWs: '',
|
||||||
orgListCopy: [{name: this.$t('organization.none')}],
|
orgListCopy: [{name: this.$t('organization.none')}],
|
||||||
wsListCopy: [{name: this.$t('workspace.none')}]
|
wsListCopy: [{name: this.$t('workspace.none')}]
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
currentUser: () => {
|
currentUser: () => {
|
||||||
|
@ -125,7 +131,7 @@ export default {
|
||||||
this.$get("/workspace/list/orgworkspace/", response => {
|
this.$get("/workspace/list/orgworkspace/", response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
this.workspaceList = [{name: this.$t('workspace.none')}]
|
this.workspaceList = [{name: this.$t('workspace.none')}];
|
||||||
} else {
|
} else {
|
||||||
this.workspaceList = data;
|
this.workspaceList = data;
|
||||||
this.wsListCopy = data;
|
this.wsListCopy = data;
|
||||||
|
@ -135,13 +141,13 @@ export default {
|
||||||
localStorage.setItem(WORKSPACE_ID, workspace[0].id);
|
localStorage.setItem(WORKSPACE_ID, workspace[0].id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getCurrentUserInfo() {
|
getCurrentUserInfo() {
|
||||||
this.$get("/user/info/" + encodeURIComponent(this.currentUserId), response => {
|
this.$get("/user/info/" + encodeURIComponent(this.currentUserId), response => {
|
||||||
this.currentUserInfo = response.data;
|
this.currentUserInfo = response.data;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
changeOrg(data) {
|
changeOrg(data) {
|
||||||
let orgId = data.id;
|
let orgId = data.id;
|
||||||
|
@ -171,7 +177,7 @@ export default {
|
||||||
this.$router.push('/').then(() => {
|
this.$router.push('/').then(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}).catch(err => err);
|
}).catch(err => err);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
query(sign, queryString) {
|
query(sign, queryString) {
|
||||||
if (sign === 'org') {
|
if (sign === 'org') {
|
||||||
|
@ -187,7 +193,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Reference in New Issue