diff --git a/src/scripts/ConstDic.js b/src/scripts/ConstDic.js index 653879ee3..e8ba90746 100644 --- a/src/scripts/ConstDic.js +++ b/src/scripts/ConstDic.js @@ -377,3 +377,7 @@ export const UserOperationType = { CHOOSEVALUE: '选择', FILLVALUE: '填写' }; +export const SimulationUserType = { + TEACHER: 'TEACHER', + STUDENT: 'STUDENT' +}; diff --git a/src/store/modules/training.js b/src/store/modules/training.js index 34f1b90b5..82aa9da4c 100644 --- a/src/store/modules/training.js +++ b/src/store/modules/training.js @@ -3,6 +3,7 @@ import { TrainingMode } from '@/scripts/ConstDic'; import deviceType from '../../jmapNew/constant/deviceType'; import LangStorage from '@/utils/lang'; import { deepAssign } from '@/utils/index'; +import store from '@/store/index'; /** * 实训状态数据 @@ -47,7 +48,8 @@ const training = { trainingStart: false, // 实训开始状态 notifySelected: null, // 场景弹窗内容 runPathList:[], // 运行线 (宁波三号线) - domConfig: {} // 线路功能前端配置项 + domConfig: {}, // 线路功能前端配置项 + simulationUserType: '' // 仿真用户角色 }, getters: { @@ -211,6 +213,12 @@ const training = { } }, setSimulationUserList: (state, simulationUserList) => { + state.simulationUserType = ''; + simulationUserList.forEach(item => { + if (item.userId == store.state.user.id ) { + state.simulationUserType = item.userType; + } + }); state.simulationUserList = simulationUserList; }, updateMemberTrust:(state, {deviceCode, trust}) => { @@ -244,7 +252,7 @@ const training = { user.online = item.online; user.memberId = item.memberId; user.role = item.role; - user.type = item.type; + user.memberType = item.memberType; user.deviceCode = item.deviceCode; memberIndex = index; } diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index f84210e59..9de79fd8a 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -23,13 +23,13 @@ export function handlerUrl() { let OSS_URL; if (process.env.NODE_ENV === 'development') { // 开发分支 - BASE_API = 'http://192.168.3.233/rtss-server'; + // BASE_API = 'http://192.168.3.233/rtss-server'; // BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://114.116.51.125/jlcloud'; // BASE_API = 'http://192.168.3.90:9000'; // 周寅 // BASE_API = 'http://192.168.3.94:9000'; // 旭强 - // BASE_API = 'http://192.168.3.15:9000'; // 张赛 + BASE_API = 'http://192.168.3.15:9000'; // 张赛 // BASE_API = 'http://192.168.3.5:9000'; // 夏增彬 // BASE_API = 'http://192.168.3.37:9000'; // 卫志宏 // BASE_API = 'http://b29z135112.zicp.vip'; diff --git a/src/utils/stomp.js b/src/utils/stomp.js index 2c9a62d51..3aa4ac6e4 100644 --- a/src/utils/stomp.js +++ b/src/utils/stomp.js @@ -62,6 +62,9 @@ export function getTopic(type, group, param) { case 'YJDDZH': topic = `/topic/yjddzh/trainPosition`; break; + case 'RUNFACT': + topic = `/user/queue/simulation/${group}/runFact`; + break; } return topic; diff --git a/src/views/newMap/display/index.vue b/src/views/newMap/display/index.vue index f84ec22c2..4fbe82c5d 100644 --- a/src/views/newMap/display/index.vue +++ b/src/views/newMap/display/index.vue @@ -29,6 +29,7 @@ import TrainingMenu from './trainingList/trainingMenu'; import TrainingDesign from './trainingDesign/designPane.vue'; import VoiceChatBox from './voiceChatBox'; import DesignTrainingMenu from './trainingList/designTrainingMenu'; +import { SimulationUserType } from '@/scripts/ConstDic'; export default { name: 'DisplayDraft', components: { @@ -99,7 +100,9 @@ export default { this.$store.dispatch('trainingNew/clearStepOverCount'); this.$store.dispatch('trainingNew/trainingEnd'); this.$store.dispatch('trainingNew/changeTeachMode', ''); - clearSimulation(this.group); + if (this.$store.state.training.simulationUserType === SimulationUserType.TEACHER) { + clearSimulation(this.group); + } }, methods:{ // 缩放设置 @@ -141,9 +144,6 @@ export default { this.$nextTick(() => { EventBus.$emit('viewLoading', false); }); - }, - // 仿真错误时,被动退出时调用 - async back() { } } }; diff --git a/src/views/newMap/display/memberManage/addMember.vue b/src/views/newMap/display/memberManage/addMember.vue index a722af4ff..988c48c35 100644 --- a/src/views/newMap/display/memberManage/addMember.vue +++ b/src/views/newMap/display/memberManage/addMember.vue @@ -4,6 +4,7 @@ :title="title" :visible.sync="dialogVisible" width="500px" + append-to-body :before-close="handleClose" center :close-on-click-modal="false" @@ -100,7 +101,7 @@ export default { } }, methods: { - initData(row) { + initData() { this.filterStationList = []; this.stationList.forEach(item => { if (!item.depot) { @@ -108,8 +109,8 @@ export default { } }); }, - doShow(row) { - this.initData(row); + doShow() { + this.initData(); this.dialogVisible = true; }, doSave() { diff --git a/src/views/newMap/display/memberManage/e-members.vue b/src/views/newMap/display/memberManage/e-members.vue index 989e199b0..d90f9bd79 100644 --- a/src/views/newMap/display/memberManage/e-members.vue +++ b/src/views/newMap/display/memberManage/e-members.vue @@ -16,8 +16,8 @@ @node-contextmenu="handleShowContextMenu" > - {{ data.nickName + (data.admin? '【管理员】':'') + (data.referee? '【裁判员】':'') + (data.deviceVO? ` -- (${data.deviceVO.code})`:'') }} - {{ data.nickName + (data.admin? '【管理员】':'') + (data.referee? '【裁判员】':'') + (data.deviceVO? ` -- (${data.deviceVO.code})`:'') }} + {{ data.nickName + (data.userType === 'TEACHER'? '【教员】':'') + (data.referee? '【裁判员】':'') + (data.deviceVO? ` -- (${data.deviceVO.code})`:'') }} + {{ data.nickName + (data.userType === 'TEACHER'? '【教员】':'') + (data.referee? '【裁判员】':'') + (data.deviceVO? ` -- (${data.deviceVO.code})`:'') }} @@ -29,6 +29,7 @@ - diff --git a/src/views/newMap/display/simulationMenu/simulationMenu.vue b/src/views/newMap/display/simulationMenu/simulationMenu.vue index d7c69e9db..28a4ef39e 100644 --- a/src/views/newMap/display/simulationMenu/simulationMenu.vue +++ b/src/views/newMap/display/simulationMenu/simulationMenu.vue @@ -16,8 +16,6 @@ - - @@ -35,8 +33,7 @@ import ExamPanel from '../exam/examPanel'; import getErrorTip from '@/scripts/errorTip'; import DeviceManage from './deviceManage'; import QrCode from '@/components/QrCode'; -import DiagramLoad from './diagramLoad'; -import DiagramPreview from './diagramPreview'; +import { SimulationUserType } from '@/scripts/ConstDic'; export default { name: 'SimulationMenu', @@ -49,9 +46,7 @@ export default { Jl3dDevice, MemberManage, DeviceManage, - QrCode, - DiagramPreview, - DiagramLoad + QrCode }, data() { return { @@ -62,16 +57,14 @@ export default { deviceShow: true, allMenuList: [ { label: '设备视图', name: 'jlmap3dmodel', click: this.jlmap3dmodel, isDisabled: () => { return false; }, isShow: () => { return true; } }, - { label: '设备管理', name: 'deviceManage', click: this.deviceManage, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.training.domConfig.hasDeviceManage; } }, + { label: '设备管理', name: 'deviceManage', click: this.deviceManage, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.training.domConfig.hasDeviceManage && this.$store.state.training.simulationUserType === SimulationUserType.TEACHER; } }, { label: '联系方式', name: 'contectUs', click: this.contectUs, isDisabled: () => { return false; }, isShow: () => { return true; } }, - { label: '生成二维码', name: 'generateQrCode', click: this.generateQrCode, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.training.domConfig.isJoint; } }, - { label: '切换客流数据', name: 'changeFlowData', click: this.changeFlowData, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.training.domConfig.hasLpf; } }, - { label: '运行图加载', name: 'diagramLoad', click: this.diagramLoad, isDisabled: () => { return false; }, isShow: ()=>{ return this.$route.query.simType === 'METRO'; } }, - { label: '运行图预览', name: 'diagramPreview', click: this.diagramPreview, isDisabled: () => { return false; }, isShow: ()=>{ return this.$route.query.simType === 'METRO'; } }, - { label: '成员管理', name: 'memberManage', click: this.memberManage, isDisabled: () => { return false; }, isShow: () => { return !this.$store.state.training.domConfig.hasMemberManage; } }, - { label: '考试', name: 'exam', click: this.goExam, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.training.domConfig.hasExam; } }, - { label: '按计划行车', name: 'drivingPlan', click: this.drivingPlan, isDisabled: () => { return this.$store.state.trainingNew.trainingSwitch; }, isShow: () => { return true; } }, - { label: '初始化', name: 'initialize', click: this.initializeSim, isDisabled: () => { return this.$store.state.trainingNew.trainingSwitch; }, isShow: () => { return true; } }, + { label: '生成二维码', name: 'generateQrCode', click: this.generateQrCode, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.training.domConfig.isJoint && this.$store.state.training.simulationUserType === SimulationUserType.TEACHER; } }, + { label: '切换客流数据', name: 'changeFlowData', click: this.changeFlowData, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.training.domConfig.hasLpf && this.$store.state.training.simulationUserType === SimulationUserType.TEACHER; } }, + { label: '成员管理', name: 'memberManage', click: this.memberManage, isDisabled: () => { return false; }, isShow: () => { return !this.$store.state.training.domConfig.hasMemberManage && this.$store.state.training.simulationUserType === SimulationUserType.TEACHER; } }, + { label: '考试', name: 'exam', click: this.goExam, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.training.domConfig.hasExam && this.$store.state.training.simulationUserType === SimulationUserType.TEACHER; } }, + { label: '按计划行车', name: 'drivingPlan', click: this.drivingPlan, isDisabled: () => { return this.$store.state.trainingNew.trainingSwitch; }, isShow: () => { return this.$store.state.training.simulationUserType === SimulationUserType.TEACHER; } }, + { label: '初始化', name: 'initialize', click: this.initializeSim, isDisabled: () => { return this.$store.state.trainingNew.trainingSwitch; }, isShow: () => { return this.$store.state.training.simulationUserType === SimulationUserType.TEACHER; } }, { label: '退出', name: 'quit', click: this.exitSim, isDisabled: () => { return false; }, isShow: () => { return true; } } ] }; @@ -90,6 +83,22 @@ export default { return this.$route.query.mapId; } }, + watch: { + '$store.state.training.simulationUserType': function (val) { + this.handleMenuShow(); + }, + '$store.state.socket.simulationOver':function(val) { + this.back(); + }, + '$store.state.socket.simulationRoleList':function(val) { + console.log('**************', val); + (val || []).forEach(item => { + if (item.body.messageType === 'KICK_OUT' && item.body.userId == this.$store.state.user.id) { + this.back(); + } + }); + } + }, mounted() { window.addEventListener('click', this.close, false); }, @@ -101,14 +110,6 @@ export default { this.$store.dispatch('trainingNew/changeTeachMode', ''); }, methods: { - diagramLoad() { - this.hideMenuList(); - this.$refs.diagramLoad.doShow(); - }, - diagramPreview() { - this.hideMenuList(); - this.$refs.diagramPreview.doShow(); - }, generateQrCode() { this.hideMenuList(); getSimulationQrcode(this.$route.query.group).then(resp => { @@ -178,17 +179,20 @@ export default { cancelButtonText: '取 消', type: 'warning' }).then(() => { - if (this.projectDevice && this.$route.query.type === 'IM') { - clearSimulation(this.group).then(() => { - this.logout(); - }); - } else if (this.projectDevice) { - this.logout(); - } else { - this.$router.go(-1); - } + this.back(); }); }, + back() { + if (this.projectDevice && this.$route.query.type === 'IM') { + clearSimulation(this.group).then(() => { + this.logout(); + }); + } else if (this.projectDevice) { + this.logout(); + } else { + this.$router.go(-1); + } + }, initializeSim() { initSimulation(this.group).then(() => { this.$store.dispatch('training/setMapDefaultState').then(() => { diff --git a/src/views/newMap/display/terminals/bigScreen.vue b/src/views/newMap/display/terminals/bigScreen.vue index e6a762d2f..a67e34b82 100644 --- a/src/views/newMap/display/terminals/bigScreen.vue +++ b/src/views/newMap/display/terminals/bigScreen.vue @@ -31,7 +31,7 @@ export default { } }, watch: { - '$store.state.map.initJlmapLoadedCount': function (val) { + '$store.state.map.initJlmapLoadedCount': function () { this.handleBigScreenData(); }, mapDevice() { diff --git a/src/views/newMap/display/simulationMenu/diagramLoad.vue b/src/views/newMap/display/terminals/diagramLoad.vue similarity index 81% rename from src/views/newMap/display/simulationMenu/diagramLoad.vue rename to src/views/newMap/display/terminals/diagramLoad.vue index 447c55af4..dc5aab8d1 100644 --- a/src/views/newMap/display/simulationMenu/diagramLoad.vue +++ b/src/views/newMap/display/terminals/diagramLoad.vue @@ -1,6 +1,6 @@ @@ -22,8 +22,7 @@ export default { }, data() { return { - menus: null, - show: false + menus: null }; }, computed: { @@ -53,19 +52,18 @@ export default { beforeDestroy() { this.$store.dispatch('runPlan/setPlanData', []); }, - methods: { - doShow() { - this.show = true; + mounted() { + this.$nextTick(() => { this.$refs.planSchedule.setPosition(); - }, - doClose() { - this.show = false; - } + this.$refs.planSchedule.loadChartPage(); + }); + }, + methods: { } };