From d27d0f1e1a181f28100a11453d81b3c603f627f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chuailei000=E2=80=9D?= <2280131253@qq.com> Date: Wed, 9 Mar 2022 16:23:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=87=E6=8D=A2=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=AD=EF=BC=8C?= =?UTF-8?q?=E6=9C=89=E5=88=9B=E5=BB=BA=E6=88=96=E8=80=85=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=97=B6=E6=89=8D=E6=98=BE=E7=A4=BA=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E7=AE=A1=E7=90=86=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/NavHeader/Organization.vue | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/layout/components/NavHeader/Organization.vue b/src/layout/components/NavHeader/Organization.vue index 37d31c484..49692e940 100644 --- a/src/layout/components/NavHeader/Organization.vue +++ b/src/layout/components/NavHeader/Organization.vue @@ -59,8 +59,11 @@ export default { ]) }, created() { - this.orgOption = [ - { + this.init() + }, + methods: { + init() { + const actionObject = { label: this.$t('xpack.Organization.OrganizationList'), options: [{ id: 'create', @@ -73,14 +76,16 @@ export default { disabled: !this.$hasPerm('orgs.view_organization'), name: this.$t('xpack.Organization.OrganizationLists') }] - }, - { - label: this.$t('xpack.Organization.AllOrganization'), - options: this.orgs } - ] - }, - methods: { + const hasPerms = this.$hasPerm('orgs.view_organization') || this.$hasPerm('xpack.Organization.OrganizationCreate') + this.orgOption = [ + (hasPerms && actionObject), + { + label: this.$t('xpack.Organization.AllOrganization'), + options: this.orgs + } + ] + }, changeOrg(orgId) { if (orgId === 'create') { this.$router.push({ name: 'OrganizationCreate' })