宁波三号线 控制权状态 代码处理
This commit is contained in:
parent
f0a3e0005d
commit
2ffc9e0781
@ -499,6 +499,7 @@ export default class Station extends Group {
|
||||
this.substationArrowsControl && this.substationArrowsControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
this.emergencyArrowsControl && this.emergencyArrowsControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
if (this.style.Station.stationText.isSpecialType) {
|
||||
// if()
|
||||
this.stationText.setColor(this.style.Station.stationText.noneModeColor);
|
||||
// sationEle.controller
|
||||
} else {
|
||||
@ -522,12 +523,14 @@ export default class Station extends Group {
|
||||
// });
|
||||
// //
|
||||
// }
|
||||
// console.log(model.controller, model.centralized, '5555555555555');
|
||||
model.controller && this.handleComplexControl(model.controller);
|
||||
if (this.style.Station.syncCentralizeStation && (model.controlMode || model.controller) && model.centralized) {
|
||||
model.chargeStationCodeList.forEach(item => {
|
||||
const device = store.getters['map/getDeviceByCode'](item);
|
||||
device && device.instance && device.instance.recover();
|
||||
if (model.controller) {
|
||||
device.controller = model.controller;
|
||||
device && device.instance && device.instance.handleComplexControl(model.controller);
|
||||
} else {
|
||||
device.controlMode = model.controlMode;
|
||||
@ -546,22 +549,24 @@ export default class Station extends Group {
|
||||
}
|
||||
|
||||
handleComplexControl(controller) {
|
||||
// const controller = model.controller;
|
||||
const memberData = store.state.training.memberData;
|
||||
if (memberData[controller].userId) {
|
||||
if (memberData[controller].userId == store.state.user.id) {
|
||||
this.stationText.setColor(this.style.Station.stationText.currentModeColor);
|
||||
} else {
|
||||
if (memberData[controller].type == 'DISPATCHER') {
|
||||
this.stationText.setColor(this.style.Station.stationText.dispatherColor);
|
||||
} else if (memberData[controller].type == 'STATION_SUPERVISOR') {
|
||||
const deviceCode = memberData[controller].deviceCode;
|
||||
if (deviceCode) {
|
||||
const device = store.getters['map/getDeviceByCode'](deviceCode);
|
||||
if (device.centralized) {
|
||||
this.stationText.setColor(this.style.Station.stationText.centralizedColor);
|
||||
} else {
|
||||
this.stationText.setColor(this.style.Station.stationText.noCentralizedColor);
|
||||
}
|
||||
console.log(controller, memberData[controller], memberData[controller].userId, store.state.user.id, '88888888');
|
||||
if (memberData[controller].userId && memberData[controller].userId == store.state.user.id) {
|
||||
this.stationText.setColor(this.style.Station.stationText.currentModeColor);
|
||||
} else {
|
||||
if (memberData[controller].type == 'DISPATCHER') {
|
||||
this.stationText.setColor(this.style.Station.stationText.dispatherColor);
|
||||
} else if (memberData[controller].type == 'STATION_SUPERVISOR') {
|
||||
const deviceCode = memberData[controller].deviceCode;
|
||||
// console.log(deviceCode, '999999999');
|
||||
if (deviceCode) {
|
||||
const device = store.getters['map/getDeviceByCode'](deviceCode);
|
||||
if (device.centralized) {
|
||||
// console.log(device.centralized, '666666666');
|
||||
this.stationText.setColor(this.style.Station.stationText.centralizedColor);
|
||||
} else {
|
||||
this.stationText.setColor(this.style.Station.stationText.noCentralizedColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,6 +261,7 @@ export default {
|
||||
tempClassB: -1,
|
||||
valid: true,
|
||||
menu: [],
|
||||
beCentralizedStation:{},
|
||||
menuNormal: {
|
||||
Local: [
|
||||
// {
|
||||
@ -430,7 +431,7 @@ export default {
|
||||
{
|
||||
title: '开放/关闭',
|
||||
click: this.standOpenOrClose,
|
||||
operate: OperationEvent.Command.commandNingBo3.line_stand_openOrClose
|
||||
operate: OperationEvent.Command.commandNingBo3.line_stand_openOrClose
|
||||
},
|
||||
{
|
||||
title: '设置/取消扣车',
|
||||
@ -1340,29 +1341,65 @@ export default {
|
||||
'$store.state.training.prdType': function () {
|
||||
this.initMenu();
|
||||
},
|
||||
'$store.state.socket.simulationRoleList':function(list) {
|
||||
if (list && list.length) {
|
||||
this.checkRoleChange(list);
|
||||
}
|
||||
'$store.state.training.changeRoleInfo':function(newval, oldval) {
|
||||
// if (list && list.length) {
|
||||
this.checkRoleChange(oldval, newval);
|
||||
// }
|
||||
}
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.initMenu();
|
||||
// 被控制的车站数据
|
||||
this.stationList.forEach(data=>{
|
||||
if (data.centralized) {
|
||||
data.chargeStationCodeList.forEach(charge=>{
|
||||
this.beCentralizedStation[charge] = data.code;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
checkRoleChange(list) {
|
||||
list.forEach(item => {
|
||||
// || item.messageType == 'ONLINE'
|
||||
if ((item.messageType === 'PLAY_CHANGE') && item.userId == this.userId ) {
|
||||
if (item.memberId && item.type) {
|
||||
// this.$store.dispatch('training/setCurrentRoleInfo', {memberId:item.memberId,type:item.type,deviceCode:});
|
||||
checkRoleChange(oldval, newval) {
|
||||
this.$nextTick(()=>{
|
||||
const memberData = this.$store.state.training.memberData;
|
||||
if (oldval && newval) {
|
||||
const oldMemberId = oldval.split(':')[0];
|
||||
const newMemberId = newval.split(':')[1];
|
||||
if (oldMemberId && oldMemberId != newMemberId) {
|
||||
const oldMember = memberData[oldMemberId];
|
||||
const newMember = memberData[newMemberId];
|
||||
if (oldMember.type == 'STATION_SUPERVISOR' && newMember.type == 'STATION_SUPERVISOR') {
|
||||
const oldStation = this.$store.getters['map/getDeviceByCode'](oldMember.deviceCode);
|
||||
const newStation = this.$store.getters['map/getDeviceByCode'](newMember.deviceCode);
|
||||
if (oldStation.controller || newStation.controller) {
|
||||
console.log(9999999999, oldStation.controller, newStation.controller);
|
||||
if (newStation.controller) {
|
||||
let centerStation;
|
||||
if (newStation.centralized) {
|
||||
centerStation = newStation;
|
||||
} else {
|
||||
const newCenter = this.$store.getters['map/getDeviceByCode'](this.beCentralizedStation[newMember.deviceCode]);
|
||||
centerStation = newCenter;
|
||||
}
|
||||
centerStation && centerStation.instance && centerStation.instance.handleComplexControl(newStation.controller);
|
||||
centerStation.chargeStationCodeList.forEach(item => {
|
||||
const device = this.$store.getters['map/getDeviceByCode'](item);
|
||||
device && device.instance && device.instance.handleComplexControl(newStation.controller);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (oldMember.type == 'DISPATCHER' && newMember.type == 'DISPATCHER') {
|
||||
// }else if(oldMember.type == 'DISPATCHER' && newMember.type == 'DISPATCHER'){
|
||||
// }
|
||||
}
|
||||
// currentRole
|
||||
// this.$store.state;
|
||||
// this.switchShowStation(this.centralizedMap[item.deviceCode]);
|
||||
// "memberId":"1","type":"DISPATCHER","deviceCode":"Station10002"
|
||||
}
|
||||
// else if (oldval) {
|
||||
|
||||
// } else {
|
||||
|
||||
// }
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -35,6 +35,7 @@ const training = {
|
||||
roles: '', // 角色权限类型
|
||||
roleDeviceCode:'', // 当前角色对应的deviceCode
|
||||
centerStationCode:'', // 当前居中的集中站code
|
||||
changeRoleInfo:'', // 切换角色的信息()
|
||||
memberList: [], // 综合仿真成员列表
|
||||
memberData: {}, // 综合仿真成员列表
|
||||
simulationUserList: [], // 综合仿真用户列表
|
||||
@ -258,10 +259,20 @@ const training = {
|
||||
} else if (item.messageType === 'KICK_OUT' && memberIndex > -1) {
|
||||
state.simulationUserList.splice(memberIndex, 1);
|
||||
}
|
||||
|
||||
if (item.messageType === 'PLAY_CHANGE') {
|
||||
if (item.memberId) {
|
||||
state.changeRoleInfo = ':' + item.memberId;
|
||||
} else {
|
||||
state.changeRoleInfo = memberId + ':';
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
setRoleDeviceCode :(state, roleDeviceCode) => {
|
||||
state.roleDeviceCode = roleDeviceCode;
|
||||
|
Loading…
Reference in New Issue
Block a user