This commit is contained in:
fan 2022-09-30 13:11:55 +08:00
parent eafd1634f5
commit 26062f736c
6 changed files with 223 additions and 62 deletions

View File

@ -66,7 +66,7 @@
<el-input v-model="model.recommendedOperation" disabled /> <el-input v-model="model.recommendedOperation" disabled />
</el-form-item> </el-form-item>
<div class="alarm-detail-description"> <div class="alarm-detail-description">
<span> 报警详细描述</span><br> <span>报警详细描述</span><br>
<el-input v-model="model.alarmDetail" type="textarea" :rows="5" placeholder="请输入内容" disabled /> <el-input v-model="model.alarmDetail" type="textarea" :rows="5" placeholder="请输入内容" disabled />
</div> </div>
</el-form> </el-form>
@ -134,7 +134,6 @@ export default {
type: operate.type, type: operate.type,
name: station.name name: station.name
}; };
this.doShow(newOperate); this.doShow(newOperate);
} }
} }

View File

@ -277,22 +277,22 @@ function handle(state, data) {
function handleSimulationInfo(state, data) { function handleSimulationInfo(state, data) {
switch (data.messageType) { switch (data.messageType) {
case 'INVITE': case 'INVITE':
state.inviteSimulationConversition = data; state.inviteSimulationConversation = data;
break; break;
case 'CONNECT': case 'CONNECT':
state.acceptConversionInvite = data; state.acceptConversionInvite = data;
break; break;
case 'OVER': case 'OVER':
state.overConversition = data; state.overConversation = data;
break; break;
case 'MESSAGE': case 'MESSAGE':
state.conversationInfo = data; state.conversationInfo = data;
break; break;
case 'CREATE': case 'CREATE':
state.createConversition = data; state.createConversation = data;
break; break;
case 'EXIT': case 'EXIT':
state.exitConversition = data; state.exitConversation = data;
break; break;
} }
} }
@ -337,11 +337,11 @@ const socket = {
simulationStart: '', // 仿真-开始消息 simulationStart: '', // 仿真-开始消息
simulationOver:0, // 退出仿真推送消息 simulationOver:0, // 退出仿真推送消息
simulationReset: 0, // 仿真-异常消息 simulationReset: 0, // 仿真-异常消息
inviteSimulationConversition: {}, // 仿真会话邀请消息 inviteSimulationConversation: {}, // 仿真会话邀请消息
acceptConversionInvite:{}, // 仿真会话成员接收邀请 acceptConversionInvite:{}, // 仿真会话成员接收邀请
createConversition:{}, // 仿真创建会话 createConversation:{}, // 仿真创建会话
overConversition: {}, // 仿真会话结束 overConversation: {}, // 仿真会话结束
exitConversition: {}, // 仿真成员退出会话 exitConversation: {}, // 仿真成员退出会话
conversationInfo: {}, // 仿真会话消息 conversationInfo: {}, // 仿真会话消息
ticketInfo: {}, // 路票消息 ticketInfo: {}, // 路票消息
@ -431,12 +431,17 @@ const socket = {
state.msgQueue.shift(); state.msgQueue.shift();
state.msgHead = state.msgQueue[0]; state.msgHead = state.msgQueue[0];
}, },
handlePushMsgQueue: (state, msg) => {
if (msg instanceof Array) {
state.msgQueue.concat(msg);
} else {
state.msgQueue.push(msg);
}
// (旧版可能在用,新版地图不用这个) if (!state.msgHead) {
pushMsgQueue: (state, msg) => { state.msgHead = state.msgQueue[0];
handlePushMsgQueue(state, msg); }
}, },
setSimulationInvite: (state, simulationInvite) => { setSimulationInvite: (state, simulationInvite) => {
state.simulationInvite = simulationInvite; state.simulationInvite = simulationInvite;
}, },
@ -454,6 +459,9 @@ const socket = {
setIsFirst:(state, isFirst)=>{ setIsFirst:(state, isFirst)=>{
state.isFirst = isFirst; state.isFirst = isFirst;
}, },
setSimulationRoleList: (state, data) => {
state.simulationRoleList = data;
},
clearSimulationRoleList: (state)=>{ clearSimulationRoleList: (state)=>{
state.simulationRoleList = []; state.simulationRoleList = [];
}, },
@ -497,6 +505,73 @@ const socket = {
}, },
clearTrainingOverCount: (state) => { clearTrainingOverCount: (state) => {
state.trainingOverCount = 0; 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); commit('setStationPfiNum', null);
}, },
setEquipmentStatus: ({ commit }) => { setEquipmentStatus: ({ commit }, data = []) => {
commit('setEquipmentStatus', []); commit('setEquipmentStatus', data);
}, },
setDeviceStateMessages: ({ commit }) => { setDeviceStateMessages: ({ commit }) => {
commit('setDeviceStateMessages', null); commit('setDeviceStateMessages', null);
}, },
setTrainStationList: ({ commit }) => { setTrainStationList: ({ commit }, data) => {
commit('setTrainStationList', []); commit('setTrainStationList', data || []);
}, },
setSimulationStart: ({ commit }) => { setSimulationStart: ({ commit }, data) => {
commit('setSimulationStart', ''); commit('setSimulationStart', data || '');
}, },
setSimulationReset: ({ commit }) => { setSimulationReset: ({ commit }) => {
commit('setSimulationReset', 0); commit('setSimulationReset', 0);
}, },
setSimulationInvite: ({ commit }) => { setSimulationInvite: ({ commit }, data) => {
commit('setSimulationInvite', {}); commit('setSimulationInvite', data || {});
}, },
setMessage: ({ state }, data) => { setMessage: ({ state }, data) => {
if (!state.message[data.key]) { if (!state.message[data.key]) {
@ -566,6 +641,9 @@ const socket = {
setIsFirst:({ commit }, isFirst) => { setIsFirst:({ commit }, isFirst) => {
commit('setIsFirst', isFirst); commit('setIsFirst', isFirst);
}, },
setSimulationRoleList: ({ commit }, data) => {
commit('setSimulationRoleList', data);
},
clearSimulationRoleList:({ commit }) => { clearSimulationRoleList:({ commit }) => {
commit('clearSimulationRoleList'); commit('clearSimulationRoleList');
}, },
@ -595,6 +673,75 @@ const socket = {
}, },
clearTrainingOverCount: ({ commit }) => { clearTrainingOverCount: ({ commit }) => {
commit('clearTrainingOverCount'); 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);
} }
} }
}; };

