diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 222b03d03..65716689c 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -433,17 +433,26 @@ class Jlmap { this.$painter.update(cycleButton); } } else if (elem.deviceType === 'STATION') { - const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig); - const guideLock = this.mapDevice[oDevice.guideLockCode]; - const guideLockStatus = {totalGuideLock: elem.totalGuideLock}; - if (guideLock && this.hookHandle(guideLock, guideLockStatus)) { - this.$painter.update(guideLock); - } - if (elem.dispose) { - this.$painter.delete(oDevice); + // 如果是控制权转移消息 + if (elem.applicantIdOfControlTransfer) { + store.dispatch('map/setControlTransfer', elem); } else { - this.$painter.update(oDevice); + 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}; + if (guideLock && this.hookHandle(guideLock, guideLockStatus)) { + this.$painter.update(guideLock); + } + if (elem.dispose) { + this.$painter.delete(oDevice); + } else { + this.$painter.update(oDevice); + } } + } else { if (elem.deviceType === 'TRAIN') { this.isUpdateShowTrainList = true; diff --git a/src/jmapNew/theme/foshan_01/menus/passiveDialog/control.vue b/src/jmapNew/theme/foshan_01/menus/passiveDialog/control.vue index 7971739f3..32f2451f1 100644 --- a/src/jmapNew/theme/foshan_01/menus/passiveDialog/control.vue +++ b/src/jmapNew/theme/foshan_01/menus/passiveDialog/control.vue @@ -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) { - this.doShow(elem); - this.sourceMemberId = elem.sourceMemberId; - } + '$store.state.map.controlTransfer':function (elem) { + if (!this.dialogShow && elem) { + this.doShow(elem); } } }, @@ -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, - 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 || ''; + const model = { + code: code, + operate: '', + control: { code: '', name: '' }, + target: { code: '', name: '' }, + agree: true, + disabled: false + }; + if (device) { + const control = (device || {}).controlMode; + if (control) { + model.control = { status: control, name: this.controlProps[control] }; + const targetStatus = controlTransfer.apply2TheControlMode; + model.target = { status:targetStatus, name: this.controlProps[targetStatus] }; } - this.tableData.push(model); - }); + 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(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 }); + } + }); } - this.dialogShow = true; - this.disabledAgree = true; - this.createTimer(); - this.updateTableData(msgHead.params.stationCodes); - - 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(); diff --git a/src/jmapNew/theme/ningbo_01/menus/passiveDialog/control.vue b/src/jmapNew/theme/ningbo_01/menus/passiveDialog/control.vue index 50609be39..cd651040b 100644 --- a/src/jmapNew/theme/ningbo_01/menus/passiveDialog/control.vue +++ b/src/jmapNew/theme/ningbo_01/menus/passiveDialog/control.vue @@ -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) { - this.doShow(elem); - this.sourceMemberId = elem.sourceMemberId; - } - } else { - this.$store.dispatch('socket/shiftMsgQueue'); + '$store.state.map.controlTransfer':function (elem) { + if (!this.dialogShow && elem) { + this.doShow(elem); } }, '$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,41 +171,36 @@ 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: '', - control: { code: '', name: '' }, - target: { code: '', name: '' }, - 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] }; - } - model.operate = device.name || ''; + const model = { + code: code, + operate: '', + control: { code: '', name: '' }, + target: { code: '', name: '' }, + agree: true, + disabled: false + }; + if (device) { + const control = (device || {}).controlMode; + if (control) { + model.control = { status: control, name: this.controlProps[control] }; + const targetStatus = controlTransfer.apply2TheControlMode; + model.target = { status: targetStatus, name: this.controlProps[targetStatus] }; } - this.tableData.push(model); - }); + 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,26 +214,25 @@ export default { }); } this.requestInfo = info; + this.dialogShow = true; + this.disabledAgree = true; + this.createTimer(); + 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 }); + } + }); } - this.dialogShow = true; - this.disabledAgree = true; - this.createTimer(); - this.updateTableData(msgHead); - 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; - 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 } }; diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 01f0c49de..856182877 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -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); } } }; diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index aa78d7418..4676cbcf3 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -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); }, diff --git a/src/store/modules/training.js b/src/store/modules/training.js index 9a725cf04..a2d7e25c6 100644 --- a/src/store/modules/training.js +++ b/src/store/modules/training.js @@ -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); } } }; diff --git a/src/views/newMap/displayNew/menuDemon.vue b/src/views/newMap/displayNew/menuDemon.vue index 30f1d42aa..603316fd7 100644 --- a/src/views/newMap/displayNew/menuDemon.vue +++ b/src/views/newMap/displayNew/menuDemon.vue @@ -8,7 +8,8 @@
菜单
- + + {{ jl3dmodel }} @@ -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); } } diff --git a/src/views/newMap/jointTrainingNew/index.vue b/src/views/newMap/jointTrainingNew/index.vue index 54d4356e7..df2215d97 100644 --- a/src/views/newMap/jointTrainingNew/index.vue +++ b/src/views/newMap/jointTrainingNew/index.vue @@ -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); } diff --git a/src/views/newMap/jointTrainingNew/menuDemon.vue b/src/views/newMap/jointTrainingNew/menuDemon.vue index 99ef4bf82..5e3e87be7 100644 --- a/src/views/newMap/jointTrainingNew/menuDemon.vue +++ b/src/views/newMap/jointTrainingNew/menuDemon.vue @@ -5,7 +5,8 @@
菜单
- + + {{ $t('display.demon.deviceView') }} @@ -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{