实训校验暂提

This commit is contained in:
fan 2022-11-09 15:06:47 +08:00
parent 1443d7d2fa
commit 92a3e85f93
11 changed files with 404 additions and 2069 deletions

View File

@ -301,9 +301,6 @@ export default {
passWordCommit(data) {
let operate = {};
if (data.nextCmdType) {
if (data.nextCmdType == CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE) {
this.$store.dispatch('training/updateMapState', [{code: data.code, _type:'SignalButton', pressDown: 0}]);
}
operate = {
over: true,
operation: data.operateNext,
@ -312,37 +309,63 @@ export default {
userOperationType: 'leftClick',
param: data.param
};
this.$store.dispatch('trainingNew/next', operate).then( result => {
if (result.valid) {
if (data.nextCmdType == CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE) {
this.$store.dispatch('training/updateMapState', [{code: data.code, _type:'SignalButton', pressDown: 0}]);
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('trainingNew/execute', { cmdType: result.cmdType, wholeParam: result.params }).then(resp => {
if (operate.operationPre === this.Switch.guideLock.leftButton.operation || operate.operation === this.Switch.guideLock.leftButton.operation) {
this.guideLockLeftFlag = !this.guideLockLeftFlag;
} else if (operate.operationPre === this.Switch.guideLock.rightButton.operation || operate.operation === this.Switch.guideLock.rightButton.operation) {
this.guideLockRightFlag = !this.guideLockRightFlag;
}
this.clearOperate();
}).catch(e => {
console.error(e);
this.$refs.noticeInfo.doShow();
this.clearOperate();
});
}
});
} else {
operate = {
operationPre: data.operation,
operation: data.operateNext,
userOperationType: 'leftClick'
};
}
this.trainingOperation(operate);
},
//
trainingOperation(operate) {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
/* 引导总锁输入面后 处理按钮选中状态 */
if (operate.operationPre === this.Switch.guideLock.leftButton.operation || operate.operation === this.Switch.guideLock.leftButton.operation) {
this.guideLockLeftFlag = !this.guideLockLeftFlag;
} else if (operate.operationPre === this.Switch.guideLock.rightButton.operation || operate.operation === this.Switch.guideLock.rightButton.operation) {
this.guideLockRightFlag = !this.guideLockRightFlag;
}
this.$store.dispatch('trainingNew/next', operate).then( result => {
if (operate.operationPre == this.Station.powerUnLock.button.operation) {
this.clearOperate();
}
// debugger;
// this.$store.dispatch('menuOperation/setButtonOperation', operate.operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
}).catch((error) => {
console.error(error);
this.$refs.noticeInfo.doShow();
});
});
}
// this.trainingOperation(operate);
},
//
// trainingOperation(operate) {
// this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
// if (valid) {
// /* */
// if (operate.operationPre === this.Switch.guideLock.leftButton.operation || operate.operation === this.Switch.guideLock.leftButton.operation) {
// this.guideLockLeftFlag = !this.guideLockLeftFlag;
// } else if (operate.operationPre === this.Switch.guideLock.rightButton.operation || operate.operation === this.Switch.guideLock.rightButton.operation) {
// this.guideLockRightFlag = !this.guideLockRightFlag;
// }
// if (operate.operationPre == this.Station.powerUnLock.button.operation) {
// this.clearOperate();
// }
// // debugger;
// // this.$store.dispatch('menuOperation/setButtonOperation', operate.operation); //
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// }
// }).catch((error) => {
// console.error(error);
// this.$refs.noticeInfo.doShow();
// });
// },
updateButtonShow(val, old) {
if (old) {
//
@ -406,8 +429,8 @@ export default {
code: model.code,
userOperationType: 'leftClick'
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
const {switchSection, code, shuntingTypeList} = model;
this.$refs.defectiveShunting.doShow({switchSection, code, shuntingTypeList});
}
@ -420,8 +443,8 @@ export default {
operation: this.Station.stationMasterLock.leftButton.operation,
userOperationType: 'leftClick'
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
//
operate.nextCmdType = this.sGuideMasterLock ? CMD.Station.CMD_STATION_MASTER_UNLOCK : CMD.Station.CMD_STATION_MASTER_LOCK;
operate.param = {throat: 'S', stationCode: this.$store.state.map.showCentralizedStationCode};
@ -437,8 +460,8 @@ export default {
operation: this.Station.stationMasterLock.rightButton.operation,
userOperationType: 'leftClick'
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
//
operate.nextCmdType = this.xGuideMasterLock ? CMD.Station.CMD_STATION_MASTER_UNLOCK : CMD.Station.CMD_STATION_MASTER_LOCK;
operate.param = {throat: 'X', stationCode: this.$store.state.map.showCentralizedStationCode};
@ -450,58 +473,78 @@ export default {
},
buttonDown(operation, commandTypeList) {
this.clearOperate();
if (operation != this.Command.cancel.clearMbm.operation) {
const operate = {
operation: operation,
userOperationType: 'leftClick'
};
//
const operationList = [this.Signal.humanTrainRoute.button.operation,
this.Section.fault.button.operation,
this.Section.defectiveShunting.button.operation,
this.Station.powerUnLock.button.operation,
this.Signal.signalTurnOff.menuButton.operation];
const operationMap = {
[this.Signal.humanTrainRoute.button.operation]:'总人解',
[this.Section.fault.button.operation]:'区故解',
[this.Section.defectiveShunting.button.operation]:'分路不良',
[this.Signal.signalTurnOff.menuButton.operation]:'灭灯',
[this.Station.powerUnLock.button.operation]:'上电解锁'
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.operation = operation;
this.commandTypeList = commandTypeList;
this.$store.dispatch('menuOperation/setButtonOperation', operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
//
if (operationList.includes(operation)) {
operate['operateNext'] = this.Command.close.password.operation;
if (operation == this.Station.powerUnLock.button.operation) {
operate.nextCmdType = CMD.Station.CMD_STATION_POWER_ON_UNLOCK;
operate.param = {stationCode: this.$store.state.map.showCentralizedStationCode};
}
this.$refs.password.doShow(operate, operationMap[operation]);
}
this.timeNode = this.$store.state.socket.simulationTimeSync;
this.$store.dispatch('training/emitTipFresh');
}
});
} else {
//
const operate = {
start: true,
userOperationType: 'leftClick',
operation: operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.commandTypeList = [];
this.$store.dispatch('menuOperation/setButtonOperation', null);
this.guideLockRightFlag = false;
}
});
}
const operate = {
start: true,
operation: operation,
userOperationType: 'leftClick'
};
//
const operationList = [this.Signal.humanTrainRoute.button.operation,
this.Section.fault.button.operation,
this.Section.defectiveShunting.button.operation,
this.Station.powerUnLock.button.operation,
this.Signal.signalTurnOff.menuButton.operation];
const operationMap = {
[this.Signal.humanTrainRoute.button.operation]:'总人解',
[this.Section.fault.button.operation]:'区故解',
[this.Section.defectiveShunting.button.operation]:'分路不良',
[this.Signal.signalTurnOff.menuButton.operation]:'灭灯',
[this.Station.powerUnLock.button.operation]:'上电解锁'
};
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (operation === this.Command.cancel.clearMbm.operation) {
this.commandTypeList = [];
this.$store.dispatch('menuOperation/setButtonOperation', null);
this.guideLockRightFlag = false;
this.guideLockLeftFlag = false;
}
});
// this.commandTypeList = [];
// this.$store.dispatch('menuOperation/setButtonOperation', null);
// this.guideLockRightFlag = false;
// this.guideLockLeftFlag = false;
// if (operation != this.Command.cancel.clearMbm.operation) {
// const operate = {
// operation: operation,
// userOperationType: 'leftClick'
// };
// this.$store.dispatch('trainingNew/next', operate).then(result => {
// if (result.valid) {
// this.operation = operation;
// this.commandTypeList = commandTypeList;
// this.$store.dispatch('menuOperation/setButtonOperation', operation); //
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// //
// if (operationList.includes(operation)) {
// operate['operateNext'] = this.Command.close.password.operation;
// if (operation == this.Station.powerUnLock.button.operation) {
// operate.nextCmdType = CMD.Station.CMD_STATION_POWER_ON_UNLOCK;
// operate.param = {stationCode: this.$store.state.map.showCentralizedStationCode};
// }
// this.$refs.password.doShow(operate, operationMap[operation]);
// }
// this.timeNode = this.$store.state.socket.simulationTimeSync;
// this.$store.dispatch('training/emitTipFresh');
// }
// });
// } else {
// //
// const operate = {
// start: true,
// userOperationType: 'leftClick',
// operation: operation
// };
// this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
// if (valid) {
// this.commandTypeList = [];
// this.$store.dispatch('menuOperation/setButtonOperation', null);
// this.guideLockRightFlag = false;
// this.guideLockLeftFlag = false;
// }
// });
// }
},
//
handleRouteDataMap() {

View File

@ -6,7 +6,7 @@
<center><b></b><b></b></center>
</span>
</button>
<button :id="MixinCommand.totalCancel.button.domId" class="button_box" @click="buttonDown(MixinCommand.totalCancel.button.operation, ['Signal','SignalButton'])">
<button :id="MixinCommand.totalCancel.button.domId" class="button_box" @click="buttonDown(MixinCommand.totalCancel.button.operation, [])">
<span :style="{color: operation === MixinCommand.totalCancel.button.operation ? '#ccc': 'black'}">
<center><b></b></center>
<center><b></b><b></b></center>
@ -341,13 +341,24 @@ export default {
},
//
trainingOperation(operate) {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
// this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// }
// }).catch((error) => {
// console.error(error);
// this.$refs.noticeInfo.doShow();
// });
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('trainingNew/execute', { cmdType: result.cmdType, wholeParam: result.params }).then(resp => {
console.log(resp);
}).catch(e => {
console.error(e);
this.$refs.noticeInfo.doShow();
});
}
}).catch((error) => {
console.error(error);
this.$refs.noticeInfo.doShow();
});
},
updateButtonShow(val, old) {
@ -376,12 +387,11 @@ export default {
userOperationType: 'leftClick',
operation: this.Switch.guideLock.leftButton.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
//
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
operate.nextCmdType = CMD.Switch.CMD_SWITCH_MASTER_UNBLOCK;
operate.param = {right: false};
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
@ -393,12 +403,11 @@ export default {
userOperationType: 'leftClick',
operation: this.Switch.guideLock.rightButton.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
//
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
operate.nextCmdType = CMD.Switch.CMD_SWITCH_MASTER_UNBLOCK;
operate.param = {right: true};
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
@ -407,47 +416,71 @@ export default {
buttonDown(operation, commandTypeList) {
const station = this.$store.getters['map/getDeviceByCode'](this.$store.state.training.roleDeviceCode);
if (!station || station.controlMode === 'Interlock') { return; }
this.clearOperate();
if (operation != this.Command.cancel.clearMbm.operation) {
const operate = {
userOperationType: 'leftClick',
operation: operation
};
// 684
const operationList = [
this.Signal.humanTrainRoute.button.operation,
this.Section.fault.button.operation,
this.Signal.guide.button.operation
];
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.operation = operation;
this.commandTypeList = commandTypeList;
this.$store.dispatch('menuOperation/setButtonOperation', operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
//
if (operationList.includes(operation)) {
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
this.timeNode = this.$store.state.socket.simulationTimeSync;
this.$store.dispatch('training/emitTipFresh');
const operate = {
start: operation != this.Command.cancel.clearMbm.operation,
userOperationType: 'leftClick',
operation: operation
};
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('menuOperation/setButtonOperation', operation === this.Command.cancel.clearMbm.operation ? null : operation);
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.operation = operation;
this.commandTypeList = commandTypeList;
const operationList = [
this.Signal.humanTrainRoute.button.operation,
this.Section.fault.button.operation,
this.Signal.guide.button.operation
];
if (operationList.includes(operation)) {
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
});
} else {
//
const operate = {
start: true,
userOperationType: 'leftClick',
operation: operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.commandTypeList = [];
this.$store.dispatch('menuOperation/setButtonOperation', null);
}
});
}
this.timeNode = this.$store.state.socket.simulationTimeSync;
// this.$store.dispatch('training/emitTipFresh');
}
});
// this.clearOperate();
// if (operation != this.Command.cancel.clearMbm.operation) {
// const operate = {
// userOperationType: 'leftClick',
// operation: operation
// };
// // 684
// const operationList = [
// this.Signal.humanTrainRoute.button.operation,
// this.Section.fault.button.operation,
// this.Signal.guide.button.operation
// ];
// this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
// if (valid) {
// this.operation = operation;
// this.commandTypeList = commandTypeList;
// this.$store.dispatch('menuOperation/setButtonOperation', operation); //
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// //
// if (operationList.includes(operation)) {
// operate['operateNext'] = this.Command.close.password.operation;
// this.$refs.password.doShow(operate);
// }
// this.timeNode = this.$store.state.socket.simulationTimeSync;
// this.$store.dispatch('training/emitTipFresh');
// }
// });
// } else {
// //
// const operate = {
// start: true,
// userOperationType: 'leftClick',
// operation: operation
// };
// this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
// if (valid) {
// this.commandTypeList = [];
// this.$store.dispatch('menuOperation/setButtonOperation', null);
// }
// });
// }
},
//
handleRouteDataMap() {
@ -473,83 +506,76 @@ export default {
}
},
//
handelReopenSignal(device) {
handleReopenSignal(device) {
const operate = {
operation: this.Signal.reopenSignal.button.operation,
userOperationType: 'leftClick',
code: device.code,
param: { signalCode: device.code }
};
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {
}).catch(() => this.$refs.noticeInfo.doShow() );
this.$store.dispatch('trainingNew/next', operate);
// const result = this.$store.dispatch('trainingNew/next', operate);
// this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {
// }).catch(() => this.$refs.noticeInfo.doShow() );
},
//
arrangementRouteOperation(deviceList) {
const operate = { userOperationType: 'leftClick', operation: this.Signal.arrangementRoute.button.operation };
if (!this.routeDataMap) { this.handleRouteDataMap(); }
if (!this.checkHaveRoute(deviceList)) { // deviceList
// this.$message.error('');
this.clearOperate();
return;
}
this.deviceTimeNode = this.$store.state.socket.simulationTimeSync;
const signal = this.$store.getters['map/getDeviceByCode'](deviceList[0].signalCode || deviceList[0].code);// deviceList[0] SignalButton || Signal
if (deviceList.length === 1 && !signal.routeLock) { //
operate.code = deviceList[0].code;
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
if (valid) {
//
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
if (!this.checkHaveRoute(deviceList)) { // deviceList
// this.$message.error('');
this.clearOperate();
return;
}
this.deviceTimeNode = this.$store.state.socket.simulationTimeSync;
const signal = this.$store.getters['map/getDeviceByCode'](deviceList[0].signalCode || deviceList[0].code);// deviceList[0] SignalButton || Signal
if (deviceList.length === 1 && !signal.routeLock) {
operate.code = deviceList[0].code;
if (deviceList[0]._type === 'SignalButton' || (deviceList[0]._type === 'Signal' && deviceList[0].type === 'SHUNTING')) {
this.$store.dispatch('training/updateMapState', [{code: deviceList[0].code, _type: deviceList[0]._type, hasSelected: 1}]);
}
}
}).catch(() => {
this.$refs.noticeInfo.doShow();
});
} else if (deviceList.length > 1) {
let key = '';
deviceList.forEach((item, index) => {
key = key + (index ? '-' : '') + item.code;
});
const route = this.routeDataMap[key];
if (route) {
operate.code = deviceList[deviceList.length - 1].code;
operate.param = {routeCode: route.code};
this.route = route;
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.deviceTimeNode = 0;
this.$store.dispatch('training/updateMapState',
[{code: this.deviceList[0].code, _type: this.deviceList[0]._type, hasSelected: 0}, {code: this.deviceList[1].code, _type: this.deviceList[1]._type, hasSelected: 1}]);
}).catch(() => {
this.deviceTimeNode = 0;
this.clearOperate();
this.$refs.noticeInfo.doShow();
});
} else if (this.menuSignal) {
key = '';
deviceList.forEach((item, index) => {
key = key + (index ? '-' : '') + (index ? item.code : this.menuSignal.code);
});
const route = this.routeDataMap[key];
if (route) {
operate.code = deviceList[deviceList.length - 1].code;
operate.param = {routeCode: route.code};
this.route = route;
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.deviceTimeNode = 0;
this.$store.dispatch('training/updateMapState',
[{code: this.deviceList[0].code, _type: this.deviceList[0]._type, hasSelected: 0}, {code: this.deviceList[1].code, _type: this.deviceList[1]._type, hasSelected: 1}]);
}).catch(() => {
this.deviceTimeNode = 0;
this.clearOperate();
this.$refs.noticeInfo.doShow();
} else if (deviceList.length > 1) {
let key = '';
deviceList.forEach((item, index) => {
key = key + (index ? '-' : '') + item.code;
});
const route = this.routeDataMap[key];
if (route) {
operate.code = deviceList[deviceList.length - 1].code;
operate.param = { routeCode: route.code };
this.route = route;
this.deviceTimeNode = 0;
const stateData = [
{code: this.deviceList[0].code, _type: this.deviceList[0]._type, hasSelected: 0},
{code: this.deviceList[1].code, _type: this.deviceList[1]._type, hasSelected: 1}
];
this.$store.dispatch('training/updateMapState', stateData);
} else if (this.menuSignal) {
key = '';
deviceList.forEach((item, index) => {
key = key + (index ? '-' : '') + (index ? item.code : this.menuSignal.code);
});
const route = this.routeDataMap[key];
if (route) {
operate.code = deviceList[deviceList.length - 1].code;
operate.param = {routeCode: route.code};
this.route = route;
this.deviceTimeNode = 0;
const stateData = [
{code: this.deviceList[0].code, _type: this.deviceList[0]._type, hasSelected: 0},
{code: this.deviceList[0].code, _type: this.deviceList[0]._type, hasSelected: 1}
];
this.$store.dispatch('training/updateMapState', stateData);
}
}
}
}
}
});
},
//
handelTotalCancel(model) {
handleTotalCancel(model) {
const operate = {
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
@ -558,10 +584,11 @@ export default {
signalCode: model._type === 'Signal' ? model.code : model.signalCode
}
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
}).catch(() => {
this.$refs.noticeInfo.doShow();
});
this.$store.dispatch('trainingNew/next', operate);
// this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
// }).catch(() => {
// this.$refs.noticeInfo.doShow();
// });
},
//
handleGuideSignal(model) {
@ -571,11 +598,16 @@ export default {
userOperationType: 'leftClick',
param: {signalCode: model.signalCode}
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.$store.dispatch('training/updateMapState', [{code: model.code, _type: model._type, hasSelected: 1}]);
}).catch(() => {
this.$refs.noticeInfo.doShow();
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('training/updateMapState', [{code: model.code, _type: model._type, hasSelected: 1}]);
}
});
// this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
// this.$store.dispatch('training/updateMapState', [{code: model.code, _type: model._type, hasSelected: 1}]);
// }).catch(() => {
// this.$refs.noticeInfo.doShow();
// });
},
//
handleTotalHumanSolution(model) {
@ -586,30 +618,32 @@ export default {
val: model.code,
param: { signalCode: model.code }
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
}).catch(() => {
this.$refs.noticeInfo.doShow();
});
this.$store.dispatch('trainingNew/next', operate);
// this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
// }).catch(() => {
// this.$refs.noticeInfo.doShow();
// });
},
handelSwitchOperate(model) {
handleSwitchOperate(model) {
const operate = {
code: model.code,
operation: this.$store.state.menuOperation.buttonOperation,
userOperationType: 'leftClick',
param: { switchCode: model.code}
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
}).catch(() => {
this.$refs.noticeInfo.doShow();
});
this.$store.dispatch('trainingNew/next', operate);
// this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
// }).catch(() => {
// this.$refs.noticeInfo.doShow();
// });
},
//
sendCommand(operate) {
this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => {
console.error(error);
this.$refs.noticeInfo.doShow();
}).finally(() =>{ this.clearOperate(); });
},
// sendCommand(operate) {
// this.$store.dispatch('training/nextNew', operate).then(({valid, response}) => {}).catch((error) => {
// console.error(error);
// this.$refs.noticeInfo.doShow();
// }).finally(() =>{ this.clearOperate(); });
// },
// ()
checkHasTrainButton(model) {
if (model.signalButtonList && model.signalButtonList.length > 0) {
@ -623,7 +657,7 @@ export default {
return false;
}
},
handelSignalBlockOrUnblock(model) {
handleSignalBlockOrUnblock(model) {
const buttonOperation = this.$store.state.menuOperation.buttonOperation;
const operate = {
over: true,
@ -649,7 +683,17 @@ export default {
operate.param = {signalCode: model.signalCode};
}
}
this.sendCommand(operate);
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('trainingNew/execute', { cmdType: result.cmdType, wholeParam: result.params }).then(resp => {
this.clearOperate();
}).catch(e => {
console.error(e);
this.$refs.noticeInfo.doShow();
this.clearOperate();
});
}
});
},
handleGuideLock(model) {
const operate = {
@ -658,13 +702,14 @@ export default {
userOperationType: 'leftClick',
param: {signalCode: model.signalCode}
};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
}).catch((e) => {
this.$refs.noticeInfo.doShow();
this.clearOperate();
});
// this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
// }).catch((e) => {
// this.$refs.noticeInfo.doShow();
// this.clearOperate();
// });
this.$store.dispatch('trainingNew/next', operate);
},
handelFaultSection(model) {
handleFaultSection(model) {
if (model._type === 'Section') {
const operate = {
over: true,
@ -673,7 +718,17 @@ export default {
cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK,
param: {sectionCode: model.code}
};
this.sendCommand(operate);
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('trainingNew/execute', { cmdType: result.cmdType, wholeParam: result.params }).then(resp => {
this.clearOperate();
}).catch(e => {
console.error(e);
this.$refs.noticeInfo.doShow();
this.clearOperate();
});
}
});
}
},
// CHANGE_DIRECTION
@ -691,17 +746,17 @@ export default {
// debugger;
if (buttonOperation && this.commandTypeList.includes(model._type)) {
if (buttonOperation === this.MixinCommand.totalCancel.button.operation) {
this.handelTotalCancel(model);
this.handleTotalCancel(model);
} else if (buttonOperation === this.Signal.humanTrainRoute.button.operation) {
this.handleTotalHumanSolution(model);
} else if (this.switchOperation.includes(buttonOperation)) {
this.handelSwitchOperate(model);
this.handleSwitchOperate(model);
} else if (buttonOperation === this.Signal.lock.button.operation || buttonOperation === this.Signal.unlock.button.operation) {
this.handelSignalBlockOrUnblock(model);
this.handleSignalBlockOrUnblock(model);
} else if (buttonOperation === this.Section.fault.button.operation) {
this.handelFaultSection(model);
this.handleFaultSection(model);
} else if (buttonOperation === this.Signal.reopenSignal.button.operation) {
this.handelReopenSignal(model);
this.handleReopenSignal(model);
} else if (buttonOperation === this.Signal.arrangementRoute.button.operation) {
this.deviceList.push(model);
this.arrangementRouteOperation(this.deviceList);
@ -763,12 +818,16 @@ export default {
},
routeCommit(trainCode, duration) {
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.CTC.CTC_SET_ROUTE, param:{ tripNumber: trainCode || '', duration: duration >= 0 ? duration : null, force: false }};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.clearOperate();
}).catch((e) => {
console.log(e, 'error');
this.$refs.noticeInfo.doShow();
this.clearOperate();
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('trainingNew/execute', { cmdType: result.cmdType, wholeParam: result.params }).then(resp => {
this.clearOperate();
}).catch(e => {
console.error(e);
this.$refs.noticeInfo.doShow();
this.clearOperate();
});
}
});
},
commandOrders() {
@ -780,44 +839,40 @@ export default {
} else {
this.routeCommit();
}
} else if (this.operation === OperationEvent.MixinCommand.totalCancel.button.operation) {
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.clearOperate();
}).catch((e) => {
this.$refs.noticeInfo.doShow();
this.clearOperate();
} else {
const operate = {};
if (this.operation === OperationEvent.MixinCommand.totalCancel.button.operation) {
operate.userOperationType = 'leftClick';
operate.over = true;
operate.cmdType = CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE;
} else if (this.operation === OperationEvent.Signal.reopenSignal.button.operation) {
operate.userOperationType = 'leftClick';
operate.over = true;
operate.cmdType = CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL;
} else if (this.operation === OperationEvent.Signal.guide.button.operation) {
operate.userOperationType = 'leftClick';
operate.over = true;
operate.cmdType = CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE;
} else if (this.operation === OperationEvent.Signal.humanTrainRoute.button.operation) {
operate.userOperationType = 'leftClick';
operate.over = true;
operate.cmdType = CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE;
} else if (this.switchOperation.includes(this.operation)) {
operate.userOperationType = 'leftClick';
operate.over = true;
operate.cmdType = this.cmdType;
}
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('trainingNew/execute', { cmdType: result.cmdType, wholeParam: result.param }).then(resp => {
this.clearOperate();
}).catch(e => {
console.error(e);
this.$refs.noticeInfo.doShow();
this.clearOperate();
});
}
});
} else if (this.operation === OperationEvent.Signal.reopenSignal.button.operation) {
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.clearOperate();
}).catch(() => {
this.$refs.noticeInfo.doShow();
this.clearOperate();
});
} else if (this.operation === OperationEvent.Signal.guide.button.operation) {
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
this.$store.dispatch('training/updateMapState', [{code: this.selected.code, _type: this.selected._type, hasSelected: 0}]);
this.clearOperate();
}).catch(() => {
this.$store.dispatch('training/updateMapState', [{code: this.selected.code, _type: this.selected._type, hasSelected: 0}]);
this.$refs.noticeInfo.doShow();
this.clearOperate();
});
} else if (this.operation === OperationEvent.Signal.humanTrainRoute.button.operation) {
const operate = {userOperationType: 'leftClick', over: true, cmdType: CMD.Signal.CMD_SIGNAL_HUMAN_RELEASE_ROUTE};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
}).catch((e) => {
this.$refs.noticeInfo.doShow();
}).finally(() => { this.clearOperate(); });
} else if (this.switchOperation.includes(this.operation)) {
const operate = {userOperationType: 'leftClick', over:true, cmdType: this.cmdType};
this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
}).catch(() => {
this.$refs.noticeInfo.doShow();
}).finally(() => { this.clearOperate(); });
}
},
commandClear() {
@ -905,17 +960,16 @@ export default {
param: noPasswordModelTypeMap[model.type].param,
cmdType : noPasswordModelTypeMap[model.type].nextCmdType
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.clearOperate();
} else {
this.$refs.noticeInfo.doShow();
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
this.$store.dispatch('trainingNew/execute', { cmdType: result.cmdType, wholeParam: result.params }).then(resp => {
this.clearOperate();
}).catch(e => {
console.error(e);
this.$refs.noticeInfo.doShow();
});
}
}).catch((error) => {
console.error(error);
this.$refs.noticeInfo.doShow();
});
} else {
const operate = {
operation: modelTypeMap[model.type].operation,
@ -923,34 +977,14 @@ export default {
code: model.code,
param: modelTypeMap[model.type].param
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('trainingNew/next', operate).then(result => {
if (result.valid) {
operate.nextCmdType = modelTypeMap[model.type].nextCmdType;
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
}).catch((error) => {
console.error(error);
this.$refs.noticeInfo.doShow();
});
}
// const operate = {
// over: true,
// code: model.code,
// operation: this.CTCCommand.assistPressDownTurnDirection.menu.operation,
// cmdType: CMD.CTC.CTC_ASSIST_PRESS_DOWN_TURN_DIRECTION,
// param: {
// labelEnum:model.labelEnum,
// stationCode:model.stationCode
// }
// };
// this.$store.dispatch('training/nextNew', operate).then(({ valid, response }) => {
// // this.clearOperate();
// }).catch((error) => {
// // this.clearOperate();
// console.error(error);
// this.$refs.noticeInfo.doShow();
// });
}
}
};

