1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 23:20:12 +08:00
* fix 404

* delete console.log

Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-03-09 21:13:03 -04:00 committed by GitHub
parent 42261cfdca
commit 1b280259e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View File

@ -31,13 +31,11 @@ const actions = {
if (!isEmptyValue(organization)) { if (!isEmptyValue(organization)) {
organizationUuid = organization.uuid organizationUuid = organization.uuid
} }
const role = rootGetters['user/getRole'] const role = rootGetters['user/getRole']
let roleUuid let roleUuid
if (!isEmptyValue(role)) { if (!isEmptyValue(role)) {
roleUuid = role.uuid roleUuid = role.uuid
} }
const sessionUuid = getToken() const sessionUuid = getToken()
loadMainMenu({ loadMainMenu({

View File

@ -46,7 +46,8 @@ const state = {
warehouse: {}, warehouse: {},
isSession: false, isSession: false,
sessionInfo: {}, sessionInfo: {},
corporateBrandingImage: '' corporateBrandingImage: '',
currentOrganization: 0
} }
const mutations = { const mutations = {
@ -71,6 +72,9 @@ const mutations = {
SET_ORGANIZATIONS_LIST: (state, payload) => { SET_ORGANIZATIONS_LIST: (state, payload) => {
state.organizationsList = payload state.organizationsList = payload
}, },
SET_CURRENT_ORGANIZATIONS: (state, payload) => {
state.currentOrganization = payload
},
SET_ORGANIZATION: (state, organization) => { SET_ORGANIZATION: (state, organization) => {
state.organization = organization state.organization = organization
if (organization) { if (organization) {
@ -174,6 +178,12 @@ const actions = {
const { role } = sessionInfo const { role } = sessionInfo
commit('SET_ROLE', role) commit('SET_ROLE', role)
setCurrentRole(role.uuid) setCurrentRole(role.uuid)
const currentOrganizationSession = sessionInfo.defaultContext.find(context => {
if (context.key === '#AD_Org_ID') {
return context
}
})
commit('SET_CURRENT_ORGANIZATIONS', currentOrganizationSession.value)
// wait to establish the client and organization to generate the menu // wait to establish the client and organization to generate the menu
await dispatch('getOrganizationsListFromServer', role.uuid) await dispatch('getOrganizationsListFromServer', role.uuid)
@ -221,7 +231,6 @@ const actions = {
message: 'Verification failed, please Login again.' message: 'Verification failed, please Login again.'
}) })
} }
// if (isEmptyValue(state.role)) { // if (isEmptyValue(state.role)) {
// const role = responseGetInfo.rolesList.find(itemRole => { // const role = responseGetInfo.rolesList.find(itemRole => {
// return itemRole.uuid === getCurrentRole() // return itemRole.uuid === getCurrentRole()
@ -333,7 +342,7 @@ const actions = {
}) })
}, },
getOrganizationsListFromServer({ commit, dispatch }, roleUuid) { getOrganizationsListFromServer({ commit, dispatch, getters }, roleUuid) {
if (isEmptyValue(roleUuid)) { if (isEmptyValue(roleUuid)) {
roleUuid = getCurrentRole() roleUuid = getCurrentRole()
} }
@ -354,6 +363,14 @@ const actions = {
} else { } else {
setCurrentOrganization(organization.uuid) setCurrentOrganization(organization.uuid)
} }
const currentOrganization = getters.getCurrentOrg
if (!isEmptyValue(currentOrganization)) {
organization = response.organizationsList.find(item => {
if (item.id === currentOrganization) {
return item
}
})
}
commit('SET_ORGANIZATION', organization) commit('SET_ORGANIZATION', organization)
commit('setPreferenceContext', { commit('setPreferenceContext', {
columnName: '#AD_Org_ID', columnName: '#AD_Org_ID',
@ -579,6 +596,9 @@ const getters = {
}, },
getIsPersonalLock: (state) => { getIsPersonalLock: (state) => {
return state.role.isPersonalLock return state.role.isPersonalLock
},
getCurrentOrg: (state) => {
return state.currentOrganization
} }
} }