diff --git a/src/jmapNew/theme/beijing_01/menus/passiveDialog/alarm.vue b/src/jmapNew/theme/beijing_01/menus/passiveDialog/alarm.vue index c8fa1ad48..5f44f2755 100644 --- a/src/jmapNew/theme/beijing_01/menus/passiveDialog/alarm.vue +++ b/src/jmapNew/theme/beijing_01/menus/passiveDialog/alarm.vue @@ -66,7 +66,7 @@
- 报警详细描述
+ 报警详细描述
@@ -134,7 +134,6 @@ export default { type: operate.type, name: station.name }; - this.doShow(newOperate); } } diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 36d549d87..23cdb120b 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -277,22 +277,22 @@ function handle(state, data) { function handleSimulationInfo(state, data) { switch (data.messageType) { case 'INVITE': - state.inviteSimulationConversition = data; + state.inviteSimulationConversation = data; break; case 'CONNECT': state.acceptConversionInvite = data; break; case 'OVER': - state.overConversition = data; + state.overConversation = data; break; case 'MESSAGE': state.conversationInfo = data; break; case 'CREATE': - state.createConversition = data; + state.createConversation = data; break; case 'EXIT': - state.exitConversition = data; + state.exitConversation = data; break; } } @@ -337,11 +337,11 @@ const socket = { simulationStart: '', // 仿真-开始消息 simulationOver:0, // 退出仿真推送消息 simulationReset: 0, // 仿真-异常消息 - inviteSimulationConversition: {}, // 仿真会话邀请消息 + inviteSimulationConversation: {}, // 仿真会话邀请消息 acceptConversionInvite:{}, // 仿真会话成员接收邀请 - createConversition:{}, // 仿真创建会话 - overConversition: {}, // 仿真会话结束 - exitConversition: {}, // 仿真成员退出会话 + createConversation:{}, // 仿真创建会话 + overConversation: {}, // 仿真会话结束 + exitConversation: {}, // 仿真成员退出会话 conversationInfo: {}, // 仿真会话消息 ticketInfo: {}, // 路票消息 @@ -431,12 +431,17 @@ const socket = { state.msgQueue.shift(); state.msgHead = state.msgQueue[0]; }, + handlePushMsgQueue: (state, msg) => { + if (msg instanceof Array) { + state.msgQueue.concat(msg); + } else { + state.msgQueue.push(msg); + } - // (旧版可能在用,新版地图不用这个) - pushMsgQueue: (state, msg) => { - handlePushMsgQueue(state, msg); + if (!state.msgHead) { + state.msgHead = state.msgQueue[0]; + } }, - setSimulationInvite: (state, simulationInvite) => { state.simulationInvite = simulationInvite; }, @@ -454,6 +459,9 @@ const socket = { setIsFirst:(state, isFirst)=>{ state.isFirst = isFirst; }, + setSimulationRoleList: (state, data) => { + state.simulationRoleList = data; + }, clearSimulationRoleList: (state)=>{ state.simulationRoleList = []; }, @@ -497,6 +505,73 @@ const socket = { }, clearTrainingOverCount: (state) => { state.trainingOverCount = 0; + }, + setPayOrder: (state, payOrder) => { + state.payOrder = payOrder; + }, + setSimulationScriptTip: (state, data) => { + state.simulationScriptTip = data; + }, + simulationScriptTipFinishIncrease: (state) => { + state.simulationScriptTipFinish++; + }, + clearSimulationScriptTipFinish: (state) => { + state.simulationScriptTipFinish = 0; + }, + simulationScriptTipErrorIncrease: (state) => { + state.simulationScriptTipError++; + }, + simulationOverIncrease: (state) => { + state.simulationOver++; + }, + setScriptAction: (state, data) => { + state.setScriptAction = data; + }, + autoFaultTriggerIncrease: (state) => { + state.autoFaultTrigger++; + }, + simulationErrorIncrease: (state) => { + state.simulationError++; + }, + simulationResetIncrease: (state) => { + state.simulationReset++; + }, + setInviteSimulationConversation: (state, data) => { + state.inviteSimulationConversation = data; + }, + setAcceptConversionInvite: (state, data) => { + state.acceptConversionInvite = data; + }, + setOverConversation: (state, data) => { + state.overConversation = data; + }, + setConversationInfo: (state, data) => { + state.conversationInfo = data; + }, + setCreateConversation: (state, data) => { + state.createConversation = data; + }, + setExitConversation: (state, data) => { + state.exitConversation = data; + }, + memberChangeCountIncrease: (state) => { + state.memberChangeCount++; + }, + setLoggedOutMsg: (state, msg) => { + state.loggedOutMsg = msg; + state.beLogoutCount++; + }, + runPlanReloadCountIncrease: (state) => { + state.runPlanReloadCount++; + }, + setSimulationIbpStatus: (state, data) => { + state.simulationIbpStatus = data; + }, + competitionPracticeFinishIncrease: (state) => { + state.competitionPracticeFinish++; + }, + setSimulationAlarmInfo: (state, data) => { + state.simulationAlarmInfo = data; } }, @@ -517,28 +592,28 @@ const socket = { commit('setStationPfiNum', null); }, - setEquipmentStatus: ({ commit }) => { - commit('setEquipmentStatus', []); + setEquipmentStatus: ({ commit }, data = []) => { + commit('setEquipmentStatus', data); }, setDeviceStateMessages: ({ commit }) => { commit('setDeviceStateMessages', null); }, - setTrainStationList: ({ commit }) => { - commit('setTrainStationList', []); + setTrainStationList: ({ commit }, data) => { + commit('setTrainStationList', data || []); }, - setSimulationStart: ({ commit }) => { - commit('setSimulationStart', ''); + setSimulationStart: ({ commit }, data) => { + commit('setSimulationStart', data || ''); }, setSimulationReset: ({ commit }) => { commit('setSimulationReset', 0); }, - setSimulationInvite: ({ commit }) => { - commit('setSimulationInvite', {}); + setSimulationInvite: ({ commit }, data) => { + commit('setSimulationInvite', data || {}); }, setMessage: ({ state }, data) => { if (!state.message[data.key]) { @@ -566,6 +641,9 @@ const socket = { setIsFirst:({ commit }, isFirst) => { commit('setIsFirst', isFirst); }, + setSimulationRoleList: ({ commit }, data) => { + commit('setSimulationRoleList', data); + }, clearSimulationRoleList:({ commit }) => { commit('clearSimulationRoleList'); }, @@ -595,6 +673,75 @@ const socket = { }, clearTrainingOverCount: ({ commit }) => { commit('clearTrainingOverCount'); + }, + setPayOrder: ({ commit }, payOrder) => { + commit('setPayOrder', payOrder); + }, + setSimulationScriptTip: ({ commit }, data) => { + commit('setSimulationScriptTip', data); + }, + simulationScriptTipFinishIncrease: ({ commit }) => { + commit('simulationScriptTipFinishIncrease'); + }, + clearSimulationScriptTipFinish: ({ commit }) => { + commit('clearSimulationScriptTipFinish'); + }, + simulationScriptTipErrorIncrease: ({ commit }) => { + commit('simulationScriptTipErrorIncrease'); + }, + simulationOverIncrease: ({ commit }) => { + commit('simulationOverIncrease'); + }, + setScriptAction: ({ commit }, data) => { + commit('setScriptAction', data); + }, + autoFaultTriggerIncrease: ({ commit }) => { + commit('autoFaultTriggerIncrease'); + }, + simulationErrorIncrease: ({ commit }) => { + commit('simulationErrorIncrease'); + }, + simulationResetIncrease: ({ commit }) => { + commit('simulationResetIncrease'); + }, + setInviteSimulationConversation: ({ commit }, data) => { + commit('setInviteSimulationConversation', data); + }, + setAcceptConversionInvite: ({ commit }, data) => { + commit('setAcceptConversionInvite', data); + }, + setOverConversation: ({ commit }, data) => { + commit('setOverConversation', data); + }, + setConversationInfo: ({ commit }, data) => { + commit('setConversationInfo', data); + }, + setCreateConversation: ({ commit }, data) => { + commit('setCreateConversation', data); + }, + setExitConversation: ({ commit }, data) => { + commit('setExitConversation', data); + }, + handlePushMsgQueue: ({ commit }, data) => { + commit('handlePushMsgQueue', data); + }, + memberChangeCountIncrease: ({ commit }) => { + commit('memberChangeCountIncrease'); + }, + setLoggedOutMsg: ({ commit }, data) => { + commit('setLoggedOutMsg', data); + }, + runPlanReloadCountIncrease: ({ commit }) => { + commit('runPlanReloadCountIncrease'); + }, + setSimulationIbpStatus: ({ commit }, data) => { + commit('setSimulationIbpStatus', data); + }, + competitionPracticeFinishIncrease: ({ commit }) => { + commit('competitionPracticeFinishIncrease'); + }, + setSimulationAlarmInfo: ({ commit }, data) => { + commit('setSimulationAlarmInfo', data); } } }; diff --git a/src/utils/subscribeCallback.js b/src/utils/subscribeCallback.js index b9626bfd5..f120d7341 100644 --- a/src/utils/subscribeCallback.js +++ b/src/utils/subscribeCallback.js @@ -1,4 +1,5 @@ import store from '@/store/index'; +import { copyAssign } from '@/utils/index'; import {Notification} from 'element-ui'; export function atsCallback() { const data = {res:JSON.parse(Response.body), type:'ats' }; @@ -27,66 +28,61 @@ function handle(state, data) { const msg = data.body; switch (data.type) { case 'Order_Pay_Result': // 订单支付结果消息 - state.payOrder = msg; + store.dispatch('socket/setPayOrder', msg); break; case 'Simulation_DeviceStatus': // 仿真-设备状态消息 - state.equipmentStatus = msg; + store.dispatch('socket/setEquipmentStatus', msg); break; case 'Simulation_User': // 仿真-进出仿真消息 - handleSimulationUserinfo(state, msg); // 用户进出仿真消息 + store.dispatch('socket/setSimulationRoleList', (data instanceof Array) ? data : [data]); break; case 'Simulation_Script_Action_Tip': // 剧本提示消息 - handleSimulationScriptTipInfo(state, msg); // 剧本提示消息 + store.dispatch('socket/setSimulationScriptTip', data); break; - case 'Simulation_Script_Action_Finish': - state.simulationScriptTipFinish++; // 剧本某一部操作完成提示 + case 'Simulation_Script_Action_Finish': // 剧本某一部操作完成提示 + store.dispatch('socket/simulationScriptTipFinishIncrease'); break; - case 'Simulation_Script_Action_Error': - state.simulationScriptTipError++; // 剧本某一部操作执行错误 + case 'Simulation_Script_Action_Error': // 剧本某一部操作执行错误 + store.dispatch('socket/simulationScriptTipErrorIncrease'); break; case 'Simulation_Over': // 用户退出仿真推送消息 - state.simulationOver++; // 用户退出仿真推送消息 + store.dispatch('socket/simulationOverIncrease'); break; case 'Simulation_Script_Action':// 剧本编制添加指令的推送消息 - state.scriptAction = msg; + store.dispatch('socket/setScriptAction', msg); break; case 'Simulation_AutoFault_Trigger': // 自动故障触发操作推送消息 - state.autoFaultTrigger++; + store.dispatch('socket/autoFaultTriggerIncrease'); break; case 'Simulation_RunFact': // 仿真-列车实际到发车站消息 - if (!Array.isArray(msg)) { - state.trainStationList = [msg]; - } else { - state.trainStationList = msg; - } + store.dispatch('socket/setTrainStationList', Array.isArray(msg) ? msg : [msg]); break; case 'Simulation_Error': // 仿真-异常消息 - state.simulationError += 1; + store.dispatch('socket/simulationErrorIncrease'); break; case 'Simulation_RunAsPlan_Start': // 仿真-仿真开始按计划行车消息 - state.simulationStart = msg; + store.dispatch('socket/setSimulationStart', msg); break; case 'Simulation_Reset': // 仿真-仿真重置消息 退出计划行车 - state.simulationReset += 1; + store.dispatch('socket/simulationResetIncrease'); break; case 'Simulation_Conversation': // 仿真-用户交互消息(聊天/命令) - handleSimulationInfo(state, msg); + handleSimulationInfo(msg); break; case 'Simulation_Conversation_Operation': // 仿真-用户交互消息(聊天/命令)-新 - handleSimulationInfo(state, {id: msg.id, message: msg, messageType: 'MESSAGE'}); + handleSimulationInfo({id: msg.id, message: msg, messageType: 'MESSAGE'}); break; case 'Simulation_ApplyHandle': // 请求处理消息(旧版可能在用,新版地图不用这个) - handlePushMsgQueue(state, msg); + store.dispatch('socket/handlePushMsgQueue', msg); break; case 'Simulation_Invite': // 综合演练-仿真邀请消息 - state.simulationInvite = msg; + store.dispatch('socket/setSimulationInvite', msg); break; case 'Be_Logged_Out': // 重复登录被登出 - state.beLogoutCount++; - state.loggedOutMsg = msg; + store.dispatch('socket/setLoggedOutMsg', msg); break; case 'Simulation_Run_Plan_Reload': // 运行图变更 - state.runPlanReloadCount++; + store.dispatch('socket/runPlanReloadCountIncrease'); break; case 'Simulation_Control_Pause': // 暂停中 store.dispatch('scriptRecord/updateSimulationPause', msg); @@ -102,19 +98,19 @@ function handle(state, data) { }); break; case 'Simulation_Member': - state.memberChangeCount++; + store.dispatch('socket/memberChangeCountIncrease'); break; case 'Simulation_Time_Sync': - state.simulationTimeSync = msg; + store.dispatch('socket/setSimulationTimeSync', msg); break; case 'Simulation_IbpStatus': - state.simulationIbpStatus = msg; + store.dispatch('socket/setSimulationIbpStatus', msg); break; case 'Simulation_Competition_Practice_Finish': - state.competitionPracticeFinish++; + store.dispatch('socket/competitionPracticeFinishIncrease'); break; case 'Simulation_Alarm': - state.simulationAlarmInfo = msg; + store.dispatch('socket/setSimulationAlarmInfo', msg); break; case 'STATION_PFI_NUM': state.stationPfiNum = msg; @@ -228,6 +224,26 @@ function handle(state, data) { break; } } -function handleSimulationUserinfo(state, data) { - state.simulationRoleList = (data instanceof Array) ? data : [data]; +// 仿真内部聊天 +function handleSimulationInfo(data) { + switch (data.messageType) { + case 'INVITE': + store.dispatch('socket/setInviteSimulationConversation', data); + break; + case 'CONNECT': + store.dispatch('socket/setAcceptConversionInvite', data); + break; + case 'OVER': + store.dispatch('socket/setOverConversation', data); + break; + case 'MESSAGE': + store.dispatch('socket/setConversationInfo', data); + break; + case 'CREATE': + store.dispatch('socket/setCreateConversation', data); + break; + case 'EXIT': + store.dispatch('socket/setExitConversation', data); + break; + } } diff --git a/src/views/newMap/chatView/chatBox.vue b/src/views/newMap/chatView/chatBox.vue index 2a4756ab5..e9149f81d 100644 --- a/src/views/newMap/chatView/chatBox.vue +++ b/src/views/newMap/chatView/chatBox.vue @@ -298,14 +298,14 @@ export default { } }); }, - '$store.state.socket.createConversition':function(val) { + '$store.state.socket.createConversation':function(val) { val.memberList.forEach(member => { // if (val.creatorId == member.memberId) { this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: [], connect:member.connect}); // } }); }, - '$store.state.socket.inviteSimulationConversition':function(val) { + '$store.state.socket.inviteSimulationConversation':function(val) { this.treeData.forEach(item => { if (item.children) { const memberList = Object.values(item.children); @@ -350,7 +350,7 @@ export default { }, deep: true }, - '$store.state.socket.exitConversition': function (val) { + '$store.state.socket.exitConversation': function (val) { for (const memberId in this.conversitionStateMap) { if (memberId == val.memberId) { this.conversitionStateMap[memberId].connect = false; diff --git a/src/views/newMap/chatView/voiceChatBox.vue b/src/views/newMap/chatView/voiceChatBox.vue index 09276a89c..dce59c449 100644 --- a/src/views/newMap/chatView/voiceChatBox.vue +++ b/src/views/newMap/chatView/voiceChatBox.vue @@ -193,14 +193,14 @@ export default { } }); }, - '$store.state.socket.createConversition':function(val) { + '$store.state.socket.createConversation':function(val) { val.memberList.forEach(member => { // if (val.creatorId == member.memberId) { this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: [], connect:member.connect}); // } }); }, - '$store.state.socket.inviteSimulationConversition':function(val) { + '$store.state.socket.inviteSimulationConversation':function(val) { this.treeData.forEach(item => { if (item.children) { const memberList = Object.values(item.children); @@ -251,7 +251,7 @@ export default { }, deep: true }, - '$store.state.socket.exitConversition': function (val) { + '$store.state.socket.exitConversation': function (val) { for (const memberId in this.conversitionStateMap) { if (memberId == val.memberId) { this.conversitionStateMap[memberId].connect = false; diff --git a/src/views/newMap/display/terminals/index.vue b/src/views/newMap/display/terminals/index.vue index c47eb3489..c09476a5a 100644 --- a/src/views/newMap/display/terminals/index.vue +++ b/src/views/newMap/display/terminals/index.vue @@ -106,7 +106,6 @@ export default { } }, async subscribe() { // 根据显示端分别订阅 - this.clearSubscribe(); const header = {group: this.group || '', 'X-Token': getToken()}; await creatSubscribe(`${displayTopic}\/${this.group}`, header); await creatSubscribe(getTopic('STATE', this.group), header);