View File

@ -36,39 +36,15 @@ class Handler {
}
handle(operation) {
// return new Promise((resolve, reject) => {
// this.storeOperation(operation);
// const rtn = { valid: false, response: null };
// rtn.valid = ValidateHandler.validate(this.getTrainingMode(), operation);
// if (!rtn.valid ) {
// this.pop();
// reject();
// } else {
// if (operation.cancel === true) {
// this.clear();
// } else {
// if (operation.cmdType.value) {
// rtn.cmdType = operation.cmdType.value;
// rtn.params = this.getWholeParam();
// }
// }
// resolve(rtn);
// }
// });
this.storeOperation(operation);
const result = { valid: false };
result.valid = ValidateHandler.validate(this.getTrainingMode(), operation);
if (!result.valid) {
let valid = false;
valid = ValidateHandler.validate(this.getTrainingMode(), operation);
if (!valid) {
this.pop();
} else {
if (operation.cancel === true) {
this.clear();
} else if (operation.cmdType.value) {
result.cmdType = operation.cmdType.value;
result.params = this.getWholeParam();
}
} else if (operation.cancel === true) {
this.clear();
}
return result;
return valid;
}
execute(cmdType, wholeParam) {
const group = router.currentRoute.query.group;
@ -78,7 +54,6 @@ class Handler {
}).catch(error => {
reject(error);
});
});
}

