mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
fix 404 (#652)
* fix 404 * delete console.log Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>
This commit is contained in:
parent
42261cfdca
commit
1b280259e5
@ -31,13 +31,11 @@ const actions = {
|
||||
if (!isEmptyValue(organization)) {
|
||||
organizationUuid = organization.uuid
|
||||
}
|
||||
|
||||
const role = rootGetters['user/getRole']
|
||||
let roleUuid
|
||||
if (!isEmptyValue(role)) {
|
||||
roleUuid = role.uuid
|
||||
}
|
||||
|
||||
const sessionUuid = getToken()
|
||||
|
||||
loadMainMenu({
|
||||
|
@ -46,7 +46,8 @@ const state = {
|
||||
warehouse: {},
|
||||
isSession: false,
|
||||
sessionInfo: {},
|
||||
corporateBrandingImage: ''
|
||||
corporateBrandingImage: '',
|
||||
currentOrganization: 0
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
@ -71,6 +72,9 @@ const mutations = {
|
||||
SET_ORGANIZATIONS_LIST: (state, payload) => {
|
||||
state.organizationsList = payload
|
||||
},
|
||||
SET_CURRENT_ORGANIZATIONS: (state, payload) => {
|
||||
state.currentOrganization = payload
|
||||
},
|
||||
SET_ORGANIZATION: (state, organization) => {
|
||||
state.organization = organization
|
||||
if (organization) {
|
||||
@ -174,6 +178,12 @@ const actions = {
|
||||
const { role } = sessionInfo
|
||||
commit('SET_ROLE', role)
|
||||
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
|
||||
await dispatch('getOrganizationsListFromServer', role.uuid)
|
||||
@ -221,7 +231,6 @@ const actions = {
|
||||
message: 'Verification failed, please Login again.'
|
||||
})
|
||||
}
|
||||
|
||||
// if (isEmptyValue(state.role)) {
|
||||
// const role = responseGetInfo.rolesList.find(itemRole => {
|
||||
// return itemRole.uuid === getCurrentRole()
|
||||
@ -333,7 +342,7 @@ const actions = {
|
||||
})
|
||||
},
|
||||
|
||||
getOrganizationsListFromServer({ commit, dispatch }, roleUuid) {
|
||||
getOrganizationsListFromServer({ commit, dispatch, getters }, roleUuid) {
|
||||
if (isEmptyValue(roleUuid)) {
|
||||
roleUuid = getCurrentRole()
|
||||
}
|
||||
@ -354,6 +363,14 @@ const actions = {
|
||||
} else {
|
||||
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('setPreferenceContext', {
|
||||
columnName: '#AD_Org_ID',
|
||||
@ -579,6 +596,9 @@ const getters = {
|
||||
},
|
||||
getIsPersonalLock: (state) => {
|
||||
return state.role.isPersonalLock
|
||||
},
|
||||
getCurrentOrg: (state) => {
|
||||
return state.currentOrganization
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user