diff --git a/src/jmapNew/theme/components/menus/passiveDialog/control.vue b/src/jmapNew/theme/components/menus/passiveDialog/control.vue index be7cac87b..d06fc9488 100644 --- a/src/jmapNew/theme/components/menus/passiveDialog/control.vue +++ b/src/jmapNew/theme/components/menus/passiveDialog/control.vue @@ -279,6 +279,7 @@ export default { }, agree() { const replyVOList = []; + this.tableData.forEach(item => { if (item.agree) { replyVOList.push({stationCode:item.code, agree:true }); @@ -301,6 +302,17 @@ export default { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + const controlTransfer = this.$store.state.scriptRecord.controlTransfer; + if (controlTransfer.stations) { + replyVOList.forEach(replyVO=>{ + controlTransfer.stations.splice(controlTransfer.stations.indexOf(replyVO.stationCode), 1); + }); + } + if (controlTransfer.stations.length > 0) { + this.$store.dispatch('scriptRecord/updateControlTransfer', controlTransfer); + } else { + this.$store.dispatch('scriptRecord/updateControlTransfer', {}); + } this.doClose(); } }).catch(() => { @@ -329,6 +341,18 @@ export default { this.disabledAgree = true; this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (valid) { + this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); + const controlTransfer = this.$store.state.scriptRecord.controlTransfer; + if (controlTransfer.stations) { + replyVOList.forEach(replyVO=>{ + controlTransfer.stations.splice(controlTransfer.stations.indexOf(replyVO.stationCode), 1); + }); + } + if (controlTransfer.stations.length > 0) { + this.$store.dispatch('scriptRecord/updateControlTransfer', controlTransfer); + } else { + this.$store.dispatch('scriptRecord/updateControlTransfer', {}); + } this.doClose(); } }).catch(() => { diff --git a/src/store/modules/scriptRecord.js b/src/store/modules/scriptRecord.js index eed8e295b..5b3e82c38 100644 --- a/src/store/modules/scriptRecord.js +++ b/src/store/modules/scriptRecord.js @@ -13,7 +13,8 @@ const scriptRecord = { updateRoleStatus:0, // 剧本更新角色标志 updateRoleId:'', // 剧本更新角色id updateCoversitionStatus:0, // 剧本仿真更新会话信息 - userRole:null // 剧本更新的角色 + userRole:null, // 剧本更新的角色 + controlTransfer:{} // 剧本控制权转移 }, getters: { mapLocation: (state)=>{ @@ -72,6 +73,9 @@ const scriptRecord = { }, updateCoversitionInfo:(state) => { state.updateCoversitionStatus += 1; + }, + updateControlTransfer:(state, controlTransfer) => { + state.controlTransfer = controlTransfer; } }, actions: { @@ -101,6 +105,9 @@ const scriptRecord = { }, updateCoversitionInfo:({ commit }) => { commit('updateCoversitionInfo'); + }, + updateControlTransfer:({ commit }, controlTransfer) => { + commit('updateControlTransfer', controlTransfer); } } }; diff --git a/src/views/newMap/displayNew/scriptChat.vue b/src/views/newMap/displayNew/scriptChat.vue index b8f334d06..fc159f84b 100644 --- a/src/views/newMap/displayNew/scriptChat.vue +++ b/src/views/newMap/displayNew/scriptChat.vue @@ -291,14 +291,16 @@ export default { } }); } - const index = userList.indexOf(val) || 0; - this.treeData[index].children.forEach(child=>{ - if (child.id == this.$store.state.scriptRecord.updateRoleId) { - child.userId = this.$store.state.user.id; - child.disabled = true; - child.label = child.label + '-' + this.$store.state.user.nickname; - } - }); + const index = userList.indexOf(val); + if (index >= 0) { + this.treeData[index].children.forEach(child=>{ + if (child.id == this.$store.state.scriptRecord.updateRoleId) { + child.userId = this.$store.state.user.id; + child.disabled = true; + child.label = child.label + '-' + this.$store.state.user.nickname; + } + }); + } }, getAllConversition() { // 获取会话列表 diff --git a/src/views/newMap/jlmapNew/index.vue b/src/views/newMap/jlmapNew/index.vue index 830b7cfb3..5e1ace4dd 100644 --- a/src/views/newMap/jlmapNew/index.vue +++ b/src/views/newMap/jlmapNew/index.vue @@ -338,7 +338,6 @@ export default { case 'Delete': this.$store.dispatch('map/setDeleteCount'); break; case 'Update': - debugger; this.$refs.offsetX.focus(); this.$store.dispatch('map/setUpdateCount'); break; diff --git a/src/views/scriptManage/getAction.vue b/src/views/scriptManage/getAction.vue index 35c978461..a8480c246 100644 --- a/src/views/scriptManage/getAction.vue +++ b/src/views/scriptManage/getAction.vue @@ -150,6 +150,11 @@ export default { if (operateType == 'CM') { operateType = 'ControlConvertMenu'; } + if (commandName == 'CM_Apply_For_Station_Control') { + this.$store.dispatch('scriptRecord/updateControlTransfer', {type:'CM_Apply_For_Station_Control', stations:element.operationParamMap.stationCodes, roleId:this.$store.state.scriptRecord.updateRoleId}); + } else if (commandName == 'CM_Apply_For_Center_Control') { + this.$store.dispatch('scriptRecord/updateControlTransfer', {type:'CM_Apply_For_Center_Control', stations:element.operationParamMap.stationCodes, roleId:this.$store.state.scriptRecord.updateRoleId}); + } const operateName = Object.values(CMD[operateType]).find(res=>{ return res.value == commandName; }); const deviceTypeList = {Section:'区段', Switch:'道岔', Signal:'信号机', Stand:'站台', Station:'车站', TrainWindow:'车次窗', ControlConvertMenu:'控制模式', Driver:'司机'}; const operateTypeName = deviceTypeList[operateType]; diff --git a/src/views/scriptManage/tipScriptRecord.vue b/src/views/scriptManage/tipScriptRecord.vue index 00db9da90..db5e286a1 100644 --- a/src/views/scriptManage/tipScriptRecord.vue +++ b/src/views/scriptManage/tipScriptRecord.vue @@ -69,6 +69,8 @@ export default { mapLocation:null, allMemberList:[], memberList:[], + inter:null, + times:60, size: { width: 300, height: 300 @@ -159,14 +161,40 @@ export default { switchMode(role) { changeScriptRole(this.group, role).then(res=>{ let prdType = ''; - + const controlTransferList = []; const memberInfo = this.memberList.find(member=>{ return member.id == role; }); if (memberInfo) { if (memberInfo.type == '行值') { + const controlTransfer = this.$store.state.scriptRecord.controlTransfer; + if (controlTransfer.type == 'CM_Apply_For_Center_Control' && controlTransfer.stations.includes(memberInfo.deviceCode) ) { + const stations = controlTransfer.stations; + stations.forEach(station=>{ + controlTransferList.push({code:station, deviceType:'STATION', + controlMode:'Local', tbStrategyId:1, applicantIdOfControlTransfer:controlTransfer.roleId, apply2TheControlMode:'Center', validDurationOfControlTransferApplication:60 }); + }); + this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR'); + this.$store.dispatch('training/setRoleDeviceCode', memberInfo.deviceCode); + } prdType = '01'; } else if (memberInfo.type == '行调') { + const controlTransfer = this.$store.state.scriptRecord.controlTransfer; + if (controlTransfer.type == 'CM_Apply_For_Station_Control') { + const stations = controlTransfer.stations; + // if (stations.indexOf(memberInfo.deviceCode)) { + // // {"type":"Simulation_DeviceStatus","body":[{"code":"Station18000", + // // "deviceType":,"controlMode":"Center","tbStrategyId":1,"applicantIdOfControlTransfer":"3", + // // "apply2TheControlMode":"Local","validDurationOfControlTransferApplication":53}]} + // const controlTransferList = [{code:'', applicantIdOfControlTransfer:'' }]; + // this.store.dispatch('map/setControlTransfer', controlTransferList); + // } + stations.forEach(station=>{ + controlTransferList.push({code:station, deviceType:'STATION', + controlMode:'Center', tbStrategyId:1, applicantIdOfControlTransfer:controlTransfer.roleId, apply2TheControlMode:'Local', validDurationOfControlTransferApplication:60 }); + }); + this.$store.dispatch('training/setRoles', 'DISPATCHER'); + } prdType = '02'; } else if (memberInfo.type == '司机') { prdType = '04'; @@ -184,6 +212,32 @@ export default { ); this.oldMemberId = role; this.$store.dispatch('training/setPrdType', prdType); + if (controlTransferList.length > 0) { + this.$store.dispatch('map/setControlTransfer', controlTransferList); + // this.inter = setInterval(()=>{ + // if (this.times > 0) { + // const controlTransfers = []; + // controlTransferList.forEach(controlTransfer=>{ + // controlTransfer.validDurationOfControlTransferApplication = this.times; + // controlTransfers.push(controlTransfer); + // }); + // this.$store.dispatch('map/setControlTransfer', controlTransfers); + // this.times--; + // } else { + // clearInterval(this.inter); + // const controlTransfers = []; + // controlTransferList.forEach(controlTransfer=>{ + // controlTransfer.controlMode = controlTransfer.apply2TheControlMode; + // controlTransfer.applicantIdOfControlTransfer = null; + // controlTransfer.apply2TheControlMode = null; + // controlTransfer.validDurationOfControlTransferApplication = null; + // controlTransfers.push(controlTransfer); + // }); + // this.$store.dispatch('map/setControlTransfer', controlTransfers); + // this.$store.dispatch('scriptRecord/updateControlTransfer', {}); + // } + // }, 1000); + } ConstConfig.ConstSelect.roleTypeNew.forEach(each=>{ if (each.label == memberInfo.type) { this.$store.dispatch('scriptRecord/updateRole', each.value + ':' + role); @@ -269,7 +323,6 @@ export default { updateMapLocationNew(group, dataZoom).then(response=>{ saveScriptScenesNew(this.group).then(resp => { this.$store.dispatch('scriptRecord/updateBgSet', true); - this.$store.dispatch('training/setPrdType', null); this.$message.success(this.$t('scriptRecord.saveBackgroundSuceess')); }).catch(error => { this.$messageBox(`${this.$t('scriptRecord.updateLocationFail')}: ${error.message}`);