diff --git a/src/store/modules/users.js b/src/store/modules/users.js index 174b56e2e..9b936e66c 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -113,7 +113,13 @@ const actions = { commit('SET_MFA_VERIFY') }, changeToView({ commit }, viewName) { - const usingOrgs = state[`${viewName}Orgs`] || state.consoleOrgs + const mapper = { + console: state.consoleOrgs, + audit: state.auditOrgs, + workbench: state.workbenchOrgs, + tickets: state.consoleOrgs + } + const usingOrgs = mapper[viewName] || state.consoleOrgs Vue.$log.debug('Set using orgs: ', viewName, usingOrgs) commit('SET_USING_ORGS', usingOrgs) } diff --git a/src/utils/jms.js b/src/utils/jms.js index 30554b7c9..c57b8d35e 100644 --- a/src/utils/jms.js +++ b/src/utils/jms.js @@ -82,6 +82,7 @@ export function hasActionPerm(route, action) { export function getPermedViews() { const viewShowMapper = [ ['console', store.getters.consoleOrgs.length > 0], + ['tickets', store.getters.consoleOrgs.length > 0], ['audit', store.getters.auditOrgs.length > 0], ['workbench', true] ] diff --git a/src/utils/org.js b/src/utils/org.js index 4ff1b8e88..53842ea14 100644 --- a/src/utils/org.js +++ b/src/utils/org.js @@ -10,7 +10,7 @@ function getPropOrg() { if (defaultOrg) { return defaultOrg } - return orgs[0] + return orgs.filter(item => !item.is_root)[0] } function change2PropOrg() { diff --git a/src/utils/startup.js b/src/utils/startup.js index bd18a5167..4a4056643 100644 --- a/src/utils/startup.js +++ b/src/utils/startup.js @@ -120,7 +120,7 @@ export async function checkUserFirstLogin({ to, from, next }) { export async function changeCurrentViewIfNeed({ to, from, next }) { let viewName = to.path.split('/')[1] // 这几个是需要检测的, 切换视图组织时,避免 404 - if (['console', 'audit', 'workbench', ''].indexOf(viewName) === -1) { + if (['console', 'audit', 'workbench', 'tickets', ''].indexOf(viewName) === -1) { Vue.$log.debug('Current view no need check', viewName) return }