Merge pull request #1223 from jumpserver/pr@dev@ticket_perf

perf: 默认展示当前组织
This commit is contained in:
feng626 2021-12-13 10:26:30 +08:00 committed by GitHub
commit 744acee097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -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
},

View File

@ -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
},