diff --git a/src/App.vue b/src/App.vue index 33becda55..1bc2274ca 100644 --- a/src/App.vue +++ b/src/App.vue @@ -73,9 +73,6 @@ export default { this.loading = false; }, '$route': function(val) { - if (val.path == '/simulation/multiplayerSimulation') { - this.quickEntry(); - } if (val.path == '/display/demon' && val.query.client == 'diagramEdit') { // 运行图编制 this.loading = false; } diff --git a/src/jmapNew/theme/chengdu_01/menus/menuRequest.vue b/src/jmapNew/theme/chengdu_01/menus/menuRequest.vue index ee4aef700..1c0b4d54d 100644 --- a/src/jmapNew/theme/chengdu_01/menus/menuRequest.vue +++ b/src/jmapNew/theme/chengdu_01/menus/menuRequest.vue @@ -1,6 +1,6 @@ +
+ 帮助 +
{{ username }} 个人信息 @@ -141,6 +144,9 @@ export default { }, isCGY() { return getSessionStorage('project') === 'cgy'; + }, + helpShow() { + return this.$store.state.projectConfig.helpShow; } }, watch: { @@ -154,7 +160,9 @@ export default { }, mounted() { this.routes = this.$router.options.routes; - if (this.$route.fullPath.indexOf('design/usermap') >= 0) { + if (this.$route.fullPath.includes('/trainingPlatform/simulation')) { + this.activePath = '/simulation/simulationIndex'; + } else if (this.$route.fullPath.indexOf('design/usermap') >= 0) { this.activePath = '/design/usermap/home'; } else if (this.$route.fullPath.includes('design/lesson') || this.$route.fullPath.includes('design/script') || this.$route.fullPath.includes('design/runPlan') || this.$route.fullPath.includes('design/mapPreview')) { this.activePath = '/design/home'; @@ -163,6 +171,11 @@ export default { } }, methods: { + goToHelp() { + let href = ''; + href = this.$store.state.user.baseSite + '/docs/'; + window.open(href, '_blank'); + }, toggleSideBar() { this.$store.dispatch('ToggleSideBar'); }, @@ -269,4 +282,15 @@ export default { .targetDiv :hover { background-color: #434A50; } + .helpDiv { + height: 60px; + line-height: 60px; + color: #fff; + font-size: 14px; + cursor: pointer; + padding: 0 20px; + &:hover { + background-color: #434A50; + } + } diff --git a/src/permission.js b/src/permission.js index 9eece9784..60aa9e58a 100644 --- a/src/permission.js +++ b/src/permission.js @@ -43,8 +43,8 @@ function handleRoute(to, next, loginPath) { if (store.getters.roles.length == 0) { store.dispatch('GetInfo', getToken()).then(res => { // 根据roles权限生成可访问的路由表 - const roles = res.roles; - store.dispatch('GenerateRoutes', { roles }).then(() => { + // const roles = res.roles; + store.dispatch('GenerateRoutes', res).then(() => { router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表 if (to.redirectedFrom) { next({ path: to.redirectedFrom, replace: true }); @@ -113,7 +113,7 @@ router.beforeEach( async (to, from, next) => { // } const response = await getFrontProjectConfigByLogin(project); if (response.data) { - const {browserTitle, loginProLogo, baseApiUrl, baseSite, caseShow, ossUrl, homeTitle, homeProLogoWidth} = response.data.viewSetting; + const {browserTitle, loginProLogo, baseApiUrl, baseSite, caseShow, helpShow, ossUrl, homeTitle, homeProLogoWidth} = response.data.viewSetting; if (!store.state.user.baseUrl && project) { const urlData = handlerUrl(); store.dispatch('setBaseUrl', baseApiUrl || urlData.BASE_API); @@ -125,6 +125,7 @@ router.beforeEach( async (to, from, next) => { const url = loginProLogo ? store.state.user.ossUrl + '/logo/' + loginProLogo : ''; document.querySelector("link[rel*='icon']").href = url; store.commit('setCaseShow', caseShow); + store.commit('setHelpShow', helpShow); store.dispatch('setHomeProLogoWidth', homeProLogoWidth); store.dispatch('setLoginProLogo', url); store.dispatch('setHomeTitle', homeTitle); diff --git a/src/router/index.js b/src/router/index.js index 407910b4c..7516cb0f0 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -751,6 +751,7 @@ export const asyncRouter = [ meta: { roles: [admin, user] }, + hidden: true, children: [ { path: '', @@ -941,6 +942,7 @@ export const asyncRouter = [ i18n: 'router.pulishManage', roles: [admin] }, + hidden: true, children: [ { // 发布地图 path: 'map', @@ -1041,6 +1043,7 @@ export const asyncRouter = [ i18n: 'router.orderAuthorityManage', roles: [admin] }, + hidden: true, children: [ { path: 'author/manage', @@ -1112,6 +1115,7 @@ export const asyncRouter = [ i18n: 'router.systemManage', roles: [admin] }, + hidden: true, children: [ { path: 'dictionary', @@ -1323,6 +1327,7 @@ export const asyncRouter = [ i18n: 'router.fileManage', roles: [admin] }, + hidden: true, children: [ { path: 'list', @@ -1399,6 +1404,7 @@ export const asyncRouter = [ i18n: 'router.newDesignUserPage', roles: [admin, user] }, + hidden: true, children: [ { path: 'usermap', @@ -1505,6 +1511,7 @@ export const asyncRouter = [ i18n: 'router.raceManage', roles: [admin] }, + hidden: true, children: [ { path: 'bank', @@ -1549,7 +1556,7 @@ export const asyncRouter = [ component: Layout, meta: { i18n: 'newRouter.simulation', - roles: [admin, user, userTrainingPlatform] + roles: [user] }, children: [ { // 仿真 @@ -1578,6 +1585,7 @@ export const asyncRouter = [ { // 监管仿真 path: 'regulationSimulation', component: ExistingSimulation, + companyAdmin: true, meta: { i18n: 'newRouter.regulationSimulation' } @@ -1587,9 +1595,10 @@ export const asyncRouter = [ { // 新路由-教学管理菜单 path: '/teaching', component: Layout, + companyAdmin: true, meta: { i18n: 'newRouter.teachingManagement', - roles: [admin, user, userTrainingPlatform] + roles: [admin, user] }, children: [ { @@ -1756,7 +1765,7 @@ export const asyncRouter = [ component: Layout, meta: { i18n: 'newRouter.lineDesign', - roles: [admin, user, userTrainingPlatform] + roles: [admin, mapCreater] }, children: [ { @@ -1793,7 +1802,7 @@ export const asyncRouter = [ component: Layout, meta: { i18n: 'newRouter.case', - roles: [admin, user, userTrainingPlatform] + roles: [admin, user] }, children: [ { @@ -1827,7 +1836,7 @@ export const asyncRouter = [ component: Layout, meta: { i18n: 'newRouter.SystemManagement', - roles: [admin, userTrainingPlatform] + roles: [admin] }, children: [ { // 系统数据管理 diff --git a/src/scripts/cmdPlugin/OperationHandler.js b/src/scripts/cmdPlugin/OperationHandler.js index 0a65c5013..b6852ab49 100644 --- a/src/scripts/cmdPlugin/OperationHandler.js +++ b/src/scripts/cmdPlugin/OperationHandler.js @@ -471,11 +471,11 @@ export const OperationEvent = { // 进路 line_signal_route: { operation: '00a23', - domId: '_Tips-ningBo-line-signal-cmd{TOP}' + domId: '_Tips-ningBo-line-signal-route{TOP}' }, line_signal_route_cmd: { operation: '00a231', - domId: '_Tips-ningBo-line-signal-cmd{TOP}' + domId: '_Tips-ningBo-line-signal-route-cmd{TOP}' }, line_signal_route_show: { operation: '00a232', @@ -730,6 +730,21 @@ export const OperationEvent = { operation: '00c8', domId: '_Tips-ningBo1-areaSelection-doClose' } + }, + // 成都一 + commandChengDu1: { + confirm: { + operation: '00d', + domId: '_Tips-commandChengDu1-confirm{BOTTOM}' + }, + cancel: { + operation: '00d1', + domId: '_Tips-commandChengDu1-cancel{BOTTOM}' + }, + requestBar: { + operation: '00d2', + domId: '_Tips-commandChengDu1-requestBar{BOTTOM}' + } } }, // 站台概要表 diff --git a/src/store/index.js b/src/store/index.js index 213cc4d6a..7f5f0d01c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -20,6 +20,7 @@ import rpTools from './modules/rpTools'; import race from './modules/race'; import trainingNew from './modules/trainingNew'; import projectConfig from './modules/projectConfig'; +import lineList from './modules/lineList'; import getters from './getters'; @@ -46,7 +47,8 @@ const store = new Vuex.Store({ rpTools, race, trainingNew, - projectConfig + projectConfig, + lineList }, getters }); diff --git a/src/store/modules/lineList.js b/src/store/modules/lineList.js new file mode 100644 index 000000000..4b6b67fb0 --- /dev/null +++ b/src/store/modules/lineList.js @@ -0,0 +1,23 @@ +const lineList = { + namespaced: true, + + state: { + lineList: [] // 线路列表 + }, + mutations: { + setLineList: (state, lineList) => { + if (lineList && lineList.length) { + state.lineList = lineList; + } else { + state.lineList = []; + } + } + }, + actions: { + setLineList({ commit }, lineList) { + commit('setLineList', lineList); + } + } +}; + +export default lineList; diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 63a76fd8b..1a1bef2a3 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -3,6 +3,7 @@ import { publicAsyncRoute, asyncRouter, constantRoutes, user, projectTrain, proj projectSrsandbox, projectJxgm, projectSay, projectRichorhhcj, projectTeaching } from '@/router/index'; import { loginInfo } from '@/scripts/ProjectConfig'; import { getSessionStorage } from '@/utils/auth'; +import store from '@/store/index'; /** * 通过meta.role判断是否与当前用户权限匹配及子系统生成 @@ -13,6 +14,9 @@ function hasPermission(roles, route, parentsRoles) { if (!getSessionStorage('project')) { return false; } + if (route.companyAdmin) { // 判断有没有组织角色(管理员,教师) + return store.state.permission.companyAdmin || roles.includes(admin); + } if (route.meta && route.meta.roles) { // 如果存在本级路由,则使用自己的roles过滤 if (getSessionStorage('project').startsWith('design') || getSessionStorage('project').startsWith('refereeJsxt')) { @@ -20,7 +24,8 @@ function hasPermission(roles, route, parentsRoles) { return result.length && route.meta.roles.indexOf(userTrainingPlatform) < 0; } else { roles = roles.filter((role) => route.meta.roles.indexOf(role) >= 0); - return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) >= 0; + // return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) >= 0; + return roles.some(role => route.meta.roles.indexOf(role) >= 0); } } else if (parentsRoles) { // 如果没有本级路由,有父级路由,则使用父级路由过滤 @@ -84,19 +89,24 @@ function filterAsyncRouter(asyncRouter, roles, parentsRoles) { const permission = { state: { routes: constantRoutes, - addRouters: [] + addRouters: [], + companyAdmin: false }, mutations: { SET_ROUTERS: (state, routes) => { state.addRouters = routes; state.routes = constantRoutes.concat(routes); + }, + SET_COMANYADMIN: (state, companyAdmin) => { + state.companyAdmin = companyAdmin; } }, actions: { // 生成其他权限路由 GenerateRoutes({ commit, rootState }, data) { return new Promise(resolve => { - const { roles } = data; + const { roles, companyAdmin } = data; + commit('SET_COMANYADMIN', companyAdmin); if (roles.includes(superAdmin) && !roles.includes(admin)) { // 只拥有超级管理员 没有管理员权限 roles.push(admin); } diff --git a/src/store/modules/projectConfig.js b/src/store/modules/projectConfig.js index cda9a8fed..4e6ed7002 100644 --- a/src/store/modules/projectConfig.js +++ b/src/store/modules/projectConfig.js @@ -3,7 +3,8 @@ const user = { homeProLogoWidth:0, loginProLogo:'', homeTitle:'', - caseShow:true + caseShow: true, + helpShow: true }, mutations: { setHomeProLogoWidth: (state, homeProLogoWidth) => { @@ -17,6 +18,9 @@ const user = { }, setCaseShow: (state, caseShow) => { state.caseShow = caseShow; + }, + setHelpShow: (state, helpShow) => { + state.helpShow = helpShow; } }, actions: { @@ -31,6 +35,9 @@ const user = { }, setCaseShow({ commit }, caseShow) { commit('setCaseShow', caseShow); + }, + setHelpShow({ commit }, helpShow) { + commit('setHelpShow', helpShow); } } }; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 3d106bf1a..c3c3c19b1 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -272,21 +272,32 @@ export default { getLoginInfo(getToken()).then(resp => { const deviceVO = resp.data.deviceVO; if (deviceVO) { - const config = JSON.parse(deviceVO.config); + const config = JSON.parse(deviceVO.config || '{}'); if (config && config.roleCode) { const params = [{userId: res.id, memberId:config.roleCode}]; assignUsersPlayRoles(params, group).then(() => { this.enterSimulation(group, mapId, config); + }).catch(res=>{ + this.$message.error('切换角色失败'); + this.$store.dispatch('LogOut'); }); } } + }).catch(res=>{ + this.$message.error('获取用户信息失败'); + this.$store.dispatch('LogOut'); }); - + }).catch(res=>{ + this.$store.dispatch('LogOut'); }); } else { this.$message.error('请先配置项目信息'); + this.$store.dispatch('LogOut'); } } + }).catch(res=>{ + this.$message.error('获取项目信息失败'); + this.$store.dispatch('LogOut'); }); }, enterSimulation(group, mapId, config) { @@ -317,6 +328,8 @@ export default { // if (config.client) { query.client = config.client; } } this.$router.push({ path: `/display/demon`, query: query }); + }).catch(res=>{ + this.$store.dispatch('LogOut'); }); } } diff --git a/src/views/login/normalLogin.vue b/src/views/login/normalLogin.vue index dd2aa91b7..91eb51e5b 100644 --- a/src/views/login/normalLogin.vue +++ b/src/views/login/normalLogin.vue @@ -245,24 +245,35 @@ export default { createSimulation(functionId).then(resp => { const group = resp.data; this.assignUser(group, mapId); - }).catch(error=>{ if (error.code == 10003) { this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!'); + this.$store.dispatch('LogOut').then(() => { + location.reload(); // 为了重新实例化vue-router对象 避免bug + }); } else { this.$messageBox(this.$t('error.createSimulationFailed') + error.message); + this.$store.dispatch('LogOut').then(() => { + location.reload(); // 为了重新实例化vue-router对象 避免bug + }); } }); } else { getGroupByMapAndFunction(mapId, functionId).then(resp => { const group = resp.data; this.assignUser(group, mapId); + }).catch(res=>{ + this.$store.dispatch('LogOut'); }); } } else { this.$message.error('请先配置项目信息'); + this.$store.dispatch('LogOut'); } } + }).catch(res=>{ + this.$message.error('获取项目信息失败'); + this.$store.dispatch('LogOut'); }); }, assignUser(group, mapId) { @@ -270,17 +281,25 @@ export default { getLoginInfo(getToken()).then(resp => { const deviceVO = resp.data.deviceVO; if (deviceVO) { - const config = JSON.parse(deviceVO.config || {}); + const config = JSON.parse(deviceVO.config || '{}'); if (config && config.roleCode) { const params = [{userId: res.id, memberId:config.roleCode}]; assignUsersPlayRoles(params, group).then(() => { this.enterSimulation(group, mapId, config); + }).catch(res=>{ + this.$message.error('切换角色失败'); + this.$store.dispatch('LogOut'); }); + } else { + this.$message.error('请先配置设备相关信息'); + this.$store.dispatch('LogOut'); } } else { this.enterSimulation(group, mapId); } - + }).catch(res=>{ + this.$message.error('获取用户信息失败'); + this.$store.dispatch('LogOut'); }); }); }, @@ -301,6 +320,9 @@ export default { // if (config.client) { query.client = config.client; } } this.$router.push({ path: `/display/demon`, query: query }); + }).catch(res=>{ + this.$message.error('进入仿真失败'); + this.$store.dispatch('LogOut'); }); }, // 登陆 diff --git a/src/views/newMap/display/trainingDesign/editOperate.vue b/src/views/newMap/display/trainingDesign/editOperate.vue index 2ad47d8c8..cdddf4812 100644 --- a/src/views/newMap/display/trainingDesign/editOperate.vue +++ b/src/views/newMap/display/trainingDesign/editOperate.vue @@ -59,7 +59,7 @@ export default { operationType: val.cmdType ? val.cmdType.value : '', params: val.param || {} }; - if (['trainSetButton'].includes(val.subType)) { + if (['trainSetButton', 'light'].includes(val.subType)) { data.subType = val.subType; } this.stepDetail.operations.push(data); @@ -118,6 +118,9 @@ export default { this.stepDetail.tipPosition.domId = this.stepDetail.operations[this.tagIndex].domId; this.stepDetail.tipPosition.deviceCode = this.stepDetail.operations[this.tagIndex].deviceCode; this.stepDetail.tipPosition.operateIndex = this.tagIndex; + if (this.stepDetail.operations[this.tagIndex].subType) { + this.stepDetail.tipPosition.subType = this.stepDetail.operations[this.tagIndex].subType; + } } this.$emit('backDesignPane'); this.tagIndex = 0; diff --git a/src/views/trainingPlatform/demonList.vue b/src/views/trainingPlatform/demonList.vue index 70a1a8a1e..ee421f9c1 100644 --- a/src/views/trainingPlatform/demonList.vue +++ b/src/views/trainingPlatform/demonList.vue @@ -14,11 +14,10 @@ class="el-menu-vertical-demo" background-color="#545c64" text-color="#fff" - router active-text-color="#ffd04b" > @@ -28,7 +27,7 @@ diff --git a/src/views/trainingPlatform/index.vue b/src/views/trainingPlatform/index.vue index 6952b6d11..c97f9b701 100644 --- a/src/views/trainingPlatform/index.vue +++ b/src/views/trainingPlatform/index.vue @@ -1,7 +1,7 @@