fix: 切换组织组件修改判断,有创建或者查看权限时才显示组织管理分组

This commit is contained in:
“huailei000”
2022-03-09 16:23:56 +08:00
committed by 老广
parent c63a4fc672
commit d27d0f1e1a

View File

@@ -59,8 +59,11 @@ export default {
]) ])
}, },
created() { created() {
this.orgOption = [ this.init()
{ },
methods: {
init() {
const actionObject = {
label: this.$t('xpack.Organization.OrganizationList'), label: this.$t('xpack.Organization.OrganizationList'),
options: [{ options: [{
id: 'create', id: 'create',
@@ -73,14 +76,16 @@ export default {
disabled: !this.$hasPerm('orgs.view_organization'), disabled: !this.$hasPerm('orgs.view_organization'),
name: this.$t('xpack.Organization.OrganizationLists') name: this.$t('xpack.Organization.OrganizationLists')
}] }]
}, }
const hasPerms = this.$hasPerm('orgs.view_organization') || this.$hasPerm('xpack.Organization.OrganizationCreate')
this.orgOption = [
(hasPerms && actionObject),
{ {
label: this.$t('xpack.Organization.AllOrganization'), label: this.$t('xpack.Organization.AllOrganization'),
options: this.orgs options: this.orgs
} }
] ]
}, },
methods: {
changeOrg(orgId) { changeOrg(orgId) {
if (orgId === 'create') { if (orgId === 'create') {
this.$router.push({ name: 'OrganizationCreate' }) this.$router.push({ name: 'OrganizationCreate' })