View File

@ -1,4 +1,5 @@
import store from '@/store/index'; import store from '@/store/index';
import { copyAssign } from '@/utils/index';
import {Notification} from 'element-ui'; import {Notification} from 'element-ui';
export function atsCallback() { export function atsCallback() {
const data = {res:JSON.parse(Response.body), type:'ats' }; const data = {res:JSON.parse(Response.body), type:'ats' };
@ -27,66 +28,61 @@ function handle(state, data) {
const msg = data.body; const msg = data.body;
switch (data.type) { switch (data.type) {
case 'Order_Pay_Result': // 订单支付结果消息 case 'Order_Pay_Result': // 订单支付结果消息
state.payOrder = msg; store.dispatch('socket/setPayOrder', msg);
break; break;
case 'Simulation_DeviceStatus': // 仿真-设备状态消息 case 'Simulation_DeviceStatus': // 仿真-设备状态消息
state.equipmentStatus = msg; store.dispatch('socket/setEquipmentStatus', msg);
break; break;
case 'Simulation_User': // 仿真-进出仿真消息 case 'Simulation_User': // 仿真-进出仿真消息
handleSimulationUserinfo(state, msg); // 用户进出仿真消息 store.dispatch('socket/setSimulationRoleList', (data instanceof Array) ? data : [data]);
break; break;
case 'Simulation_Script_Action_Tip': // 剧本提示消息 case 'Simulation_Script_Action_Tip': // 剧本提示消息
handleSimulationScriptTipInfo(state, msg); // 剧本提示消息 store.dispatch('socket/setSimulationScriptTip', data);
break; break;
case 'Simulation_Script_Action_Finish': case 'Simulation_Script_Action_Finish': // 剧本某一部操作完成提示
state.simulationScriptTipFinish++; // 剧本某一部操作完成提示 store.dispatch('socket/simulationScriptTipFinishIncrease');
break; break;
case 'Simulation_Script_Action_Error': case 'Simulation_Script_Action_Error': // 剧本某一部操作执行错误
state.simulationScriptTipError++; // 剧本某一部操作执行错误 store.dispatch('socket/simulationScriptTipErrorIncrease');
break; break;
case 'Simulation_Over': // 用户退出仿真推送消息 case 'Simulation_Over': // 用户退出仿真推送消息
state.simulationOver++; // 用户退出仿真推送消息 store.dispatch('socket/simulationOverIncrease');
break; break;
case 'Simulation_Script_Action':// 剧本编制添加指令的推送消息 case 'Simulation_Script_Action':// 剧本编制添加指令的推送消息
state.scriptAction = msg; store.dispatch('socket/setScriptAction', msg);
break; break;
case 'Simulation_AutoFault_Trigger': // 自动故障触发操作推送消息 case 'Simulation_AutoFault_Trigger': // 自动故障触发操作推送消息
state.autoFaultTrigger++; store.dispatch('socket/autoFaultTriggerIncrease');
break; break;
case 'Simulation_RunFact': // 仿真-列车实际到发车站消息 case 'Simulation_RunFact': // 仿真-列车实际到发车站消息
if (!Array.isArray(msg)) { store.dispatch('socket/setTrainStationList', Array.isArray(msg) ? msg : [msg]);
state.trainStationList = [msg];
} else {
state.trainStationList = msg;
}
break; break;
case 'Simulation_Error': // 仿真-异常消息 case 'Simulation_Error': // 仿真-异常消息
state.simulationError += 1; store.dispatch('socket/simulationErrorIncrease');
break; break;
case 'Simulation_RunAsPlan_Start': // 仿真-仿真开始按计划行车消息 case 'Simulation_RunAsPlan_Start': // 仿真-仿真开始按计划行车消息
state.simulationStart = msg; store.dispatch('socket/setSimulationStart', msg);
break; break;
case 'Simulation_Reset': // 仿真-仿真重置消息 退出计划行车 case 'Simulation_Reset': // 仿真-仿真重置消息 退出计划行车
state.simulationReset += 1; store.dispatch('socket/simulationResetIncrease');
break; break;
case 'Simulation_Conversation': // 仿真-用户交互消息(聊天/命令) case 'Simulation_Conversation': // 仿真-用户交互消息(聊天/命令)
handleSimulationInfo(state, msg); handleSimulationInfo(msg);
break; break;
case 'Simulation_Conversation_Operation': // 仿真-用户交互消息(聊天/命令)-新 case 'Simulation_Conversation_Operation': // 仿真-用户交互消息(聊天/命令)-新
handleSimulationInfo(state, {id: msg.id, message: msg, messageType: 'MESSAGE'}); handleSimulationInfo({id: msg.id, message: msg, messageType: 'MESSAGE'});
break; break;
case 'Simulation_ApplyHandle': // 请求处理消息(旧版可能在用,新版地图不用这个) case 'Simulation_ApplyHandle': // 请求处理消息(旧版可能在用,新版地图不用这个)
handlePushMsgQueue(state, msg); store.dispatch('socket/handlePushMsgQueue', msg);
break; break;
case 'Simulation_Invite': // 综合演练-仿真邀请消息 case 'Simulation_Invite': // 综合演练-仿真邀请消息
state.simulationInvite = msg; store.dispatch('socket/setSimulationInvite', msg);
break; break;
case 'Be_Logged_Out': // 重复登录被登出 case 'Be_Logged_Out': // 重复登录被登出
state.beLogoutCount++; store.dispatch('socket/setLoggedOutMsg', msg);
state.loggedOutMsg = msg;
break; break;
case 'Simulation_Run_Plan_Reload': // 运行图变更 case 'Simulation_Run_Plan_Reload': // 运行图变更
state.runPlanReloadCount++; store.dispatch('socket/runPlanReloadCountIncrease');
break; break;
case 'Simulation_Control_Pause': // 暂停中 case 'Simulation_Control_Pause': // 暂停中
store.dispatch('scriptRecord/updateSimulationPause', msg); store.dispatch('scriptRecord/updateSimulationPause', msg);
@ -102,19 +98,19 @@ function handle(state, data) {
}); });
break; break;
case 'Simulation_Member': case 'Simulation_Member':
state.memberChangeCount++; store.dispatch('socket/memberChangeCountIncrease');
break; break;
case 'Simulation_Time_Sync': case 'Simulation_Time_Sync':
state.simulationTimeSync = msg; store.dispatch('socket/setSimulationTimeSync', msg);
break; break;
case 'Simulation_IbpStatus': case 'Simulation_IbpStatus':
state.simulationIbpStatus = msg; store.dispatch('socket/setSimulationIbpStatus', msg);
break; break;
case 'Simulation_Competition_Practice_Finish': case 'Simulation_Competition_Practice_Finish':
state.competitionPracticeFinish++; store.dispatch('socket/competitionPracticeFinishIncrease');
break; break;
case 'Simulation_Alarm': case 'Simulation_Alarm':
state.simulationAlarmInfo = msg; store.dispatch('socket/setSimulationAlarmInfo', msg);
break; break;
case 'STATION_PFI_NUM': case 'STATION_PFI_NUM':
state.stationPfiNum = msg; state.stationPfiNum = msg;
@ -228,6 +224,26 @@ function handle(state, data) {
break; 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;
}
} }

