暂提
This commit is contained in:
parent
0967f30d1a
commit
eafd1634f5
@ -47,11 +47,6 @@ export default {
|
||||
this.subscribeMessage(val);
|
||||
}
|
||||
},
|
||||
'$store.state.socket.roomInvite': function (val) {
|
||||
if (val.creator) {
|
||||
this.subscribeMessage(val);
|
||||
}
|
||||
},
|
||||
'$store.state.socket.beLogoutCount': async function(val) {
|
||||
if (this.$store.state.socket.loggedOutMsg.token === getToken()) {
|
||||
this.$store.dispatch('disconnect').then(()=>{
|
||||
@ -110,7 +105,6 @@ export default {
|
||||
this.$refs.deomonTopic.doShow(res);
|
||||
}
|
||||
this.$store.dispatch('socket/setSimulationInvite');
|
||||
this.$store.dispatch('socket/setRoomInvite');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,17 +37,6 @@ function handle(state, data) {
|
||||
case 'Order_Pay_Result': // 订单支付结果消息
|
||||
state.payOrder = msg;
|
||||
break;
|
||||
case 'JointTraining_Room': // 综合演练室-房间消息
|
||||
if (!path.includes('/plan') || !path.includes('/dp/')) {
|
||||
state.jointRoomInfo = msg; // 房间信息
|
||||
}
|
||||
break;
|
||||
case 'JointTraining_User': // 综合演练室-用户消息
|
||||
handleUserinfo(state, msg); // 分配角色权限消息
|
||||
break;
|
||||
case 'JointTraining_Chat': // 综合演练室-群聊消息
|
||||
handleRecordList(state, msg);
|
||||
break;
|
||||
case 'Simulation_DeviceStatus': // 仿真-设备状态消息
|
||||
state.equipmentStatus = msg;
|
||||
break;
|
||||
@ -63,15 +52,9 @@ function handle(state, data) {
|
||||
case 'Simulation_Script_Action_Error':
|
||||
state.simulationScriptTipError++; // 剧本某一部操作执行错误
|
||||
break;
|
||||
case 'Simulation_PlayBack_Finish': // 竞赛裁判系统裁判员回放结束推送
|
||||
state.playBackFinish++; // 竞赛裁判系统裁判员回放结束推送
|
||||
break;
|
||||
case 'Simulation_Over': // 用户退出仿真推送消息
|
||||
state.simulationOver++; // 用户退出仿真推送消息
|
||||
break;
|
||||
case 'Simulation_Script_Finish': // 剧本执行完成推送消息
|
||||
state.scriptFinish++; // 剧本执行完成推送消息
|
||||
break;
|
||||
case 'Simulation_Script_Action':// 剧本编制添加指令的推送消息
|
||||
state.scriptAction = msg;
|
||||
break;
|
||||
@ -100,44 +83,12 @@ function handle(state, data) {
|
||||
case 'Simulation_Conversation_Operation': // 仿真-用户交互消息(聊天/命令)-新
|
||||
handleSimulationInfo(state, {id: msg.id, message: msg, messageType: 'MESSAGE'});
|
||||
break;
|
||||
case 'Simulation_PlayBack_Conversation': // 回放-用户交互消息
|
||||
handleSimulationInfo(state, msg);
|
||||
break;
|
||||
|
||||
case 'Simulation_ApplyHandle': // 请求处理消息(旧版可能在用,新版地图不用这个)
|
||||
handlePushMsgQueue(state, msg);
|
||||
break;
|
||||
|
||||
case 'JointTraining_User_Permit': // 综合演练室-用户获取权限消息
|
||||
state.userPermit = msg;
|
||||
break;
|
||||
case 'Simulation_Invite': // 综合演练-仿真邀请消息
|
||||
state.simulationInvite = msg;
|
||||
break;
|
||||
case 'JointTraining_Room_Invite': // 综合演练室-房间邀请消息
|
||||
state.roomInvite = msg;
|
||||
break;
|
||||
case 'Big_Screen_Simulation_DeviceStatus': // 大屏仿真状态数据
|
||||
state.equipmentStatus = msg;
|
||||
break;
|
||||
case 'Big_Screen_Simulation_RunFact': // 大屏仿真运行图状态
|
||||
state.trainStationList = msg;
|
||||
break;
|
||||
case 'Plan_Simulation_DeviceStatus': // 大屏仿真状态数据
|
||||
state.equipmentStatus = msg;
|
||||
break;
|
||||
case 'Plan_Simulation_RunFact': // 大屏仿真运行图状态
|
||||
state.trainStationList = msg;
|
||||
break;
|
||||
case 'Simulation_Permission_Over': // 权限结束
|
||||
state.permissionOver = msg;
|
||||
break;
|
||||
case 'Simulation_Quest_Finish': // 任务结束标志
|
||||
state.tipOperateCount++;
|
||||
break;
|
||||
case 'JointTraining_Device':
|
||||
state.realDeviceInfo++;
|
||||
break;
|
||||
case 'Be_Logged_Out': // 重复登录被登出
|
||||
state.beLogoutCount++;
|
||||
state.loggedOutMsg = msg;
|
||||
@ -322,32 +273,6 @@ function handle(state, data) {
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
// 操作聊天信息
|
||||
function handleRecordList(state, data) {
|
||||
const userId = store.state.user.id;
|
||||
let isSelf = false;
|
||||
if (data.member.id == userId) {
|
||||
isSelf = true;
|
||||
}
|
||||
const myDate = new Date();
|
||||
const myDate1 = myDate.toLocaleDateString().replace(/\//g, '-');
|
||||
const param = {
|
||||
join: false,
|
||||
value: data.message,
|
||||
self: isSelf,
|
||||
voice: data.isAudio,
|
||||
src: data.isAudio ? `${data.audioPath}` : '',
|
||||
other: !isSelf,
|
||||
userName: data.member.nickName,
|
||||
chatTime: data.chatTime,
|
||||
chatInfo: true,
|
||||
inSimulation: false,
|
||||
inRoom: true,
|
||||
date: +new Date(`${myDate1} ${data.chatTime}`)
|
||||
};
|
||||
state.chatContent = param;
|
||||
}
|
||||
// 仿真内部聊天
|
||||
function handleSimulationInfo(state, data) {
|
||||
switch (data.messageType) {
|
||||
@ -377,10 +302,6 @@ function handleSimulationScriptTipInfo(state, data) {
|
||||
state.simulationScriptTip = data;
|
||||
}
|
||||
|
||||
function handleUserinfo(state, data) {
|
||||
state.roleList = (data instanceof Array) ? data : [data];
|
||||
}
|
||||
|
||||
function handleSimulationUserinfo(state, data) {
|
||||
state.simulationRoleList = (data instanceof Array) ? data : [data];
|
||||
}
|
||||
@ -403,17 +324,12 @@ const socket = {
|
||||
|
||||
state: {
|
||||
payOrder: '', // 支付订单
|
||||
jointRoomInfo: {}, // 受邀请房间信息
|
||||
chatContent: {}, // 聊天室聊天内容
|
||||
roleList: [], // 设置角色信息
|
||||
simulationRoleList:[], // 设置仿真的聊天角色信息
|
||||
simulationScriptTip:{}, // 剧本推送提示信息
|
||||
simulationScriptTipFinish:0, // 剧本某一步完成的消息
|
||||
simulationScriptTipError: 0, // 剧本某一步执行错误
|
||||
scriptFinish:0, // 剧本执行完成提示信息
|
||||
autoFaultTrigger:0, // 自动故障触发操作推送消息
|
||||
scriptAction:{}, // 剧本编制添加指令的推送消息
|
||||
playBackFinish:0, // 竞赛裁判系统裁判回放结束推送
|
||||
jointRoomPrepare: false, // 演练房间准备状态
|
||||
equipmentStatus: [], // 仿真-设备状态消息
|
||||
trainStationList: [], // 仿真-列车实际到发车站消息
|
||||
@ -433,7 +349,6 @@ const socket = {
|
||||
msgQueue: [], // 命令请求列表(旧版控制权转移可能在用,新版不用这个)
|
||||
msgHead: null, // 消息头(旧版控制权转移可能在用,新版不用这个)
|
||||
|
||||
userPermit: {}, // 用户获取权限消息
|
||||
userRoomKickOut: {}, // 用户被踢出房间消息
|
||||
userInRoom: {}, // 用户从外部进入房间消息
|
||||
userOutRoom: {}, // 用户退出房间消息
|
||||
@ -441,17 +356,12 @@ const socket = {
|
||||
userBackRoom: {}, // 用户从仿真返回房间消息
|
||||
simulationInvite: {}, // 用户扫码信息
|
||||
|
||||
permissionOver: {}, // 权限结束
|
||||
|
||||
roomIsSubscribe:false, // 房间是否订阅
|
||||
assistantIsSubscribe:false, // 综合演练仿真聊天是否订阅
|
||||
|
||||
tipOperateCount: 0, // 任务结束提示消息
|
||||
realDeviceInfo: 0, // 真实设备信息
|
||||
beLogoutCount: 0, // 被登出
|
||||
runPlanReloadCount: 0, // 仿真运行图变更
|
||||
memberChangeCount: 0, // 仿真成员变更
|
||||
roomInvite: {},
|
||||
simulationTimeSync: '', // 仿真时间
|
||||
simulationIbpStatus: null,
|
||||
stationPfiNum: null, // 客流消息列表
|
||||
@ -491,18 +401,10 @@ const socket = {
|
||||
getters: {
|
||||
},
|
||||
mutations: {
|
||||
setJointRoomInfo: (state, jointRoomInfo) => {
|
||||
state.jointRoomInfo = jointRoomInfo;
|
||||
},
|
||||
|
||||
setStationPfiNum: (state, stationPfiNum) => {
|
||||
state.stationPfiNum = stationPfiNum;
|
||||
},
|
||||
|
||||
setChatContent: (state, chatContent) => {
|
||||
state.chatContent = chatContent;
|
||||
},
|
||||
|
||||
setEquipmentStatus: (state, equipmentStatus) => {
|
||||
state.equipmentStatus = equipmentStatus;
|
||||
},
|
||||
@ -538,9 +440,6 @@ const socket = {
|
||||
setSimulationInvite: (state, simulationInvite) => {
|
||||
state.simulationInvite = simulationInvite;
|
||||
},
|
||||
setRoomInvite: (state, roomInvite) => {
|
||||
state.roomInvite = roomInvite;
|
||||
},
|
||||
setRoomSubscribe:(state, roomIsSubscribe)=>{
|
||||
state.roomIsSubscribe = roomIsSubscribe;
|
||||
},
|
||||
@ -614,14 +513,6 @@ const socket = {
|
||||
setSimulationSpeed: ({ commit }, speed) => {
|
||||
commit('setSimulationSpeed', speed);
|
||||
},
|
||||
setChatContent: ({ commit }, chatContent) => {
|
||||
commit('setChatContent', chatContent);
|
||||
},
|
||||
|
||||
setJointRoomInfo: ({ commit }) => {
|
||||
commit('setJointRoomInfo', {});
|
||||
},
|
||||
|
||||
setStationPfiNum: ({ commit }) => {
|
||||
commit('setStationPfiNum', null);
|
||||
},
|
||||
@ -649,9 +540,6 @@ const socket = {
|
||||
setSimulationInvite: ({ commit }) => {
|
||||
commit('setSimulationInvite', {});
|
||||
},
|
||||
setRoomInvite: ({ commit }) => {
|
||||
commit('setRoomInvite', {});
|
||||
},
|
||||
setMessage: ({ state }, data) => {
|
||||
if (!state.message[data.key]) {
|
||||
state.message[data.key] = [];
|
||||
|
@ -44,7 +44,7 @@ StompClient.prototype = {
|
||||
that.status = true;
|
||||
// 恢复订阅
|
||||
that.subscribeMap.forEach((subscribe) => {
|
||||
that.subscribe(subscribe.dest, subscribe.handler);
|
||||
that.subscribe(subscribe.dest, subscribe.handler, subscribe.headers);
|
||||
});
|
||||
}, (e)=> {
|
||||
console.log('socket连接错误:' + e);
|
||||
@ -114,20 +114,21 @@ StompClient.prototype = {
|
||||
this.onmessage = onmessage;
|
||||
this.headers = headers;
|
||||
if (!this.status) {
|
||||
this.subscribeMap.set(topic, {dest: topic, handler: onmessage, sub: null});
|
||||
this.subscribeMap.set(topic, {dest: topic, handler: onmessage, sub: null, headers, count: 1});
|
||||
} else {
|
||||
const sub = this.clientIns.subscribe(topic, onmessage);
|
||||
this.subscribeMap.set(topic, {dest: topic, handler: onmessage, sub: sub});
|
||||
this.subscribeMap.set(topic, {dest: topic, handler: onmessage, sub: sub, headers, count: 1});
|
||||
}
|
||||
},
|
||||
|
||||
unsubscribe(topic) {
|
||||
const subscription = this.subscribeMap.get(topic);
|
||||
if (subscription && subscription.sub) {
|
||||
subscription.count--;
|
||||
if (subscription && subscription.sub && subscription.count < 0) {
|
||||
subscription.sub.unsubscribe();
|
||||
this.subscribeMap.delete(topic);
|
||||
console.log('取消订阅:' + topic);
|
||||
} else if (subscription) {
|
||||
} else if (subscription && subscription.count < 0) {
|
||||
this.subscribeMap.delete(topic);
|
||||
}
|
||||
},
|
||||
|
@ -54,6 +54,8 @@ export function creatSubscribe(topic, header) {
|
||||
}
|
||||
if (!Vue.prototype.$stomp.subscribeMap[topic]) {
|
||||
Vue.prototype.$stomp.subscribe(topic, callback, header);
|
||||
} else {
|
||||
Vue.prototype.$stomp.subscribeMap[topic].count++;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败', error, topic, header);
|
||||
|
233
src/utils/subscribeCallback.js
Normal file
233
src/utils/subscribeCallback.js
Normal file
@ -0,0 +1,233 @@
|
||||
import store from '@/store/index';
|
||||
import {Notification} from 'element-ui';
|
||||
export function atsCallback() {
|
||||
const data = {res:JSON.parse(Response.body), type:'ats' };
|
||||
store.dispatch('socket/handleSock', data);
|
||||
}
|
||||
export function sysTimeCallback() {
|
||||
store.dispatch('socket/setSimulationTimeSync', Number.parseInt(Response.body));
|
||||
}
|
||||
export function stateCallback() {
|
||||
store.dispatch('socket/handleSimulationState', Number.parseInt(Response.body));
|
||||
}
|
||||
export function iscsPsdCallback() {
|
||||
store.dispatch('socket/handleIscsState', JSON.parse(Response.body));
|
||||
}
|
||||
export function iscsPaCallback() {
|
||||
store.dispatch('socket/handleIscsPaState', JSON.parse(Response.body));
|
||||
}
|
||||
export function iscsPisCallback() {
|
||||
store.dispatch('socket/handleIscsPisState', JSON.parse(Response.body));
|
||||
}
|
||||
export function defaultCallback() {
|
||||
const data = JSON.parse(Response.body);
|
||||
store.dispatch('socket/setStomp', data);
|
||||
}
|
||||
function handle(state, data) {
|
||||
const msg = data.body;
|
||||
switch (data.type) {
|
||||
case 'Order_Pay_Result': // 订单支付结果消息
|
||||
state.payOrder = msg;
|
||||
break;
|
||||
case 'Simulation_DeviceStatus': // 仿真-设备状态消息
|
||||
state.equipmentStatus = msg;
|
||||
break;
|
||||
case 'Simulation_User': // 仿真-进出仿真消息
|
||||
handleSimulationUserinfo(state, msg); // 用户进出仿真消息
|
||||
break;
|
||||
case 'Simulation_Script_Action_Tip': // 剧本提示消息
|
||||
handleSimulationScriptTipInfo(state, msg); // 剧本提示消息
|
||||
break;
|
||||
case 'Simulation_Script_Action_Finish':
|
||||
state.simulationScriptTipFinish++; // 剧本某一部操作完成提示
|
||||
break;
|
||||
case 'Simulation_Script_Action_Error':
|
||||
state.simulationScriptTipError++; // 剧本某一部操作执行错误
|
||||
break;
|
||||
case 'Simulation_Over': // 用户退出仿真推送消息
|
||||
state.simulationOver++; // 用户退出仿真推送消息
|
||||
break;
|
||||
case 'Simulation_Script_Action':// 剧本编制添加指令的推送消息
|
||||
state.scriptAction = msg;
|
||||
break;
|
||||
case 'Simulation_AutoFault_Trigger': // 自动故障触发操作推送消息
|
||||
state.autoFaultTrigger++;
|
||||
break;
|
||||
case 'Simulation_RunFact': // 仿真-列车实际到发车站消息
|
||||
if (!Array.isArray(msg)) {
|
||||
state.trainStationList = [msg];
|
||||
} else {
|
||||
state.trainStationList = msg;
|
||||
}
|
||||
break;
|
||||
case 'Simulation_Error': // 仿真-异常消息
|
||||
state.simulationError += 1;
|
||||
break;
|
||||
case 'Simulation_RunAsPlan_Start': // 仿真-仿真开始按计划行车消息
|
||||
state.simulationStart = msg;
|
||||
break;
|
||||
case 'Simulation_Reset': // 仿真-仿真重置消息 退出计划行车
|
||||
state.simulationReset += 1;
|
||||
break;
|
||||
case 'Simulation_Conversation': // 仿真-用户交互消息(聊天/命令)
|
||||
handleSimulationInfo(state, msg);
|
||||
break;
|
||||
case 'Simulation_Conversation_Operation': // 仿真-用户交互消息(聊天/命令)-新
|
||||
handleSimulationInfo(state, {id: msg.id, message: msg, messageType: 'MESSAGE'});
|
||||
break;
|
||||
case 'Simulation_ApplyHandle': // 请求处理消息(旧版可能在用,新版地图不用这个)
|
||||
handlePushMsgQueue(state, msg);
|
||||
break;
|
||||
case 'Simulation_Invite': // 综合演练-仿真邀请消息
|
||||
state.simulationInvite = msg;
|
||||
break;
|
||||
case 'Be_Logged_Out': // 重复登录被登出
|
||||
state.beLogoutCount++;
|
||||
state.loggedOutMsg = msg;
|
||||
break;
|
||||
case 'Simulation_Run_Plan_Reload': // 运行图变更
|
||||
state.runPlanReloadCount++;
|
||||
break;
|
||||
case 'Simulation_Control_Pause': // 暂停中
|
||||
store.dispatch('scriptRecord/updateSimulationPause', msg);
|
||||
break;
|
||||
case 'BROADCAST': // 升级通知消息
|
||||
Notification.warning({
|
||||
title: msg.title,
|
||||
center: true,
|
||||
message: msg.message,
|
||||
position: 'bottom-right',
|
||||
showClose: msg.showClose,
|
||||
duration: 0
|
||||
});
|
||||
break;
|
||||
case 'Simulation_Member':
|
||||
state.memberChangeCount++;
|
||||
break;
|
||||
case 'Simulation_Time_Sync':
|
||||
state.simulationTimeSync = msg;
|
||||
break;
|
||||
case 'Simulation_IbpStatus':
|
||||
state.simulationIbpStatus = msg;
|
||||
break;
|
||||
case 'Simulation_Competition_Practice_Finish':
|
||||
state.competitionPracticeFinish++;
|
||||
break;
|
||||
case 'Simulation_Alarm':
|
||||
state.simulationAlarmInfo = msg;
|
||||
break;
|
||||
case 'STATION_PFI_NUM':
|
||||
state.stationPfiNum = msg;
|
||||
break;
|
||||
case 'STAND_PFI':
|
||||
state.standPfiNum = msg;
|
||||
break;
|
||||
case 'TRAIN_PFI_NUM':
|
||||
state.trainPfiNum = msg;
|
||||
break;
|
||||
case 'TRAIN_PFI_BL':
|
||||
state.trainPfiBL = msg;
|
||||
break;
|
||||
case 'LPF_STRATEGY_RECOMMEND':
|
||||
state.LPFstrategy = msg;
|
||||
break;
|
||||
case 'Simulation_Scenes_Reload':
|
||||
if (msg) {
|
||||
store.dispatch('training/start');
|
||||
} else {
|
||||
store.dispatch('training/over');
|
||||
}
|
||||
state.trainingReloadCount++;
|
||||
break;
|
||||
case 'Simulation_PslStatus':
|
||||
state.simulationPslStatus = msg;
|
||||
break;
|
||||
// 运行图加线/抽线/变化推送消息
|
||||
case 'Simulation_Trip_Plan_Change':
|
||||
state.simulationPlanChange = msg;
|
||||
break;
|
||||
// 占线板信息
|
||||
case 'Simulation_RailCtcStatus':
|
||||
state.railCtcStatusMsg = msg;
|
||||
break;
|
||||
case 'SIMULATION_CTC_RUN_PLAN_CHANGE':
|
||||
state.voiceBroadcastMsgs = [];
|
||||
msg.forEach(element => {
|
||||
const tripNumberDe = element.departRunPlan && element.departRunPlan.tripNumber;
|
||||
const tripNumberAr = element.arriveRunPlan && element.arriveRunPlan.tripNumber;
|
||||
if (tripNumberDe) {
|
||||
element.departRunPlan.up = '';
|
||||
element.departRunPlan.down = '';
|
||||
parseInt(tripNumberDe[tripNumberDe.length - 1]) % 2 == 0 ? element.departRunPlan.up = tripNumberDe : element.departRunPlan.down = tripNumberDe;
|
||||
}
|
||||
if (tripNumberAr) {
|
||||
element.arriveRunPlan.up = '';
|
||||
element.arriveRunPlan.down = '';
|
||||
parseInt(tripNumberAr[tripNumberAr.length - 1]) % 2 == 0 ? element.arriveRunPlan.up = tripNumberAr : element.arriveRunPlan.down = tripNumberAr;
|
||||
}
|
||||
const code = element.stationCode + '' + element.code;
|
||||
if (store.state.training.roleDeviceCode === element.stationCode && element.arriveRunPlan && element.arriveRunPlan.adjacentMessage === '1') {
|
||||
state.voiceBroadcastMsgs.push(element.stationCode + '' + element.code);
|
||||
}
|
||||
state.railCtcRunplanInitMsg[code] = copyAssign(state.railCtcRunplanInitMsg[code] || {}, element);
|
||||
});
|
||||
if (state.voiceBroadcastMsgs.length) {
|
||||
state.voiceBroadcastChange++;
|
||||
}
|
||||
state.railCtcRunplanChange++;
|
||||
break;
|
||||
// 大铁项目 ctc 调度发布行车计划 给车站下发消息
|
||||
case 'SIMULATION_RAILWAY_RUN_PLAN_SEND':
|
||||
msg.forEach(each => {
|
||||
state.railwaySimulationRunplanSendMap[each.stationCode] = each;
|
||||
});
|
||||
state.railwaySimulationRunplanSendChange++;
|
||||
break;
|
||||
// 大铁项目 ctc 车务管理端 初始化消息
|
||||
case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT':
|
||||
state.railCtcStationManageRpMsg = {};
|
||||
msg.forEach(element => {
|
||||
const code = element.stationCode + '' + element.tripNumber;
|
||||
state.railCtcStationManageRpMsg[code] = element;
|
||||
});
|
||||
// state.railCtcStationManageRpChange++;
|
||||
break;
|
||||
// 大铁项目 ctc 车务管理端 修改/增加消息
|
||||
case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE':
|
||||
msg.forEach(element => {
|
||||
const code = element.stationCode + '' + element.tripNumber;
|
||||
state.railCtcStationManageRpMsg[code] = copyAssign(state.railCtcStationManageRpMsg[code] || {}, element);
|
||||
});
|
||||
state.railCtcStationManageRpChange++;
|
||||
break;
|
||||
// 大铁项目 ctc 车务管理端 移除消息
|
||||
case 'SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE':
|
||||
msg.forEach(element => {
|
||||
const code = element.stationCode + '' + element.tripNumber;
|
||||
delete state.railCtcStationManageRpMsg[code];
|
||||
});
|
||||
state.railCtcStationManageRpChange++;
|
||||
break;
|
||||
// 调度命令信息
|
||||
case 'SIMULATION_RAIL_CTC_DISPATCH_COMMAND':
|
||||
state.dispatchCommandMsg = msg;
|
||||
break;
|
||||
// 车站发送计划信息
|
||||
case 'SIMULATION_CTC_RUN_PLAN_CONFIRM_SEND':
|
||||
state.changedCtcRunplanMap = msg;
|
||||
break;
|
||||
case 'SIMULATION_RAIL_TICKET':
|
||||
state.ticketInfo = msg;
|
||||
break;
|
||||
// 实训提示消息
|
||||
case 'Simulation_Training_Step_Tip':
|
||||
state.trainingStepTip = msg;
|
||||
break;
|
||||
case 'Simulation_Training_Finish':
|
||||
state.trainingOverCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
function handleSimulationUserinfo(state, data) {
|
||||
state.simulationRoleList = (data instanceof Array) ? data : [data];
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
|
||||
<script>
|
||||
import MapCommon from './jlmap/index';
|
||||
import parseStatus from '@/utils/parseStatus';
|
||||
// import parseStatus from '@/utils/parseStatus';
|
||||
import {mapGetters} from 'vuex';
|
||||
import { getDeviceMenuByDeviceType, MouseEvent } from '@/scripts/ConstDic';
|
||||
import deviceType from '@/jmapNew/constant/deviceType';
|
||||
@ -52,11 +52,11 @@ export default {
|
||||
this.statusMessage(val);
|
||||
}
|
||||
},
|
||||
'$store.state.socket.deviceStateMessages': function (val) {
|
||||
if (val) {
|
||||
this.statusMessageNew(val);
|
||||
}
|
||||
},
|
||||
// '$store.state.socket.deviceStateMessages': function (val) {
|
||||
// if (val) {
|
||||
// this.statusMessageNew(val);
|
||||
// }
|
||||
// },
|
||||
'$store.state.map.mousemove': function (val) {
|
||||
this.mousemove();
|
||||
},
|
||||
@ -83,11 +83,11 @@ export default {
|
||||
await this.$store.dispatch('training/updateMapState', list);
|
||||
await this.$store.dispatch('socket/setEquipmentStatus');
|
||||
},
|
||||
async statusMessageNew(deviceStatus) {
|
||||
const list = parseStatus(deviceStatus);
|
||||
await this.$store.dispatch('training/updateMapState', list);
|
||||
await this.$store.dispatch('socket/setDeviceStateMessages');
|
||||
},
|
||||
// async statusMessageNew(deviceStatus) { // 之前的新版订阅消息处理
|
||||
// const list = parseStatus(deviceStatus);
|
||||
// await this.$store.dispatch('training/updateMapState', list);
|
||||
// await this.$store.dispatch('socket/setDeviceStateMessages');
|
||||
// },
|
||||
simulationError() {
|
||||
this.$store.dispatch('map/clearJlmapTrainView');
|
||||
this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
|
@ -248,6 +248,7 @@ export default {
|
||||
handleStateUpdate(list) {
|
||||
this.$store.dispatch('map/mapStateLoaded');
|
||||
},
|
||||
// 画布初始化完成
|
||||
handleInitJlmap() {
|
||||
this.$store.dispatch('map/initJlmapLoaded');
|
||||
},
|
||||
|
@ -3,14 +3,13 @@
|
||||
<dispatcher-work v-if="picture === 'dispatchWork'" ref="dispatcherWork" />
|
||||
<local-work v-else-if="picture === 'localWork'" ref="localWork" :centralized-station-map="centralizedStationMap" />
|
||||
<message-board v-else-if="picture === 'messageBoard'" ref="messageBoard" />
|
||||
<message-board v-else-if="picture === 'messageBoard'" ref="messageBoard" />
|
||||
<jl3d-drive v-else-if="picture === 'drivingPlan'" ref="jl3dDrive" />
|
||||
<jl3d-device v-else-if="picture === 'jl3dModle'" ref="jl3dModle" />
|
||||
<jl3d-passflow v-else-if="picture === 'cctvView'" ref="cctvView" />
|
||||
<ibp-plate v-else-if="picture === 'ibp'" ref="ibpPlate" />
|
||||
<DispatchCmd v-if="datie" ref="dispatchCmd" @close="close" />
|
||||
<DispatcherLoger v-if="datie" ref="dispatcherLoger" @close="close" />
|
||||
<terminal-menu v-if="menuShow" ref="terminalMenu" @pictureChange="pictureChange" />
|
||||
<terminal-menu v-if="menuShow" ref="terminalMenu" @pictureChange="pictureChange" @popupTerminalShow="popupTerminalShow" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -71,11 +70,6 @@ export default {
|
||||
'$store.state.socket.memberChangeCount': function () { // 仿真成员变更
|
||||
this.initMemberUserInfo();
|
||||
},
|
||||
// '$store.state.socket.simulationRoleList': function (val) {
|
||||
// if (val && val.length) {
|
||||
// this.handlerMemberOnOff(val);
|
||||
// }
|
||||
// },
|
||||
'$store.state.map.map': function (map) {
|
||||
try {
|
||||
if (map) {
|
||||
@ -113,15 +107,6 @@ export default {
|
||||
},
|
||||
async subscribe() { // 根据显示端分别订阅
|
||||
this.clearSubscribe();
|
||||
// if (this.picture === 'localWork' || this.picture === 'dispatchWork') {
|
||||
// const header = {group: this.group || '', 'X-Token': getToken()};
|
||||
// await creatSubscribe(`${displayTopic}\/${this.group}`, header);
|
||||
// await creatSubscribe(getTopic('STATE', this.group), header);
|
||||
// if (this.picture === 'ctc') {
|
||||
// await creatSubscribe(getTopic('CTC', this.group), header);
|
||||
// }
|
||||
// await this.$store.dispatch('training/setHasSubscribed');
|
||||
// }
|
||||
const header = {group: this.group || '', 'X-Token': getToken()};
|
||||
await creatSubscribe(`${displayTopic}\/${this.group}`, header);
|
||||
await creatSubscribe(getTopic('STATE', this.group), header);
|
||||
@ -137,13 +122,13 @@ export default {
|
||||
clearSubscribe(getTopic('CTC', this.group));
|
||||
}
|
||||
},
|
||||
// handlerMemberOnOff(data) { // 处理仿真成员上下线
|
||||
// this.$store.dispatch('training/updateMemberAndUser', {simulationUserList: data, userId: this.userId});
|
||||
// },
|
||||
pictureChange(val) {
|
||||
console.log(val, '1111');
|
||||
this.picture = val;
|
||||
},
|
||||
popupTerminalShow(val) {
|
||||
this.$refs[val].doShow();
|
||||
},
|
||||
setCentralizedStationList(map) {
|
||||
this.centralizedStationList = [];
|
||||
(map.stationList || []).forEach(item => {
|
||||
|
@ -149,11 +149,11 @@ export default {
|
||||
},
|
||||
schedulingPlan(code) {
|
||||
this.active = code;
|
||||
this.$refs.dispatcherLoger.doShow();
|
||||
this.$emit('popupTerminalShow', 'dispatcherLoger');
|
||||
},
|
||||
dispatchingCommand(code) {
|
||||
this.active = code;
|
||||
this.$refs.dispatchCmd.doShow();
|
||||
this.$emit('popupTerminalShow', 'dispatchCmd');
|
||||
},
|
||||
messageBoardShow(code) {
|
||||
this.active = code;
|
||||
|
@ -42,11 +42,7 @@ export default {
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
// 剧本执行完成消息
|
||||
'$store.state.socket.scriptFinish':function(val, old) {
|
||||
this.$message('剧本演出完毕');
|
||||
this.$refs.scriptTip.resetScriptTip();
|
||||
}
|
||||
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
|
@ -47,11 +47,7 @@ export default {
|
||||
computed:{
|
||||
},
|
||||
watch:{
|
||||
// 剧本执行完成消息
|
||||
'$store.state.socket.scriptFinish':function(val, old) {
|
||||
this.$message('剧本演出完毕');
|
||||
this.$refs.scriptTip.resetScriptTip();
|
||||
}
|
||||
|
||||
},
|
||||
methods:{
|
||||
clearAllData() {
|
||||
|
@ -215,14 +215,6 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.state.socket.roleList': function (roleList) { // 综合演练室用户消息
|
||||
if (roleList && roleList.length) {
|
||||
this.$nextTick(() => {
|
||||
this.addrolesList(roleList);
|
||||
this.$store.dispatch('config/updateMenuBar');
|
||||
});
|
||||
}
|
||||
},
|
||||
'$store.state.socket.simulationOver':function(val) {
|
||||
if (val && this.project == 'refereeJsxt') {
|
||||
this.$router.go(-1);
|
||||
@ -298,62 +290,6 @@ export default {
|
||||
modifySystemTime() {
|
||||
this.$refs.modifySysTime.doShow();
|
||||
},
|
||||
// 设置用户角色 Admin 管理员 Instructor 教员 Dispatcher 行调 Attendant 车站 Audience 观众 Driver 司机 MAINTAINER 通号
|
||||
addrolesList(list) {
|
||||
list.forEach(item => {
|
||||
if (this.$store.state.user.id == item.id) {
|
||||
switch (item.userRole) {
|
||||
case 'INSTRUCTOR':
|
||||
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'INSTRUCTOR');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
case 'DISPATCHER':
|
||||
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'DISPATCHER');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
case 'STATION_SUPERVISOR':
|
||||
if (!item['deviceCode']) {
|
||||
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
|
||||
break;
|
||||
}
|
||||
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
case 'STATION_ASSISTANT':
|
||||
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_ASSISTANT');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
case 'CI':
|
||||
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'CI');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
case 'DRIVER':
|
||||
this.$store.dispatch('training/setPrdType', '04'); this.$store.dispatch('training/setRoles', 'DRIVER');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
case 'MAINTAINER':
|
||||
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'MAINTAINER');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
case 'IBP':
|
||||
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
case 'BIGSCREEN':
|
||||
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BIGSCREEN');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
default:
|
||||
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'AUDIENCE');
|
||||
this.$emit('getUserRole');
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (this.$refs.chatView) {
|
||||
this.$refs.chatView.getUserRole();
|
||||
}
|
||||
},
|
||||
selectBeginTime() {
|
||||
this.$refs.setTime.doShow();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user