控制权转移代码调整

This commit is contained in:
joylink_cuiweidong 2020-08-06 19:34:13 +08:00
parent c7f6639801
commit abb0143988
9 changed files with 182 additions and 135 deletions

View File

@ -433,6 +433,13 @@ class Jlmap {
this.$painter.update(cycleButton);
}
} else if (elem.deviceType === 'STATION') {
// 如果是控制权转移消息
if (elem.applicantIdOfControlTransfer) {
store.dispatch('map/setControlTransfer', elem);
} else {
if (this.mapDevice[code].controlMode != elem.controlMode) {
store.dispatch('map/closeControlTransfer', elem);
}
const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
const guideLock = this.mapDevice[oDevice.guideLockCode];
const guideLockStatus = {totalGuideLock: elem.totalGuideLock};
@ -444,6 +451,8 @@ class Jlmap {
} else {
this.$painter.update(oDevice);
}
}
} else {
if (elem.deviceType === 'TRAIN') {
this.isUpdateShowTrainList = true;

View File

@ -117,12 +117,9 @@ export default {
},
deep: true
},
'$store.state.socket.msgHead': function (elem) {
if (elem && (elem.operateType == 'CM_Apply_For_Station_Control' || elem.operateType == 'CM_Apply_For_Center_Control' || elem.operateType == 'CM_Force_Station_Control')) {
if (elem.params.stationCodes && elem.params.stationCodes.length) {
'$store.state.map.controlTransfer':function (elem) {
if (!this.dialogShow && elem) {
this.doShow(elem);
this.sourceMemberId = elem.sourceMemberId;
}
}
}
},
@ -172,34 +169,55 @@ export default {
this.disabledAgree = this.selection.length <= 0;
}
},
updateTableData(codes) {
updateTableData(controlTransfer) {
const code = controlTransfer.code;
const device = this.$store.getters['map/getDeviceByCode'](code);
this.tableData = [];
(codes || []).forEach(code=> {
const model = {
code: code,
operate: '',
control: { code: '', name: '' },
target: { code: '', name: '' },
agree: false,
agree: true,
disabled: false
};
const device = this.$store.getters['map/getDeviceByCode'](code);
if (device) {
const control = (device || {}).controlMode;
if (control) {
model.control = { status: control, name: this.controlProps[control] };
model.target = { status: this.targetStatus, name: this.controlProps[this.targetStatus] };
const targetStatus = controlTransfer.apply2TheControlMode;
model.target = { status:targetStatus, name: this.controlProps[targetStatus] };
}
model.operate = device.name || '';
}
this.tableData.push(model);
});
// this.tableData = [];
// (codes || []).forEach(code=> {
// const model = {
// code: code,
// operate: '',
// control: { code: '', name: '' },
// target: { code: '', name: '' },
// agree: false,
// disabled: false
// };
// const device = this.$store.getters['map/getDeviceByCode'](code);
// if (device) {
// const control = (device || {}).controlMode;
// if (control) {
// model.control = { status: control, name: this.controlProps[control] };
// model.target = { status: this.targetStatus, name: this.controlProps[this.targetStatus] };
// }
// model.operate = device.name || '';
// }
// this.tableData.push(model);
// });
},
doShow(msgHead) {
const member = this.$store.state.training.memberData[msgHead.sourceMemberId];
doShow(controlTransfer) {
const member = this.$store.state.training.memberData[controlTransfer.applicantIdOfControlTransfer];
const simulationUserList = this.$store.state.training.simulationUserList;
if (member) {
if (member && member.userId != this.$store.state.user.id) {
let info = SimulationType[member.type];
if (member.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
@ -213,30 +231,24 @@ export default {
});
}
this.requestInfo = info;
}
this.dialogShow = true;
this.disabledAgree = true;
this.createTimer();
this.updateTableData(msgHead.params.stationCodes);
this.updateTableData(controlTransfer);
const operate = {
start: true,
operation: OperationEvent.StationControl.controlResponse.menu.operation
};
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
}
},
doClose() {
this.disabledAgree = false;
if (this.dialogShow) {
this.$store.dispatch('socket/shiftMsgQueue');
}
this.count = 0;
this.dialogShow = false;
this.clearTimer();

View File

@ -109,20 +109,21 @@ export default {
},
deep: true
},
'$store.state.socket.msgHead': function (elem) {
if (!this.dialogShow && elem && (elem.operateType == 'CM_Apply_For_Station_Control' || elem.operateType == 'CM_Apply_For_Center_Control') && !elem.success) {
if (elem.params.stationCodes && elem.params.stationCodes.length) {
'$store.state.map.controlTransfer':function (elem) {
if (!this.dialogShow && elem) {
this.doShow(elem);
this.sourceMemberId = elem.sourceMemberId;
}
} else {
this.$store.dispatch('socket/shiftMsgQueue');
}
},
'$store.state.map.keyboardEnterCount': function (val) {
if (this.show && !this.disabledAgree) {
this.agree();
}
},
//
'$store.state.map.closeControlTransfer':function (elem) {
if (this.dialogShow) {
this.doClose();
}
}
},
mounted() {
@ -170,10 +171,10 @@ export default {
this.disabledAgree = this.selection.length <= 0;
}
},
updateTableData(msgHead) {
const codes = msgHead.params.stationCodes;
updateTableData(controlTransfer) {
const code = controlTransfer.code;
const device = this.$store.getters['map/getDeviceByCode'](code);
this.tableData = [];
(codes || []).forEach(code=> {
const model = {
code: code,
operate: '',
@ -182,29 +183,24 @@ export default {
agree: true,
disabled: false
};
const device = this.$store.getters['map/getDeviceByCode'](code);
if (device) {
const control = (device || {}).controlMode;
if (control) {
model.control = { status: control, name: this.controlProps[control] };
this.targetStatus = 'Center';
if (msgHead.operateType == 'CM_Apply_For_Center_Control') {
this.targetStatus = 'Center';
} else if (msgHead.operateType == 'CM_Apply_For_Station_Control') {
this.targetStatus = 'Local';
}
model.target = { status: this.targetStatus, name: this.controlProps[this.targetStatus] };
const targetStatus = controlTransfer.apply2TheControlMode;
model.target = { status: targetStatus, name: this.controlProps[targetStatus] };
}
model.operate = device.name || '';
}
this.tableData.push(model);
});
},
doShow(msgHead) {
const member = this.$store.state.training.memberData[msgHead.sourceMemberId];
doShow(controlTransfer) {
const member = this.$store.state.training.memberData[controlTransfer.applicantIdOfControlTransfer];
const simulationUserList = this.$store.state.training.simulationUserList;
if (member) {
//
if (member && member.userId != this.$store.state.user.id &&
((member.type == 'STATION_SUPERVISOR' && this.$store.state.training.roles == 'DISPATCHER') ||
(member.type == 'DISPATCHER' && this.$store.state.training.roleDeviceCode == controlTransfer.code))) {
let info = SimulationType[member.type];
if (member.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
@ -218,11 +214,10 @@ export default {
});
}
this.requestInfo = info;
}
this.dialogShow = true;
this.disabledAgree = true;
this.createTimer();
this.updateTableData(msgHead);
this.updateTableData(controlTransfer);
const operate = {
start: true,
operation: OperationEvent.StationControl.controlResponse.menu.operation
@ -233,11 +228,11 @@ export default {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
}
},
doClose() {
this.disabledAgree = false;
this.$store.dispatch('socket/shiftMsgQueue');
this.count = 0;
this.dialogShow = false;
this.clearTimer();
@ -271,10 +266,10 @@ export default {
}
},
agree() {
const stationCodes = [];
const replyVOList = [];
this.tableData.forEach(item => {
if (item.agree) {
stationCodes.push(item.code);
replyVOList.push({stationCode:item.code, agree:true });
}
});
const operate = {
@ -283,9 +278,7 @@ export default {
send: true,
cmdType: this.targetStatus == 'Center' ? CMD.ControlConvertMenu.CMD_CM_REPLY_CENTER_CONTROL : CMD.ControlConvertMenu.CMD_CM_REPLY_STATION_CONTROL,
param: {
sourceMemberId: this.sourceMemberId,
stationCodes: stationCodes,
agree: true
replyVOList: replyVOList
}
};
@ -301,10 +294,10 @@ export default {
});
},
refuse() {
const stationCodes = [];
const replyVOList = [];
this.tableData.forEach(item => {
if (item.agree) {
stationCodes.push(item.code);
replyVOList.push({stationCode:item.code, agree:false });
}
});
const operate = {
@ -313,9 +306,7 @@ export default {
send: true,
cmdType: this.targetStatus == 'Center' ? CMD.ControlConvertMenu.CMD_CM_REPLY_CENTER_CONTROL : CMD.ControlConvertMenu.CMD_CM_REPLY_STATION_CONTROL,
param: {
sourceMemberId: this.sourceMemberId,
stationCodes: stationCodes,
agree: false
replyVOList: replyVOList
}
};

View File

@ -234,7 +234,9 @@ const map = {
jumpStandList: [], // 跳停站台列表
jumpStatus: false, // 是否有跳停状态
selectDeviceFlag: false, // 设备管理激活判断
keyboardEnterCount: 0 // 键盘enter键触发
keyboardEnterCount: 0, // 键盘enter键触发
controlTransfer:{}, // 控制权转移消息
closeControlTransfer:0 // 关闭当前控制权转移弹窗
},
getters: {
@ -871,6 +873,12 @@ const map = {
},
setKeyboardEnter: (state) => {
state.keyboardEnterCount++;
},
setControlTransfer:(state, controlTransfer)=> {
state.controlTransfer = controlTransfer;
},
closeControlTransfer: (state) => {
state.closeControlTransfer++;
}
},
@ -1072,6 +1080,12 @@ const map = {
},
setKeyboardEnter: ({ commit }) => {
commit('setKeyboardEnter');
},
setControlTransfer:({ commit }, data) => {
commit('setControlTransfer', data);
},
closeControlTransfer:({ commit }, data) => {
commit('closeControlTransfer', data);
}
}
};

View File

@ -66,9 +66,11 @@ function handle(state, data) {
case 'Simulation_PlayBack_Conversation': // 回放-用户交互消息
handleSimulationInfo(state, msg);
break;
case 'Simulation_ApplyHandle': // 请求处理消息
case 'Simulation_ApplyHandle': // 请求处理消息(旧版可能在用,新版地图不用这个)
handlePushMsgQueue(state, msg);
break;
case 'JointTraining_User_Permit': // 综合演练室-用户获取权限消息
state.userPermit = msg;
break;
@ -183,6 +185,7 @@ function handleSimulationUserinfo(state, data) {
state.simulationRoleList = (data instanceof Array) ? data : [data];
}
// (旧版可能在用,新版地图不用这个)
function handlePushMsgQueue(state, msg) {
if (msg instanceof Array) {
state.msgQueue.concat(msg);
@ -224,8 +227,8 @@ const socket = {
conversationInfo: {}, // 仿真会话消息
message: {}, // 仿真聊天
msgQueue: [], // 命令请求列表
msgHead: null, // 消息头
msgQueue: [], // 命令请求列表(旧版控制权转移可能在用,新版不用这个)
msgHead: null, // 消息头(旧版控制权转移可能在用,新版不用这个)
userPermit: {}, // 用户获取权限消息
userRoomKickOut: {}, // 用户被踢出房间消息
@ -279,11 +282,14 @@ const socket = {
state.payOrder = payOrder;
},
// (旧版可能在用,新版地图不用这个)
shiftMsgQueue: (state) => {
state.msgHead = null;
state.msgQueue.shift();
state.msgHead = state.msgQueue[0];
},
// (旧版可能在用,新版地图不用这个)
pushMsgQueue: (state, msg) => {
handlePushMsgQueue(state, msg);
},
@ -355,9 +361,9 @@ const socket = {
commit('shiftMsgQueue');
},
pushMsgQueue: ({ commit }, msg) => {
commit('pushMsgQueue', msg);
},
// pushMsgQueue: ({ commit }, msg) => {
// commit('pushMsgQueue', msg);
// },
setRoomSubscribe:({ commit }, msg) => {
commit('setRoomSubscribe', msg);
},

View File

@ -34,6 +34,7 @@ const training = {
initTime: 0, // 当前系统时间
prdType: '', // 产品类型
roles: '', // 角色权限类型
roleDeviceCode:'', // 当前角色对应的deviceCode
group: '', // 设置全局 group
centerStationCode:'', // 当前居中的集中站code
memberList: [], // 综合仿真成员列表
@ -282,6 +283,9 @@ const training = {
console.error(e);
}
});
},
setRoleDeviceCode :(state, roleDeviceCode) => {
state.roleDeviceCode = roleDeviceCode;
}
},
@ -698,6 +702,10 @@ const training = {
/** 更新剧本所有成员列表 */
updateMemberListInScript:({ commit }, data) => {
commit('updateMemberListInScript', data);
},
/** 更新当前角色的deviceCode */
setRoleDeviceCode:({ commit }, roleDeviceCode) => {
commit('setRoleDeviceCode', roleDeviceCode);
}
}
};

View File

@ -8,7 +8,8 @@
</div>
<div v-if="!dataError" class="display_top_draft" :style="{top: offset+'px'}">
<div class="btn_hover" @click="menuClick">菜单</div>
<el-button-group ref="button_group_box" class="button_group_box" :style="`transform: translateX(-${btnWidth}px)`">
<!-- :style="`transform: translateX(-${btnWidth}px)`" -->
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`">
<!-- 地图错误判断 -->
<!-- 设备视图 -->
<el-button v-if="isShow3dmodel && !isShowScheduling" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
@ -357,6 +358,7 @@ export default {
// this.$refs.button_group_box.$el.clientWidth ||
this.btnWidth = 500; //
} else {
// button_group_box
this.btnWidth = 0;
}
}
@ -451,7 +453,8 @@ export default {
float: left;
transition: all 0.5s;
overflow: hidden;
transform: translateX(0px);
margin-left: -500px;
// transform: translateX(0px);
}
}
</style>

View File

@ -333,6 +333,7 @@ export default {
const data = res.data || {};
this.userRole = data.type || 'AUDIENCE';
this.deviceCode = data.deviceCode;
this.$store.dispatch('training/setRoleDeviceCode', data.deviceCode);
this.isAdmin = data.admin;
const deviceVO = this.$store.state.user.projectDevice;
@ -613,6 +614,7 @@ export default {
this.$refs.demonMenu.back();
} else if (item.messageType === 'PLAY_CHANGE' && item.userId == this.userId) {
this.userRole = item.type || 'AUDIENCE';
this.$store.dispatch('training/setRoleDeviceCode', item.deviceCode);
this.setSimulationPrdType(this.centralizedStationMap[item.deviceCode]);
this.$nextTick(() => {
if (item.deviceCode) { this.setCenter(item.deviceCode); }

View File

@ -5,7 +5,8 @@
<!-- 地图错误判断 -->
<div v-if="!dataError&&hasOneButton" class="display_top_draft" :style="{top: offset+'px'}">
<div class="btn_hover" @click="menuClick">菜单</div>
<el-button-group ref="button_group_box" class="button_group_box" :style="`transform: translateX(-${btnWidth}px)`">
<!-- transform: translateX(-${btnWidth}px) -->
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`">
<!-- 设备视图 -->
<el-button v-if="isShow3dmodel && isShowScheduling" size="small" @click="jumpjlmap3dmodel">{{ $t('display.demon.deviceView') }}</el-button>
<!-- 三维视图 / 司机视角 -->
@ -550,7 +551,8 @@ export default {
float: left;
transition: all 0.5s;
overflow: hidden;
transform: translateX(0px);
// transform: translateX(0px);
margin-left: -500px;
}
}
.haerbin_btn_box{