View File

@ -298,14 +298,14 @@ export default {
} }
}); });
}, },
'$store.state.socket.createConversition':function(val) { '$store.state.socket.createConversation':function(val) {
val.memberList.forEach(member => { val.memberList.forEach(member => {
// if (val.creatorId == member.memberId) { // if (val.creatorId == member.memberId) {
this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: [], connect:member.connect}); 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 => { this.treeData.forEach(item => {
if (item.children) { if (item.children) {
const memberList = Object.values(item.children); const memberList = Object.values(item.children);
@ -350,7 +350,7 @@ export default {
}, },
deep: true deep: true
}, },
'$store.state.socket.exitConversition': function (val) { '$store.state.socket.exitConversation': function (val) {
for (const memberId in this.conversitionStateMap) { for (const memberId in this.conversitionStateMap) {
if (memberId == val.memberId) { if (memberId == val.memberId) {
this.conversitionStateMap[memberId].connect = false; this.conversitionStateMap[memberId].connect = false;

View File

@ -193,14 +193,14 @@ export default {
} }
}); });
}, },
'$store.state.socket.createConversition':function(val) { '$store.state.socket.createConversation':function(val) {
val.memberList.forEach(member => { val.memberList.forEach(member => {
// if (val.creatorId == member.memberId) { // if (val.creatorId == member.memberId) {
this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: [], connect:member.connect}); 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 => { this.treeData.forEach(item => {
if (item.children) { if (item.children) {
const memberList = Object.values(item.children); const memberList = Object.values(item.children);
@ -251,7 +251,7 @@ export default {
}, },
deep: true deep: true
}, },
'$store.state.socket.exitConversition': function (val) { '$store.state.socket.exitConversation': function (val) {
for (const memberId in this.conversitionStateMap) { for (const memberId in this.conversitionStateMap) {
if (memberId == val.memberId) { if (memberId == val.memberId) {
this.conversitionStateMap[memberId].connect = false; this.conversitionStateMap[memberId].connect = false;

View File

@ -106,7 +106,6 @@ export default {
} }
}, },
async subscribe() { // async subscribe() { //
this.clearSubscribe();
const header = {group: this.group || '', 'X-Token': getToken()}; const header = {group: this.group || '', 'X-Token': getToken()};
await creatSubscribe(`${displayTopic}\/${this.group}`, header); await creatSubscribe(`${displayTopic}\/${this.group}`, header);
await creatSubscribe(getTopic('STATE', this.group), header); await creatSubscribe(getTopic('STATE', this.group), header);