View File

@ -150,6 +150,7 @@ const training = {
store.dispatch('training/setOperate', operate);
if (state.trainingDetail && !state.trainingSwitch) {
commit('setOperateErrMsg', { errMsg: LangStorage.getLang() === 'en' ? 'Please click start, start training!' : '请点击开始,开始实训!', color: 'red' });
return {valid: false};
} else {
const result = NewHandler.handle(operate);
if (state.trainingSwitch && state.trainingDetail.type === 'SINGLE' && (state.teachMode === ScriptMode.TEACH || state.teachMode === ScriptMode.PRACTICE)) {
@ -160,6 +161,15 @@ const training = {
}
return result;
}
},
execute: ({ commit, state }, { cmdType, wholeParam }) => {
return new Promise((resolve, reject) => {
NewHandler.execute(cmdType, wholeParam).then(resp => {
resolve(resp);
}).catch(e=> {
reject(e);
});
});
}
}
};

View File

@ -57,7 +57,6 @@ export default {
this.$jlmap.setMap(this.mapData, this.mapDevice, logicData, repaint);
if (this.mapData && this.mapData.pictureList) {
const picture = this.mapData.pictureList.find(picture => picture.type === 'dispatchWork');
console.log(picture, this.mapData.pictureList, '-----------');
if (picture) {
this.handlerPictureShow(picture);
} else {

View File

@ -76,7 +76,11 @@ export default {
// this.$jlmap.updateShowMode(list, '02');
// }
if (this.mapData && this.mapData.pictureList) {
const type = this.datie ? 'chainStation' : 'localWork';
let type = this.datie ? 'chainStation' : 'localWork';
const station = this.mapDevice[this.roleDeviceCode];
if (station && station.depot) {
type = 'chainStation';
}
const picture = this.mapData.pictureList.find(picture => picture.stationCodes.includes(this.roleDeviceCode) && picture.type === type);
if (picture) {
this.handlerPictureShow(picture);

View File

@ -1,393 +0,0 @@
<template>
<div v-loading="loading" class="view-control-content">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-card shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header">
<span>请选择行调显示设备</span>
</div>
<div style="padding: 10px;font-size: 14px;">
<div class="content-box-list" style="margin-top: 10px;">
<div class="title-box">设备列表</div>
<div class="list-box" style="height:400px;overflow:auto">
<div v-for="nor in addModel.elementList" :key="nor.code" class="list-content">
<div class="name">{{ getDeviceName(nor) }}</div>
<div class="close" @click="delList(nor, addModel.elementList)"><i class="el-icon-close" /></div>
</div>
</div>
</div>
</div>
<div style="padding: 10px;font-size: 14px;">
<div class="content-box-list" style="margin-top: 10px">
<div style="height: 30px;line-height: 30px;margin-bottom: 10px;">
<span class="title-box">修正设备列表</span>
<el-button icon="el-icon-plus" size="mini" style="float:right;" circle @click="addAmendPoints" />
</div>
<template v-for="(elem, i) in amendPointsList">
<el-card :key="i" class="box-card">
<el-row>
<el-button icon="el-icon-minus" size="mini" style="float:right;" circle @click="delAmendPoints(i)" />
</el-row>
<el-row style="height: 28px;line-height: 28px">
<el-col :span="5">
<span>修正设备</span>
</el-col>
<el-col :span="19">
<el-select v-model="elem.code" filterable size="mini" placeholder="请选择">
<el-option
v-for="item in [...sectionList, ...signalList, ...trainWindowList]"
:key="item.code"
:label="item.name?item.name:'' + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
<el-button :type="hoverIndex === i?'danger':'primary'" size="mini" @click="hoverClick(i)">激活</el-button>
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'points')" style="margin-top: 10px;">
<el-col :span="5" style="height: 28px;line-height: 28px">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<template v-for="(point, j) in elem.points">
<div :key="j">
<el-input-number v-model="point.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="point.y" style="width: 100px" size="mini" controls-position="right" />
<el-button icon="el-icon-plus" size="mini" circle @click="addPoint(j, elem.points)" />
<el-button icon="el-icon-minus" size="mini" circle :disabled="elem.points.length < 3" @click="delPoint(j, elem.points)" />
</div>
</template>
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'position')" style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<el-input-number v-model="elem.position.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="elem.position.y" style="width: 100px" size="mini" controls-position="right" />
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'rotate')" style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>旋转角度</span>
</el-col>
<el-col :span="19">
<el-input-number v-model="elem.rotate" style="width: 100px" size="mini" :min="-360" :max="360" controls-position="right" />
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'reversal')" style="margin-top: 10px;height: 28px;line-height: 28px;">
<el-col :span="5">
<span>车头翻转</span>
</el-col>
<el-col :span="19">
<el-checkbox v-model="elem.reversal" />
</el-col>
</el-row>
</el-card>
</template>
</div>
</div>
</el-card>
<div style="display: table; margin-left: 120px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" :loading="dataLoading" @click="generateData">自动生成</el-button>
<el-button type="primary" size="small" :loading="dataLoading" @click="save">保存</el-button>
<el-button type="primary" size="small" :loading="dataLoading" @click="clear">清除</el-button>
<el-button type="primary" size="small" @click="back">返回</el-button>
</div>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { saveMap } from '@/api/jmap/mapdraft';
export default {
components: {
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
}
},
data() {
return {
otherData: [],
addModel: {
type: 'CENTER',
elementList: []
},
amendPointsList: [],
loading: false,
dataLoading:false,
hoverIndex: -1
};
},
computed: {
...mapGetters('map', [
'sectionList',
'stationList',
'signalList',
'switchList',
'stationStandList',
'automaticRouteButtonList',
'axleCounterResetButtonList',
'cycleButtonList',
'directionRodList',
'indicatorLightList',
'lineList',
'outerFrameList',
'psdList',
'responderList',
'tbStrategyList',
'tempSpeedLimitList',
'textList',
'totalGuideLockButtonVOList',
'seclectDeviceList',
'trainWindowList',
'signalButtonList'
])
},
watch: {
selected: function (val, oldVal) {
this.deviceSelect(val);
}
},
mounted() {
this.initData();
},
methods: {
initData() {
(this.$store.state.map.map.displayList || []).forEach(item => {
if (item.type === 'CENTER') {
this.addModel = item;
this.amendPointsList = this.addModel.amendPointsList ? this.addModel.amendPointsList : [];
} else {
this.otherData.push(item);
}
});
},
deviceSelect(selected) {
if (selected && selected._type.toUpperCase() == 'CheckBox'.toUpperCase()) {
this.seclectDeviceList.forEach(item => {
if (this.addModel.elementList.indexOf(item.code) < 0) {
this.addModel.elementList.push(item.code);
}
});
} else if (selected && this.hoverIndex > -1 && (['Section'.toUpperCase(), 'Signal'.toUpperCase(), 'TrainWindow'.toUpperCase()].includes(selected._type.toUpperCase()))) {
this.amendPointsList[this.hoverIndex].code = selected.code;
} else if (selected) {
if (this.addModel.elementList.indexOf(selected.code) < 0) {
this.addModel.elementList.push(selected.code);
}
}
},
hoverClick(index) {
this.hoverIndex = this.hoverIndex === index ? -1 : index;
},
checkDeviceType(data, prop) {
if (data.code) {
const device = this.$store.getters['map/getDeviceByCode'](data.code);
if (device._type === 'Section' && prop === 'points') {
return true;
} else if (device._type === 'Signal' && (prop === 'position' || prop === 'rotate')) {
return true;
} else if (device._type === 'TrainWindow' && (prop === 'position' || prop === 'reversal')) {
return true;
}
}
return false;
},
getDeviceName(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name || device.code;
},
//
delList(model, list) {
list.forEach((nor, index) => {
if (nor == model) {
list.splice(index, 1);
}
});
this.seclectDeviceList.forEach((item, index) => {
if (item.code == model) {
this.seclectDeviceList.splice(index, 1);
}
});
},
clear() {
this.addModel = {
type: 'CENTER',
elementList: []
};
const map = this.$store.state.map.map;
const param = {
displayList: [...this.otherData],
mapId: this.$route.params.mapId
};
this.dataLoading = true;
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存行调配置成功');
this.dataLoading = false;
}).catch(() => {
this.dataLoading = false;
this.$messageBox('保存行调配置失败');
});
},
addAmendPoints() {
this.amendPointsList.push({ code: '', points: [{ x: 0, y: 0 }, { x:0, y:0 }], position: {x: 0, y: 0}, rotate:0, reversal: false });
},
delAmendPoints(index) {
this.hoverIndex = -1;
this.amendPointsList.splice(index, 1);
},
save() {
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正设备未选择!');
return;
}
const map = this.$store.state.map.map;
this.addModel.amendPointsList = this.amendPointsList;
const param = {
displayList: [...this.otherData, this.addModel],
mapId: this.$route.params.mapId
};
this.dataLoading = true;
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存行调配置成功');
this.dataLoading = false;
}).catch(() => {
this.dataLoading = false;
this.$messageBox('保存行调配置失败');
});
},
back() {
this.$emit('goDraw');
},
generateData() {
this.loading = true;
this.addModel = {
type: 'CENTER',
elementList: []
};
const stationCodes = [];
this.stationList.forEach(item => {
if (item.depot) {
stationCodes.push(item.code);
}
});
[...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList,
...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.indicatorLightList, ...this.lineList, ...this.outerFrameList,
...this.responderList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList, ...this.signalButtonList].forEach(item => {
if (!stationCodes.includes(item.stationCode)) {
this.addModel.elementList.push(item.code);
}
});
[...this.directionRodList].forEach(item => {
if (!stationCodes.includes(item.deviceStationCode)) {
this.addModel.elementList.push(item.code);
}
});
this.stationList.forEach(item => {
if (!stationCodes.includes(item.code)) {
this.addModel.elementList.push(item.code);
}
});
this.psdList.forEach(item => {
const stand = this.$store.getters['map/getDeviceByCode'](item.standCode);
if (!stationCodes.includes(stand.stationCode)) {
this.addModel.elementList.push(item.code);
}
});
const map = this.$store.state.map.map;
const param = {
displayList: [...this.otherData, this.addModel],
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.loading = false;
this.$message.success('保存行调配置成功');
}).catch(() => {
this.loading = false;
this.$messageBox('保存行调配置失败');
});
},
addPoint(index, points) {
points.splice(index, 0, {x:0, y:0});
},
delPoint(index, points) {
points.splice(index, 1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.title-box{
padding-left: 10px;
border-left: 4px solid red;
margin-bottom: 10px;
}
.box-card {
width: 100%;
padding: 5px;
}
.coordinate {
overflow: hidden;
.title {
text-align: right;
font-size: 14px;
color: #606266;
-webkit-box-sizing: border-box;
box-sizing: border-box;
line-height: 28px;
width: 120px;
font-weight: bold;
display: block;
float: left;
margin-right: 7px;
}
.listWidth{
display: table;
float: left;
margin-right: 20px;
&:last-child{
margin: 0;
}
}
}
.list-box{
overflow: hidden;
.list-content{
float: left;
background: #e2e2e2;
margin: 5px;
border-radius: 5px;
height: 30px;
line-height: 30px;
padding-left: 10px;
padding-right: 3px;
cursor: pointer;
&:hover{
background: #ccc;
}
.name{
float: left;
margin-right: 20px;
}
.close{
float: left;
width: 23px;
cursor: pointer;
}
}
}
</style>

View File

@ -1,479 +0,0 @@
<template>
<div v-loading="loading" class="view-control-content">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-table :data="tableData" style="width: 80%; margin: 0 auto;">
<el-table-column label="车站">
<template slot-scope="scope">
<template v-for="stationCode in scope.row.stationCodeList">
<span :key="stationCode" style="margin-left: 10px">{{ getDeviceName(stationCode) }}</span>
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="scope">
<el-button type="text" size="small" @click.native.prevent="editModel(tableData, scope.$index)">
编辑
</el-button>
<el-button type="text" size="small" @click.native.prevent="deleteModel(tableData, scope.$index)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-card shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header" class="clearfix">
<span style="font-size: 12px;">{{ cardTitle }}</span>
<el-button style="float: right; padding: 3px 3px" type="text" @click="clear">清空</el-button>
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
</el-button-group>
</div>
<div style="padding: 10px;font-size: 14px;">
<div>
<span>车站</span>
<el-select v-model="addModel.stationCodeList" size="mini" style="width: 300px;" multiple placeholder="请选择">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div class="content-box-list" style="margin-top: 10px;">
<div class="title-box">设备列表</div>
<div class="list-box" style="height:400px;overflow:auto">
<div v-for="nor in addModel.elementList" :key="nor.code" class="list-content">
<div class="name">{{ getDeviceName(nor) }}</div>
<div class="close" @click="delList(nor, addModel.elementList)"><i class="el-icon-close" /></div>
</div>
</div>
</div>
</div>
<div style="padding: 10px;font-size: 14px;">
<div class="content-box-list" style="margin-top: 10px">
<div style="height: 30px;line-height: 30px;margin-bottom: 10px;">
<span class="title-box">修正设备列表</span>
<el-button icon="el-icon-plus" size="mini" style="float:right;" circle @click="addAmendPoints" />
</div>
<template v-for="(elem, i) in amendPointsList">
<el-card :key="i" class="box-card">
<el-row>
<el-button icon="el-icon-minus" size="mini" style="float:right;" circle @click="delAmendPoints(i)" />
</el-row>
<el-row style="height: 28px;line-height: 28px">
<el-col :span="5">
<span>修正设备</span>
</el-col>
<el-col :span="19">
<el-select v-model="elem.code" filterable size="mini" placeholder="请选择">
<el-option
v-for="item in [...sectionList, ...signalList, ...trainWindowList]"
:key="item.code"
:label="item.name?item.name:'' + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
<el-button :type="hoverIndex === i?'danger':'primary'" size="mini" @click="hoverClick(i)">激活</el-button>
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'points')" style="margin-top: 10px;">
<el-col :span="5" style="height: 28px;line-height: 28px">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<template v-for="(point, j) in elem.points">
<div :key="j">
<el-input-number v-model="point.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="point.y" style="width: 100px" size="mini" controls-position="right" />
<el-button icon="el-icon-plus" size="mini" circle @click="addPoint(j, elem.points)" />
<el-button icon="el-icon-minus" size="mini" circle :disabled="elem.points.length < 3" @click="delPoint(j, elem.points)" />
</div>
</template>
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'position')" style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<el-input-number v-model="elem.position.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="elem.position.y" style="width: 100px" size="mini" controls-position="right" />
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'rotate')" style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>旋转角度</span>
</el-col>
<el-col :span="19">
<el-input-number v-model="elem.rotate" style="width: 100px" size="mini" :min="-360" :max="360" controls-position="right" />
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'reversal')" style="margin-top: 10px;height: 28px;line-height: 28px;">
<el-col :span="5">
<span>车头翻转</span>
</el-col>
<el-col :span="19">
<el-checkbox v-model="elem.reversal" />
</el-col>
</el-row>
</el-card>
</template>
</div>
</div>
<div style="padding: 10px;font-size: 14px;">
<div class="content-box-list" style="margin-top: 10px">
<div style="height: 30px;line-height: 30px;margin-bottom: 10px;">
<span class="title-box">偏移缩放</span>
<el-button size="mini" style="float:right;" @click="generateOffsetScale">定位</el-button>
</div>
</div>
<div>
<el-row style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<el-input-number v-model="addModel.offsetX" style="width: 120px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="addModel.offsetY" style="width: 120px" size="mini" controls-position="right" />
</el-col>
</el-row>
<el-row style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>缩放</span>
</el-col>
<el-col :span="19">
<el-input-number v-model="addModel.scaleRate" style="width: 100px" size="mini" :min="-360" :max="360" controls-position="right" />
</el-col>
</el-row>
</div>
</div>
</el-card>
<div style="display: table; margin-left: 150px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" @click="generateData">生成</el-button>
<el-button type="primary" size="small" :loading="dataLoading" @click="save">保存</el-button>
<el-button type="primary" size="small" @click="back">返回</el-button>
</div>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { saveMap } from '@/api/jmap/mapdraft';
export default {
components: {
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
}
},
data() {
return {
tableData: [],
otherData: [],
addModel: {
type: 'LOCAL',
stationCodeList: [],
elementList: [],
offsetX: 0,
offsetY: 0,
scaleRate: 1
},
amendPointsList: [],
list: [],
field: '',
cardMode: 'generate',
index: '',
isPreview: true,
loading: false,
dataLoading:false,
depotStationList: [],
hoverIndex: -1
};
},
computed: {
...mapGetters('map', [
'sectionList',
'stationList',
'signalList',
'switchList',
'stationStandList',
'automaticRouteButtonList',
'axleCounterResetButtonList',
'cycleButtonList',
'directionRodList',
'indicatorLightList',
'lineList',
'outerFrameList',
'psdList',
'responderList',
'tbStrategyList',
'tempSpeedLimitList',
'textList',
'totalGuideLockButtonVOList',
'seclectDeviceList',
'trainWindowList',
'signalButtonList'
]),
cardTitle() {
if (this.cardMode === 'generate') {
return '生成数据';
} else if (this.cardMode === 'edit') {
return '编辑数据';
} else {
return '';
}
}
},
watch: {
selected: function (val, oldVal) {
this.deviceSelect(val);
}
},
mounted() {
this.initData();
},
methods: {
initData() {
this.depotStationList = this.stationList.filter(elem => elem.depot);
(this.$store.state.map.map.displayList || []).forEach( item => {
if (item.type === 'DEPOT_IL') {
this.tableData.push(item);
} else {
this.otherData.push(item);
}
});
},
generateOffsetScale() {
this.addModel.offsetX = this.$store.state.map.dataZoom.offsetX || 0;
this.addModel.offsetY = this.$store.state.map.dataZoom.offsetY || 0;
this.addModel.scaleRate = this.$store.state.map.dataZoom.scaleRate || 1;
},
deviceSelect(selected) {
if (selected && selected._type.toUpperCase() == 'CheckBox'.toUpperCase()) {
this.seclectDeviceList.forEach(item => {
if (this.addModel.elementList.indexOf(item.code) < 0) {
this.addModel.elementList.push(item.code);
}
});
} else if (selected && this.hoverIndex > -1 && (['Section'.toUpperCase(), 'Signal'.toUpperCase(), 'TrainWindow'.toUpperCase()].includes(selected._type.toUpperCase()))) {
this.amendPointsList[this.hoverIndex].code = selected.code;
} else if (selected) {
if (this.addModel.elementList.indexOf(selected.code) < 0) {
this.addModel.elementList.push(selected.code);
}
}
},
getDeviceName(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name || device.code;
},
hoverClick(index) {
this.hoverIndex = this.hoverIndex === index ? -1 : index;
},
checkDeviceType(data, prop) {
if (data.code) {
const device = this.$store.getters['map/getDeviceByCode'](data.code);
if (device._type === 'Section' && prop === 'points') {
return true;
} else if (device._type === 'Signal' && (prop === 'position' || prop === 'rotate')) {
return true;
} else if (device._type === 'TrainWindow' && (prop === 'position' || prop === 'reversal')) {
return true;
}
}
return false;
},
deleteModel(list, index) {
list.splice(index, 1);
this.list.pop();
this.clearData();
this.cardMode = 'generate';
},
editModel(list, index) {
this.addModel = list[index];
this.amendPointsList = this.addModel.amendPointsList ? this.addModel.amendPointsList : [];
this.index = index;
this.cardMode = 'edit';
},
cancelOverlab() {
this.cardMode = 'generate';
this.clear();
},
updateOverlab() {
if (this.index || this.index == 0) {
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
return;
}
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正设备未选择!');
return;
}
this.addModel.amendPointsList = [...this.amendPointsList];
this.amendPointsList = [];
this.tableData.splice(this.index, 1, this.addModel);
this.clearData();
}
},
//
delList(model, list) {
list.forEach((nor, index) => {
if (nor == model) {
list.splice(index, 1);
}
});
this.seclectDeviceList.forEach((item, index) => {
if (item.code == model) {
this.seclectDeviceList.splice(index, 1);
}
});
},
save() {
const map = this.$store.state.map.map;
const param = {
displayList: [...this.tableData, ...this.otherData],
mapId: this.$route.params.mapId
};
this.dataLoading = true;
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存车辆段配置成功');
this.dataLoading = false;
this.cancelOverlab();
}).catch(() => {
this.dataLoading = false;
this.$messageBox('保存车辆段配置失败');
});
},
back() {
this.$emit('goDraw');
},
generateOverlab() { //
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
return;
}
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正区段未选择!');
return;
}
this.addModel.amendPointsList = [...this.amendPointsList];
this.amendPointsList = [];
this.hoverIndex = -1;
this.tableData.push(this.addModel);
this.clearData();
},
clear() {
this.addModel = { type: 'DEPOT_IL', stationCodeList: [], elementList: [], offsetX: 0, offsetY: 0, scaleRate: 1 };
this.amendPointsList = [];
},
clearData() {
this.addModel = { type: 'DEPOT_IL', stationCodeList: [], elementList: [], offsetX: 0, offsetY: 0, scaleRate: 1 };
this.amendPointsList = [];
this.index = '';
this.cardMode = 'generate';
},
addAmendPoints() {
this.amendPointsList.push({ code: '', points: [{ x: 0, y: 0 }, { x:0, y:0 }], position: {x: 0, y: 0}, rotate:0, reversal: false });
},
delAmendPoints(index) {
this.hoverIndex = -1;
this.amendPointsList.splice(index, 1);
},
addPoint(index, points) {
points.splice(index, 0, {x:0, y:0});
},
delPoint(index, points) {
points.splice(index, 1);
},
generateData() {
this.loading = true;
this.tableData = [];
this.stationList.forEach(item => {
if (item.depot) {
this.tableData.push({type: 'DEPOT_IL', stationCodeList: [item.code], elementList: [item.code], offsetX: 0, offsetY: 0, scaleRate: 1 });
}
});
[...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList,
...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.indicatorLightList, ...this.lineList, ...this.outerFrameList,
...this.responderList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList, ...this.signalButtonList].forEach(item => {
const target = this.tableData.find(elem => elem.stationCodeList.includes(item.stationCode));
target && target.elementList.push(item.code);
});
[...this.directionRodList].forEach(item => {
const target = this.tableData.find(elem => elem.stationCodeList.includes(item.deviceStationCode));
target && target.elementList.push(item.code);
});
this.psdList.forEach(item => {
const stand = this.$store.getters['map/getDeviceByCode'](item.standCode);
const target = this.tableData.find(elem => elem.stationCodeList.includes(stand.stationCode));
target && target.elementList.push(item.code);
});
const map = this.$store.state.map.map;
const param = {
displayList: [...this.tableData, ...this.otherData],
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.loading = false;
this.$message.success('保存车辆段配置成功');
this.cancelOverlab();
}).catch(() => {
this.loading = false;
this.$messageBox('保存车辆段配置失败');
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.title-box{
padding-left: 10px;
border-left: 4px solid red;
margin-bottom: 10px;
}
.box-card {
width: 100%;
padding: 5px;
}
.list-box{
overflow: hidden;
.list-content{
float: left;
background: #e2e2e2;
margin: 5px;
border-radius: 5px;
height: 30px;
line-height: 30px;
padding-left: 10px;
padding-right: 3px;
cursor: pointer;
&:hover{
background: #ccc;
}
.name{
float: left;
margin-right: 20px;
}
.close{
float: left;
width: 23px;
cursor: pointer;
}
}
}
</style>

View File

@ -1,518 +0,0 @@
<template>
<div v-loading="loading" class="view-control-content">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-table :data="tableData" style="width: 80%; margin: 0 auto;">
<el-table-column label="车站">
<template slot-scope="scope">
<template v-for="stationCode in scope.row.stationCodeList">
<span :key="stationCode" style="margin-left: 10px">{{ getDeviceName(stationCode) }}</span>
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="scope">
<el-button type="text" size="small" @click.native.prevent="editModel(tableData, scope.$index)">
编辑
</el-button>
<el-button type="text" size="small" @click.native.prevent="deleteModel(tableData, scope.$index)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-card shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header" class="clearfix">
<span style="font-size: 12px;">{{ cardTitle }}</span>
<el-button style="float: right; padding: 3px 3px" type="text" @click="clear">清空</el-button>
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
</el-button-group>
</div>
<div style="padding: 10px;font-size: 14px;">
<div>
<span>车站</span>
<el-select v-model="addModel.stationCodeList" size="mini" style="width: 300px;" multiple placeholder="请选择">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div style="margin-top:10px">
<span>可切换显示的车站</span>
<el-select v-model="addModel.switchStationCodeList" size="mini" style="width:200px;" multiple placeholder="请选择">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div class="content-box-list" style="margin-top: 10px;">
<div class="title-box">设备列表</div>
<div class="list-box" style="height:400px;overflow:auto">
<div v-for="nor in addModel.elementList" :key="nor.code" class="list-content">
<div class="name">{{ getDeviceName(nor) }}</div>
<div class="close" @click="delList(nor, addModel.elementList)"><i class="el-icon-close" /></div>
</div>
</div>
</div>
</div>
<div style="padding: 10px;font-size: 14px;">
<div class="content-box-list" style="margin-top: 10px">
<div style="height: 30px;line-height: 30px;margin-bottom: 10px;">
<span class="title-box">修正设备列表</span>
<el-button icon="el-icon-plus" size="mini" style="float:right;" circle @click="addAmendPoints" />
</div>
<template v-for="(elem, i) in amendPointsList">
<el-card :key="i" class="box-card">
<el-row>
<el-button icon="el-icon-minus" size="mini" style="float:right;" circle @click="delAmendPoints(i)" />
</el-row>
<el-row style="height: 28px;line-height: 28px">
<el-col :span="5">
<span>修正设备</span>
</el-col>
<el-col :span="19">
<el-select v-model="elem.code" filterable size="mini" placeholder="请选择">
<el-option
v-for="item in [...sectionList, ...signalList, ...trainWindowList]"
:key="item.code"
:label="item.name?item.name:'' + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
<el-button :type="hoverIndex === i?'danger':'primary'" size="mini" @click="hoverClick(i)">激活</el-button>
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'points')" style="margin-top: 10px;">
<el-col :span="5" style="height: 28px;line-height: 28px;">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<template v-for="(point, j) in elem.points">
<div :key="j">
<el-input-number v-model="point.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="point.y" style="width: 100px" size="mini" controls-position="right" />
<el-button icon="el-icon-plus" size="mini" circle @click="addPoint(j, elem.points)" />
<el-button icon="el-icon-minus" size="mini" circle :disabled="elem.points.length < 3" @click="delPoint(j, elem.points)" />
</div>
</template>
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'position')" style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<el-input-number v-model="elem.position.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="elem.position.y" style="width: 100px" size="mini" controls-position="right" />
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'rotate')" style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>旋转角度</span>
</el-col>
<el-col :span="19">
<el-input-number v-model="elem.rotate" style="width: 100px" size="mini" :min="-360" :max="360" controls-position="right" />
</el-col>
</el-row>
<el-row v-if="checkDeviceType(elem, 'reversal')" style="margin-top: 10px;height: 28px;line-height: 28px;">
<el-col :span="5">
<span>车头翻转</span>
</el-col>
<el-col :span="19">
<el-checkbox v-model="elem.reversal" />
</el-col>
</el-row>
</el-card>
</template>
</div>
</div>
</el-card>
<div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" @click="generateData">按集中站生成</el-button>
<el-button type="primary" size="small" @click="generateAllData">全显生成</el-button>
<el-button type="primary" size="small" :loading="dataLoading" @click="save">保存</el-button>
<el-button type="primary" size="small" @click="back">返回</el-button>
</div>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { saveMap } from '@/api/jmap/mapdraft';
export default {
components: {
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
}
},
data() {
return {
tableData: [],
otherData: [],
addModel: {
type: 'LOCAL',
stationCodeList: [],
switchStationCodeList:[],
elementList: []
},
amendPointsList: [],
list: [],
field: '',
cardMode: 'generate',
index: '',
isPreview: true,
loading: false,
dataLoading:false,
hoverIndex: -1
};
},
computed: {
...mapGetters('map', [
'sectionList',
'stationList',
'signalList',
'switchList',
'stationStandList',
'automaticRouteButtonList',
'axleCounterResetButtonList',
'cycleButtonList',
'directionRodList',
'indicatorLightList',
'lineList',
'outerFrameList',
'psdList',
'responderList',
'tbStrategyList',
'tempSpeedLimitList',
'textList',
'totalGuideLockButtonVOList',
'seclectDeviceList',
'trainWindowList',
'signalButtonList'
]),
cardTitle() {
if (this.cardMode === 'generate') {
return '生成数据';
} else if (this.cardMode === 'edit') {
return '编辑数据';
} else {
return '';
}
}
},
watch: {
selected: function (val, oldVal) {
this.deviceSelect(val);
}
},
mounted() {
this.initData();
},
methods: {
// deviceSelect(selected) {
// this.$refs.form && this.$refs.form.resetFields();
// this.$refs.make && this.$refs.make.resetFields();
// if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSection'.toUpperCase()) {
// if (selected.type === '01' || selected.type === '02' || selected.type === '03') {
// this.addModel.sectionCode = selected.code;
// this.field = '';
// }
// }
// },
initData() {
(this.$store.state.map.map.displayList || []).forEach( item => {
if (item.type === 'LOCAL') {
this.tableData.push(item);
} else {
this.otherData.push(item);
}
});
},
deviceSelect(selected) {
if (selected && selected._type.toUpperCase() == 'CheckBox'.toUpperCase()) {
this.seclectDeviceList.forEach(item => {
if (this.addModel.elementList.indexOf(item.code) < 0) {
this.addModel.elementList.push(item.code);
}
});
} else if (selected && this.hoverIndex > -1 && (['Section'.toUpperCase(), 'Signal'.toUpperCase(), 'TrainWindow'.toUpperCase()].includes(selected._type.toUpperCase()))) {
this.amendPointsList[this.hoverIndex].code = selected.code;
} else if (selected) {
if (this.addModel.elementList.indexOf(selected.code) < 0) {
this.addModel.elementList.push(selected.code);
}
}
},
hoverClick(index) {
this.hoverIndex = this.hoverIndex === index ? -1 : index;
},
getDeviceName(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name || device.code;
},
checkDeviceType(data, prop) {
if (data.code) {
const device = this.$store.getters['map/getDeviceByCode'](data.code);
if (device._type === 'Section' && prop === 'points') {
return true;
} else if (device._type === 'Signal' && (prop === 'position' || prop === 'rotate')) {
return true;
} else if (device._type === 'TrainWindow' && (prop === 'position' || prop === 'reversal')) {
return true;
}
}
return false;
},
deleteModel(list, index) {
list.splice(index, 1);
this.list.pop();
this.clearData();
this.cardMode = 'generate';
},
editModel(list, index) {
this.addModel = list[index];
this.amendPointsList = this.addModel.amendPointsList ? this.addModel.amendPointsList : [];
this.index = index;
this.cardMode = 'edit';
},
cancelOverlab() {
this.cardMode = 'generate';
this.clear();
},
updateOverlab() {
if (this.index || this.index == 0) {
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
return;
}
if (!this.addModel.switchStationCodeList.length) {
this.$messageBox('请选择可切换显示的车站!');
return;
}
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正设备未选择!');
return;
}
this.addModel.amendPointsList = [...this.amendPointsList];
this.amendPointsList = [];
this.tableData.splice(this.index, 1, this.addModel);
this.clearData();
}
},
//
delList(model, list) {
list.forEach((nor, index) => {
if (nor == model) {
list.splice(index, 1);
}
});
this.seclectDeviceList.forEach((item, index) => {
if (item.code == model) {
this.seclectDeviceList.splice(index, 1);
}
});
},
save() {
const map = this.$store.state.map.map;
const param = {
displayList: [...this.tableData, ...this.otherData],
mapId: this.$route.params.mapId
};
this.dataLoading = true;
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存现地配置成功');
this.dataLoading = false;
this.cancelOverlab();
}).catch(() => {
this.dataLoading = false;
this.$messageBox('保存现地配置失败');
});
},
back() {
this.$emit('goDraw');
},
generateOverlab() { //
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
return;
}
if (!this.addModel.switchStationCodeList.length) {
this.$messageBox('请选择可切换显示的车站!');
return;
}
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正区段未选择!');
return;
}
this.addModel.amendPointsList = [...this.amendPointsList];
this.amendPointsList = [];
this.hoverIndex = -1;
this.tableData.push(this.addModel);
this.clearData();
},
clear() {
this.addModel = { type: 'LOCAL', stationCodeList: [], elementList: [], switchStationCodeList:[] };
this.amendPointsList = [];
},
clearData() {
this.addModel = { type: 'LOCAL', stationCodeList: [], elementList: [], switchStationCodeList:[] };
this.amendPointsList = [];
this.index = '';
this.cardMode = 'generate';
},
generateAllData() {
this.loading = true;
this.tableData = [];
const tempData = { type: 'LOCAL', stationCodeList: [], elementList: [], switchStationCodeList:[] };
const stationCodeList = [];
this.stationList.forEach(item => {
if (!item.depot) {
tempData.stationCodeList.push(item.code);
tempData.switchStationCodeList.push(item.code);
tempData.elementList.push(item.code);
} else { stationCodeList.push(item.code); }
});
[...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList,
...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.indicatorLightList, ...this.lineList, ...this.outerFrameList,
...this.responderList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList, ...this.signalButtonList].forEach(item => {
if (!stationCodeList.includes(item.stationCode)) {
tempData.elementList.push(item.code);
}
});
[...this.directionRodList].forEach(item => {
if (!stationCodeList.includes(item.deviceStationCode)) {
tempData.elementList.push(item.code);
}
});
this.psdList.forEach(item => {
const stand = this.$store.getters['map/getDeviceByCode'](item.standCode);
if (!stationCodeList.includes(stand.stationCode)) {
tempData.elementList.push(item.code);
}
});
this.tableData.push(tempData);
const map = this.$store.state.map.map;
const param = {
displayList: [...this.tableData, ...this.otherData],
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.loading = false;
this.$message.success('保存现地配置成功');
this.cancelOverlab();
}).catch(() => {
this.loading = false;
this.$messageBox('保存现地配置失败');
});
},
addAmendPoints() {
this.amendPointsList.push({ code: '', points: [{ x: 0, y: 0 }, { x:0, y:0 }], position: {x: 0, y: 0}, rotate:0, reversal: false });
},
delAmendPoints(index) {
this.hoverIndex = -1;
this.amendPointsList.splice(index, 1);
},
addPoint(index, points) {
points.splice(index, 0, {x:0, y:0});
},
delPoint(index, points) {
points.splice(index, 1);
},
generateData() {
this.loading = true;
this.tableData = [];
// switchStationCodeList:[...item.switchStationCodeList, item.code]
this.stationList.forEach(item => {
if (item.centralized) {
this.tableData.push({type: 'LOCAL', stationCodeList: [...item.chargeStationCodeList, item.code], elementList: [...item.chargeStationCodeList, item.code], switchStationCodeList:[...item.chargeStationCodeList, item.code]});
}
});
[...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList,
...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.indicatorLightList, ...this.lineList, ...this.outerFrameList,
...this.responderList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList, ...this.signalButtonList].forEach(item => {
const target = this.tableData.find(elem => elem.stationCodeList.includes(item.stationCode));
target && target.elementList.push(item.code);
});
[...this.directionRodList].forEach(item => {
const target = this.tableData.find(elem => elem.stationCodeList.includes(item.deviceStationCode));
target && target.elementList.push(item.code);
});
this.psdList.forEach(item => {
const stand = this.$store.getters['map/getDeviceByCode'](item.standCode);
const target = this.tableData.find(elem => elem.stationCodeList.includes(stand.stationCode));
target && target.elementList.push(item.code);
});
const map = this.$store.state.map.map;
const param = {
displayList: [...this.tableData, ...this.otherData],
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.loading = false;
this.$message.success('保存现地配置成功');
this.cancelOverlab();
}).catch(() => {
this.loading = false;
this.$messageBox('保存现地配置失败');
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.title-box{
padding-left: 10px;
border-left: 4px solid red;
margin-bottom: 10px;
}
.box-card {
width: 100%;
padding: 5px;
}
.list-box{
overflow: hidden;
.list-content{
float: left;
background: #e2e2e2;
margin: 5px;
border-radius: 5px;
height: 30px;
line-height: 30px;
padding-left: 10px;
padding-right: 3px;
cursor: pointer;
&:hover{
background: #ccc;
}
.name{
float: left;
margin-right: 20px;
}
.close{
float: left;
width: 23px;
cursor: pointer;
}
}
}
</style>

View File

@ -1,308 +0,0 @@
<template>
<div class="view-control-content">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-table :data="tableData" style="width: 80%; margin: 0 auto;">
<el-table-column label="区段名称">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="换行位置">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.position }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click.native.prevent="editModel(tableData, scope.$index)">
编辑
</el-button>
<el-button type="text" size="small" @click.native.prevent="deleteModel(tableData, scope.$index)">
移出
</el-button>
</template>
</el-table-column>
</el-table>
<el-card class="box-card" shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header" class="clearfix">
<span style="font-size: 12px;">{{ cardTitle }}</span>
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
</el-button-group>
</div>
<div>
<el-form ref="hostileForm" :model="addModel" label-width="135px" size="mini" style="margin-top: 15px">
<el-form-item label="区段:" prop="sectionCode">
<el-select v-model="addModel.sectionCode" clearable :filterable="true">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'selectSection' ? 'danger' : 'primary'"
@click="hover('selectSection')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<el-form ref="form" :model="formData" :rules="rules" label-width="140px" size="mini">
<el-form-item label="宽度:" prop="width">
<el-input-number v-model="formData.width" style="width: 150px;" :min="1" />
<span style="color: #ababab;"></span>
</el-form-item>
<el-form-item label="高度:" prop="height">
<el-input-number v-model="formData.height" style="width: 150px;" :min="1" />
<span style="color: #ababab;"></span>
</el-form-item>
<template v-for="(item, i) in list">
<el-form-item :key="i" :label="'第'+ (i + 1) +'行偏移值:'" prop="offsetTop">
<el-input-number v-model="list[i]['offsetTop']" style="width: 150px;" />
</el-form-item>
</template>
</el-form>
<div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" @click="save">保存</el-button>
<el-button v-if="isPreview" type="primary" @click="preview">预览</el-button>
<el-button v-if="!isPreview" type="primary" @click="recover">重置</el-button>
<el-button type="primary" @click="back">返回</el-button>
</div>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { saveMap } from '@/api/jmap/mapdraft';
export default {
components: {
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
}
},
data() {
return {
tableData: [],
addModel: {
sectionCode: '',
offsetTop: 0
},
formData: {
width: 2,
height: 2,
offsetTop: 0
},
rules: {
width: [
{ required: true, message: '请输入宽度', trigger: 'blur' }
],
height: [
{ required: true, message: '请输入高度', trigger: 'blur' }
]
},
list: [],
field: '',
cardMode: 'generate',
index: '',
isPreview: true
};
},
computed: {
...mapGetters('map', [
'sectionList',
'bigScreenConfig'
]),
cardTitle() {
if (this.cardMode === 'generate') {
return '生成数据';
} else if (this.cardMode === 'edit') {
return '编辑数据';
} else {
return '';
}
}
},
watch: {
selected: function (val, oldVal) {
this.deviceSelect(val);
}
// bigScreenConfig: function(data) {
// if (data) {
// this.handleList(data);
// }
// }
},
mounted() {
if (this.bigScreenConfig) {
this.handleList(this.bigScreenConfig);
}
},
methods: {
deviceSelect(selected) {
this.$refs.form && this.$refs.form.resetFields();
this.$refs.make && this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSection'.toUpperCase()) {
if (selected.type === '01' || selected.type === '02' || selected.type === '03') {
this.addModel.sectionCode = selected.code;
this.field = '';
}
}
},
handleList(data) {
this.tableData = [];
if (data.bigScreenSplitConfig) {
data.bigScreenSplitConfig.forEach(item => {
const section = this.$store.getters['map/getDeviceByCode'](item.sectionCode);
if (section) {
const param = {
position: String(section.points[section.points.length - 1].x),
name: `${section.name}(${section.code})`,
offsetTop: 0,
sectionCode: section.code
};
this.tableData.push(param);
}
});
this.tableData.sort((a, b) => Number(a.position) - Number(b.position)); //
this.formData = {
width: data.width,
height: data.height
};
data.offsetList.length = data.bigScreenSplitConfig.length + 1;
}
if (data.offsetList && data.offsetList.length) {
this.list = [];
data.offsetList.forEach(item => {
const param = {offsetTop: item};
this.list.push(param);
});
} else {
this.list = this.tableData.concat({offsetTop: 0});
}
},
hover(field) {
this.field = field == this.field ? '' : field;
},
deleteModel(list, index) {
list.splice(index, 1);
this.list.pop();
this.clear();
this.cardMode = 'generate';
},
editModel(list, index) {
this.addModel.sectionCode = list[index].sectionCode;
this.index = index;
this.cardMode = 'edit';
},
cancelOverlab() {
this.cardMode = 'generate';
this.clear();
},
updateOverlab() {
if (this.index || this.index == 0) {
if (!this.addModel.sectionCode) {
this.$messageBox('请选择区段!');
} else {
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.sectionCode);
const param = {
position: String(section.points[section.points.length - 1].x),
offsetTop: 0,
name: `${section.name}(${section.code})`,
sectionCode: section.code
};
this.tableData.splice(this.index, 1, param);
}
this.clear();
this.cardMode = 'generate';
}
},
save() {
if (this.tableData.length) {
const map = this.$store.state.map.map;
const param = {
bigScreenConfig: {
bigScreenSplitConfig: this.tableData,
width: this.formData.width,
height: this.formData.height,
offsetList: this.list.map(ele => ele.offsetTop)
},
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存大屏分割位置成功');
}).catch(() => {
this.$messageBox('保存大屏分割位置失败');
});
}
},
preview() { //
if (this.tableData.length) {
this.isPreview = false;
this.$jlmap && this.$jlmap.off('zoom');
const size = {
width: this.$jlmap.$zr.getWidth() * this.formData.width,
height: this.$jlmap.$zr.getHeight() * this.formData.height,
list: this.tableData.map(ele => ele.position),
offsetList: this.list.map(ele => ele.offsetTop)
};
this.$jlmap && this.$jlmap.setUpdateScreen(size);
} else {
this.$messageBox('请输入换行位置信息');
}
},
recover() { //
this.isPreview = true;
this.$jlmap && this.$jlmap.on('zoom');
const param = {
scaleRate: this.$store.state.map.dataZoom.scaleRate,
offsetX: this.$store.state.map.dataZoom.offsetX,
offsetY: this.$store.state.map.dataZoom.offsetY
};
this.$jlmap && this.$jlmap.setRecover(param);
},
back() {
this.$emit('goDraw');
},
clear() {
this.$refs.hostileForm.resetFields();
this.addModel.sectionCode = '';
this.index = '';
this.field = '';
},
generateOverlab() { //
if (!this.addModel.sectionCode) {
this.$messageBox('请选择区段!');
} else {
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.sectionCode);
const position = section.points[section.points.length - 1].x;
this.tableData.push({
position: String(position),
offsetTop: 0,
name: `${section.name}(${section.code})`,
sectionCode: section.code
});
this.tableData.sort((a, b) => Number(a.position) - Number(b.position)); //
this.list = this.list.concat({offsetTop: 0});
this.clear();
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@ -13,10 +13,6 @@
<el-dropdown class="operate-button" trigger="click">
<span class="el-dropdown-link">配置</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><div @click="showCenterConfig">行调配置</div></el-dropdown-item>
<el-dropdown-item><div @click="showLocalConfig">现地配置</div></el-dropdown-item>
<el-dropdown-item><div @click="showScreenConfig">大屏配置</div></el-dropdown-item>
<el-dropdown-item><div @click="showDepotConfig">车辆段配置</div></el-dropdown-item>
<el-dropdown-item><div @click="setMapFunctionConfig">地图配置</div></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@ -30,7 +26,7 @@
</el-dropdown>
<el-button v-if="isSave" type="text" style="padding: 3px 0" :disabled="$attrs.mapSaveing" @click="saveMapEvent">{{ $t('map.save') }}</el-button>
</div>
<el-tabs v-show="configShow === 'none'" v-model="enabledTab" class="mapEdit" type="card">
<el-tabs v-model="enabledTab" class="mapEdit" type="card">
<el-tab-pane v-for="(each,index) in tabList" :key="index" :label="each.label" class="tab_pane_box" :name="each.name" :lazy="lazy">
<component
:is="each.menus"
@ -42,10 +38,6 @@
/>
</el-tab-pane>
</el-tabs>
<local-config v-if="configShow === 'local'" ref="localConfig" :selected="selected" @goDraw="goDraw" />
<split-screen v-else-if="configShow === 'screen'" ref="splitScreen" :selected="selected" @goDraw="goDraw" />
<center-config v-else-if="configShow === 'center'" ref="centerConfig" :selected="selected" @goDraw="goDraw" />
<depot-config v-else-if="configShow === 'depot'" ref="depotConfig" :selected="selected" @goDraw="goDraw" />
</div>
</transition>
</template>
@ -73,13 +65,9 @@ import ResponderDraft from './responder/index';
import ControlLamp from './controlLamp';
import SplitStation from './splitStation';
import Arrow from './arrow';
import SplitScreen from './displayConfig/splitScreen';
import FloodGate from './floodGate';
import DirectionRod from './directionRod';
import SignalButton from './signalButton';
import LocalConfig from './displayConfig/localConfig';
import CenterConfig from './displayConfig/centerConfig';
import DepotConfig from './displayConfig/depotConfig';
import SimulationMember from './simulationMember/index';
export default {
@ -107,13 +95,9 @@ export default {
ControlLamp,
SplitStation,
Arrow,
SplitScreen,
FloodGate,
DirectionRod,
SignalButton,
LocalConfig,
CenterConfig,
DepotConfig,
SimulationMember
},
props: {
@ -160,8 +144,7 @@ export default {
{label: '仿真成员', name: 'SimulationMember', menus: SimulationMember}
],
selectDevice:'',
enabledTab: 'Section',
configShow: 'none'
enabledTab: 'Section'
};
},
computed: {
@ -192,21 +175,6 @@ export default {
dataRelation() {
this.$emit('selectView', 'path');
},
showCenterConfig() {
this.configShow = 'center';
},
showLocalConfig() {
this.configShow = 'local';
},
showScreenConfig() {
this.configShow = 'screen';
},
showDepotConfig() {
this.configShow = 'depot';
},
goDraw() {
this.configShow = 'none';
},
showMap() {
this.$emit('showMap');
},