From c08872641231165c9311b1bdb9fa81e4834319ff Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Sat, 11 Dec 2021 12:53:48 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=BB=98=E8=AE=A4=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/RequestApplicationPerm/CreateUpdate.vue | 11 +++++++++-- src/views/tickets/RequestAssetPerm/CreateUpdate.vue | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/views/tickets/RequestApplicationPerm/CreateUpdate.vue b/src/views/tickets/RequestApplicationPerm/CreateUpdate.vue index 533d574b6..012798df3 100644 --- a/src/views/tickets/RequestApplicationPerm/CreateUpdate.vue +++ b/src/views/tickets/RequestApplicationPerm/CreateUpdate.vue @@ -218,8 +218,15 @@ export default { } }, mounted() { - if (this.$store.state.users.profile.user_all_orgs.length > 0) { - this.initial.org_id = this.$store.state.users.profile.user_all_orgs[0].id + let userAllOrgIds = this.$store.state.users.profile['user_all_orgs'] + const currentOrgId = this.$store.getters.currentOrg.id + userAllOrgIds = userAllOrgIds ? userAllOrgIds.map(i => i.id) : [] + if (userAllOrgIds.length > 0) { + if (userAllOrgIds.includes(currentOrgId)) { + this.initial.org_id = currentOrgId + } else { + this.initial.org_id = userAllOrgIds[0] + } } this.loading = false }, diff --git a/src/views/tickets/RequestAssetPerm/CreateUpdate.vue b/src/views/tickets/RequestAssetPerm/CreateUpdate.vue index 5ab58932b..5f84d8c8e 100644 --- a/src/views/tickets/RequestAssetPerm/CreateUpdate.vue +++ b/src/views/tickets/RequestAssetPerm/CreateUpdate.vue @@ -130,8 +130,15 @@ export default { } }, mounted() { - if (this.$store.state.users.profile['user_all_orgs'].length > 0) { - this.initial.org_id = this.$store.state.users.profile['user_all_orgs'][0].id + let userAllOrgIds = this.$store.state.users.profile['user_all_orgs'] + const currentOrgId = this.$store.getters.currentOrg.id + userAllOrgIds = userAllOrgIds ? userAllOrgIds.map(i => i.id) : [] + if (userAllOrgIds.length > 0) { + if (userAllOrgIds.includes(currentOrgId)) { + this.initial.org_id = currentOrgId + } else { + this.initial.org_id = userAllOrgIds[0] + } } this.loading = false },