剧本录制控制权转移代码调整

This commit is contained in:
joylink_cuiweidong 2020-08-12 17:34:37 +08:00
parent 55911240b6
commit 8fd00b3493
6 changed files with 102 additions and 12 deletions

View File

@ -279,6 +279,7 @@ export default {
}, },
agree() { agree() {
const replyVOList = []; const replyVOList = [];
this.tableData.forEach(item => { this.tableData.forEach(item => {
if (item.agree) { if (item.agree) {
replyVOList.push({stationCode:item.code, agree:true }); replyVOList.push({stationCode:item.code, agree:true });
@ -301,6 +302,17 @@ export default {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); 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(); this.doClose();
} }
}).catch(() => { }).catch(() => {
@ -329,6 +341,18 @@ export default {
this.disabledAgree = true; this.disabledAgree = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (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(); this.doClose();
} }
}).catch(() => { }).catch(() => {

View File

@ -13,7 +13,8 @@ const scriptRecord = {
updateRoleStatus:0, // 剧本更新角色标志 updateRoleStatus:0, // 剧本更新角色标志
updateRoleId:'', // 剧本更新角色id updateRoleId:'', // 剧本更新角色id
updateCoversitionStatus:0, // 剧本仿真更新会话信息 updateCoversitionStatus:0, // 剧本仿真更新会话信息
userRole:null // 剧本更新的角色 userRole:null, // 剧本更新的角色
controlTransfer:{} // 剧本控制权转移
}, },
getters: { getters: {
mapLocation: (state)=>{ mapLocation: (state)=>{
@ -72,6 +73,9 @@ const scriptRecord = {
}, },
updateCoversitionInfo:(state) => { updateCoversitionInfo:(state) => {
state.updateCoversitionStatus += 1; state.updateCoversitionStatus += 1;
},
updateControlTransfer:(state, controlTransfer) => {
state.controlTransfer = controlTransfer;
} }
}, },
actions: { actions: {
@ -101,6 +105,9 @@ const scriptRecord = {
}, },
updateCoversitionInfo:({ commit }) => { updateCoversitionInfo:({ commit }) => {
commit('updateCoversitionInfo'); commit('updateCoversitionInfo');
},
updateControlTransfer:({ commit }, controlTransfer) => {
commit('updateControlTransfer', controlTransfer);
} }
} }
}; };

View File

@ -291,14 +291,16 @@ export default {
} }
}); });
} }
const index = userList.indexOf(val) || 0; const index = userList.indexOf(val);
this.treeData[index].children.forEach(child=>{ if (index >= 0) {
if (child.id == this.$store.state.scriptRecord.updateRoleId) { this.treeData[index].children.forEach(child=>{
child.userId = this.$store.state.user.id; if (child.id == this.$store.state.scriptRecord.updateRoleId) {
child.disabled = true; child.userId = this.$store.state.user.id;
child.label = child.label + '-' + this.$store.state.user.nickname; child.disabled = true;
} child.label = child.label + '-' + this.$store.state.user.nickname;
}); }
});
}
}, },
getAllConversition() { getAllConversition() {
// //

View File

@ -338,7 +338,6 @@ export default {
case 'Delete': this.$store.dispatch('map/setDeleteCount'); case 'Delete': this.$store.dispatch('map/setDeleteCount');
break; break;
case 'Update': case 'Update':
debugger;
this.$refs.offsetX.focus(); this.$refs.offsetX.focus();
this.$store.dispatch('map/setUpdateCount'); this.$store.dispatch('map/setUpdateCount');
break; break;

View File

@ -150,6 +150,11 @@ export default {
if (operateType == 'CM') { if (operateType == 'CM') {
operateType = 'ControlConvertMenu'; 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 operateName = Object.values(CMD[operateType]).find(res=>{ return res.value == commandName; });
const deviceTypeList = {Section:'区段', Switch:'道岔', Signal:'信号机', Stand:'站台', Station:'车站', TrainWindow:'车次窗', ControlConvertMenu:'控制模式', Driver:'司机'}; const deviceTypeList = {Section:'区段', Switch:'道岔', Signal:'信号机', Stand:'站台', Station:'车站', TrainWindow:'车次窗', ControlConvertMenu:'控制模式', Driver:'司机'};
const operateTypeName = deviceTypeList[operateType]; const operateTypeName = deviceTypeList[operateType];

View File

@ -69,6 +69,8 @@ export default {
mapLocation:null, mapLocation:null,
allMemberList:[], allMemberList:[],
memberList:[], memberList:[],
inter:null,
times:60,
size: { size: {
width: 300, width: 300,
height: 300 height: 300
@ -159,14 +161,40 @@ export default {
switchMode(role) { switchMode(role) {
changeScriptRole(this.group, role).then(res=>{ changeScriptRole(this.group, role).then(res=>{
let prdType = ''; let prdType = '';
const controlTransferList = [];
const memberInfo = this.memberList.find(member=>{ const memberInfo = this.memberList.find(member=>{
return member.id == role; return member.id == role;
}); });
if (memberInfo) { if (memberInfo) {
if (memberInfo.type == '行值') { 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'; prdType = '01';
} else if (memberInfo.type == '行调') { } 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'; prdType = '02';
} else if (memberInfo.type == '司机') { } else if (memberInfo.type == '司机') {
prdType = '04'; prdType = '04';
@ -184,6 +212,32 @@ export default {
); );
this.oldMemberId = role; this.oldMemberId = role;
this.$store.dispatch('training/setPrdType', prdType); 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=>{ ConstConfig.ConstSelect.roleTypeNew.forEach(each=>{
if (each.label == memberInfo.type) { if (each.label == memberInfo.type) {
this.$store.dispatch('scriptRecord/updateRole', each.value + ':' + role); this.$store.dispatch('scriptRecord/updateRole', each.value + ':' + role);
@ -269,7 +323,6 @@ export default {
updateMapLocationNew(group, dataZoom).then(response=>{ updateMapLocationNew(group, dataZoom).then(response=>{
saveScriptScenesNew(this.group).then(resp => { saveScriptScenesNew(this.group).then(resp => {
this.$store.dispatch('scriptRecord/updateBgSet', true); this.$store.dispatch('scriptRecord/updateBgSet', true);
this.$store.dispatch('training/setPrdType', null);
this.$message.success(this.$t('scriptRecord.saveBackgroundSuceess')); this.$message.success(this.$t('scriptRecord.saveBackgroundSuceess'));
}).catch(error => { }).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.updateLocationFail')}: ${error.message}`); this.$messageBox(`${this.$t('scriptRecord.updateLocationFail')}: ${error.message}`);