rt-sim-training-client/src/views/newMap/displayNew/menuSchema.vue

390 lines
15 KiB
Vue
Raw Normal View History

2019-12-30 09:00:16 +08:00
<template>
<div>
<div class="schema" :style="{top: offset+'px'}">
2021-09-14 17:10:00 +08:00
<select-station v-if="isShowSelectStation && !isScript" ref="selectStation" :style-css="'width: 100px;'" />
<el-select v-model="speed" style="width: 100px;" size="small" @change="speedChange">
<el-option
v-for="item in speedList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<template v-if="!dataError">
2021-02-04 18:30:02 +08:00
<el-button-group v-if="project !== 'bjd'">
2022-07-13 13:33:41 +08:00
<el-button v-if="$route.query.lineCode === '16'&&!isCtc && project !== 'teaching'" size="small" @click="goCtc">CTC</el-button>
2022-06-27 11:05:12 +08:00
<!-- <el-button v-if="$route.query.lineCode === '16'&&!isCtc" size="small" @click="goRpManage">管理终端</el-button> -->
2022-06-28 16:50:48 +08:00
<!-- <el-button v-if="$route.query.lineCode === '16'&&!isCtc" size="small" @click="goDsManage">调度台</el-button> -->
2022-07-13 13:33:41 +08:00
<el-button v-if="isLocalStation && $route.query.lineCode!='08' && $route.query.lineCode!='16' && project !== 'teaching'" size="small" @click="goIbp">IBP盘</el-button>
<el-button v-if="isScheduling && isDepot && project !== 'teaching'" size="small" type="primary" @click="runPlanEditShow">运行图编辑</el-button>
2022-06-15 09:18:36 +08:00
<!-- 加载剧本 -->
2022-07-13 13:33:41 +08:00
<el-button v-if="isDemon && !isScheduling && !isContest && !isDepoltSim && $route.query.lineCode!='16' && project !== 'teaching'" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
2022-06-15 09:18:36 +08:00
<!-- 运行图加载 -->
<!-- notScript && -->
2022-07-13 13:33:41 +08:00
<el-button v-if="running && project !== 'teaching'" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
2022-06-15 09:18:36 +08:00
<!-- notScript && -->
2022-07-13 13:33:41 +08:00
<el-button v-if="!running && $route.query.lineCode!='16' && project !== 'teaching'" size="small" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
2020-07-31 15:24:44 +08:00
</el-button-group>
2021-02-04 18:30:02 +08:00
<el-button v-if="!isScheduling && project !== 'bjd'" size="small" :type="faultMode ? '':'primary' " @click="changeOperateMode()">{{ faultMode?'切换到普通模式[Tab]':'切换到故障模式[Tab]' }}</el-button>
<el-button v-if="running&&project == 'bjd'" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<!-- <el-button v-if="!isLocalStation" size="small" :type="faultMode ? 'danger' : ''" @click="changeDirectiveMode()">指令模式</el-button> -->
2020-07-31 15:24:44 +08:00
</template>
2019-12-30 09:00:16 +08:00
</div>
2020-08-26 13:21:47 +08:00
<fault-choose ref="faultChoose" :group="group" :offset="offset" />
2019-12-30 09:00:16 +08:00
<run-plan-Load ref="runPlanLoad" :group="group" />
2021-02-04 18:30:02 +08:00
<!-- v-if="project!== 'bjd'" -->
<run-plan-view ref="runPlanView" :group="group" />
2019-12-30 09:00:16 +08:00
<!-- 加载剧本列表弹窗 -->
<add-quest ref="addQuest" @selectQuest="selectQuest" />
2022-06-15 09:18:36 +08:00
<line-board ref="lineBoard" />
2020-12-11 20:17:18 +08:00
<!-- <run-plan-edit v-if="isScheduling && isDepot" ref="runPlanEdit" /> -->
2019-12-30 09:00:16 +08:00
</div>
</template>
<script>
2020-08-20 20:27:19 +08:00
import SelectStation from './selectStation';
2019-12-30 09:00:16 +08:00
import RunPlanLoad from './demon/runPlanLoad';
import RunPlanView from './demon/runPlanView';
import FaultChoose from './demon/faultChoose';
2022-04-22 14:40:31 +08:00
import LineBoard from '../displayCity/lineBoard';
2019-12-30 09:00:16 +08:00
import AddQuest from './demon/addQuest';
import { OperateMode } from '@/scripts/ConstDic';
import { getByGroupStationList } from '@/api/jmap/map';
2021-05-10 15:08:58 +08:00
import { generateRunPlanInfoSync } from '@/api/jmap/mapdraft.js';
2020-08-26 14:08:50 +08:00
import { getSessionStorage } from '@/utils/auth';
2020-12-11 20:17:18 +08:00
import { getToken } from '@/utils/auth';
import { getIbpInfoByStation } from '@/api/ibp';
2020-12-24 15:33:06 +08:00
import { loadRunPlanData } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus';
import { timesSpeedPlayback } from '@/api/rtSimulation';
2019-12-30 09:00:16 +08:00
// 右上角操作
export default {
name: 'MenuSchema',
components: {
RunPlanLoad,
RunPlanView,
FaultChoose,
AddQuest,
2020-12-11 20:17:18 +08:00
// RunPlanEdit,
2022-04-22 14:40:31 +08:00
SelectStation,
2022-06-15 09:18:36 +08:00
LineBoard
2019-12-30 09:00:16 +08:00
},
props: {
offset: {
type: Number,
required: true
2020-03-25 15:22:52 +08:00
},
2020-05-09 20:24:59 +08:00
dataError: {
type: Boolean,
default() {
return false;
}
2019-12-30 09:00:16 +08:00
}
},
data() {
return {
mode: OperateMode.NORMAL,
OperateMode: OperateMode,
viewDisabled: true,
2020-07-23 17:09:29 +08:00
swch: '02',
2020-05-19 09:45:15 +08:00
isScriptCommand:false,
faultMode: false,
speed: 1
// firstLoad: true
2019-12-30 09:00:16 +08:00
};
},
computed: {
2020-06-29 15:55:31 +08:00
group() {
return this.$route.query.group;
},
2019-12-30 09:00:16 +08:00
notScript() {
return this.$route.params.mode !== 'script';
},
2022-06-15 09:18:36 +08:00
isCtc() {
return !!this.$route.query.ctc;
},
2019-12-30 09:00:16 +08:00
isScript() {
return this.$route.params.mode === 'script';
},
2020-08-26 14:08:50 +08:00
project() {
return getSessionStorage('project');
},
2019-12-30 09:00:16 +08:00
isDemon() {
return this.$route.params.mode === 'demon';
},
2020-04-20 15:38:30 +08:00
isScheduling() {
return this.$route.query.prdType === '05';
2020-05-20 14:50:34 +08:00
},
isDepoltSim() {
return this.$route.query.prdType === '09';
},
2020-05-20 14:50:34 +08:00
isLocalStation() {
return this.$store.state.training.prdType === '01';
},
2021-09-14 17:10:00 +08:00
isShowSelectStation() {
return this.$store.state.training.prdType === '01' || this.$store.state.training.prdType === '09';
},
2020-08-07 13:59:19 +08:00
running() {
return this.$store.state.training.started;
2020-08-14 18:30:04 +08:00
},
isDepot() {
return this.$route.query.type === 'DEPOT';
2020-08-28 10:59:44 +08:00
},
isContest() {
return this.project.includes('drts');
},
isAdmin() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
},
speedList() {
return this.isAdmin ? [
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' },
{ value: 6, label: '6倍速' },
{ value: 7, label: '7倍速' },
{ value: 8, label: '8倍速' },
{ value: 9, label: '9倍速' },
{ value: 10, label: '10倍速' }
] : [
{ value: 1, label: '1倍速' },
{ value: 2, label: '2倍速' },
{ value: 3, label: '3倍速' },
{ value: 4, label: '4倍速' },
{ value: 5, label: '5倍速' }
];
2019-12-30 09:00:16 +08:00
}
},
watch: {
2020-05-19 09:45:15 +08:00
'$store.state.scriptRecord.bgSet':function (val) {
this.isScriptCommand = val;
2020-07-09 15:44:12 +08:00
if (!val) {
this.swch = '01';
}
2020-05-20 14:50:34 +08:00
},
2021-07-01 10:06:35 +08:00
// '$store.state.map.mapDataLoadedCount': function () {
// this.loadRunData();
// },
'$store.state.training.subscribeCount': function () {
2020-09-03 14:44:16 +08:00
this.loadRunData();
2020-10-12 14:25:33 +08:00
},
2021-07-01 10:06:35 +08:00
'$store.state.socket.simulationPlanChange': function (val) {
// 判断是否已经加载运行图,若加载只处理运行图数据,否则,缓存数据
if (JSON.stringify(this.$store.state.runPlan.planData) == '{}') {
this.$store.dispatch('runPlan/setUpdateTrainRpData', val);
2021-07-01 10:06:35 +08:00
} else {
this.$store.dispatch('runPlan/updateTrainRunplan', val);
}
},
2020-10-12 14:25:33 +08:00
'$store.state.training.triggerFaultCount': function () {
this.setFault();
2020-12-24 15:33:06 +08:00
},
'$store.state.runPlan.loadRunPlanCount': function () {
this.viewDisabled = false;
if (JSON.stringify(this.$store.state.runPlan.updateTrainRpData) != '{}') {
this.$store.dispatch('runPlan/updateTrainRunplan', this.$store.state.runPlan.updateTrainRpData);
}
},
'$store.state.socket.simulationSpeed': function (val) {
this.speed = val;
2019-12-30 09:00:16 +08:00
}
},
mounted() {
EventBus.$on('CheckFaultModeEvent', () => {
if (!this.isScheduling) {
this.changeOperateMode();
}
2021-02-04 18:30:02 +08:00
});
2022-06-15 09:18:36 +08:00
EventBus.$on('showLineBoard', () => {
this.showLineBoard();
});
},
2019-12-30 09:00:16 +08:00
methods: {
2020-07-31 15:24:44 +08:00
loadRunData() {
2019-12-30 09:00:16 +08:00
this.$store.dispatch('runPlan/clear').then(() => {
2020-07-31 15:24:44 +08:00
if (this.group) {
2019-12-30 09:00:16 +08:00
this.viewDisabled = true;
2020-07-31 15:24:44 +08:00
// 获取排序的车站列表
getByGroupStationList(this.group).then(response => {
2019-12-30 09:00:16 +08:00
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
2020-12-24 15:33:06 +08:00
loadRunPlanData(this.group, this.dataError);
2019-12-30 09:00:16 +08:00
});
}).catch(() => {
this.$messageBox(this.$t('display.schema.getStationListFail'));
});
}
});
},
2022-06-15 09:18:36 +08:00
showLineBoard() {
this.$refs.lineBoard.doShow();
},
goCtc() {
const routeData = this.$router.resolve({
path:'/displayNew/demon',
query:{
lineCode:this.$route.query.lineCode,
group: this.$route.query.group,
prdType: this.$route.query.prdType,
mapId:this.$route.query.mapId,
project: this.project,
newApi: this.$route.query.newApi,
ctc: true,
try: this.$route.query.try,
token:getToken(),
noPreLogout: true
}
});
window.open(routeData.href, '_blank');
},
2022-06-27 11:05:12 +08:00
// goRpManage() {
// const routeData = this.$router.resolve({
// path:'/bigTrainRunplanManage',
// query:{
// group: this.$route.query.group,
// mapId:this.$route.query.mapId,
// project: this.project,
// prdType: this.$route.query.prdType,
// lineCode:this.$route.query.lineCode,
// // stationCode:this.$store.state.training.roleDeviceCode,
// // token:getToken(),
// noPreLogout: true
// }
// });
// window.open(routeData.href, '_blank');
// },
2022-06-28 16:50:48 +08:00
// goDispatcherStation() {
// const routeData = this.$router.resolve({
// // path:'/bigTrainDispatcherStation',
// path:'/displayNew/demon',
// query:{
// group: this.$route.query.group,
// mapId:this.$route.query.mapId,
// project: this.project,
// prdType: this.$route.query.prdType,
// lineCode:this.$route.query.lineCode,
// newApi: this.$route.query.newApi,
// dispatcherStation:true,
// // stationCode:this.$store.state.training.roleDeviceCode,
// // token:getToken(),
// try: this.$route.query.try,
// token:getToken(),
// noPreLogout: true
// }
// });
// window.open(routeData.href, '_blank');
// },
// goDsManage() {
// const routeData = this.$router.resolve({
// path:'/dispatcherStationManage',
// query:{
// group: this.$route.query.group,
// mapId:this.$route.query.mapId,
// project: this.project,
// prdType: this.$route.query.prdType,
// lineCode:this.$route.query.lineCode,
// // stationCode:this.$store.state.training.roleDeviceCode,
// token:getToken(),
// noPreLogout: true
// }
// });
// window.open(routeData.href, '_blank');
// },
changeOperateMode() {
this.faultMode = !this.faultMode;
let mode = OperateMode.NORMAL;
if (this.faultMode) {
mode = OperateMode.FAULT;
}
this.$store.dispatch('training/changeOperateMode', { mode: mode });
},
// changeDirectiveMode() { // 调整指令模式 (暂时不使用 等项目更新 在使用)
// this.directiveMode = !this.directiveMode;
// let mode = OperateMode.NORMAL;
// if (this.directiveMode) {
// mode = OperateMode.DIRECTIVE;
// }
// this.$store.dispatch('training/changeOperateMode', { mode: mode });
// },
speedChange(val) {
timesSpeedPlayback(this.$route.query.group, val).then(resp => {
this.$message.success(`设置${val}倍速成功!`);
}).catch(e => {
this.$message.error('设置倍速失败!');
});
},
2019-12-30 09:00:16 +08:00
setFault() {
this.$refs.faultChoose.doShow();
},
loadRunPlan() {
this.$refs.runPlanLoad.doShow();
},
viewRunPlan() {
this.$refs.runPlanView.doShow();
},
viewRunQuest() {
this.$refs.addQuest.doShow();
},
2020-08-20 20:27:19 +08:00
selectQuest(row, id, mapLocation, roleName) {
this.$emit('selectQuest', {row, id, mapLocation, roleName});
2019-12-30 09:00:16 +08:00
},
runPlanEditShow() {
2021-05-10 15:08:58 +08:00
generateRunPlanInfoSync(this.$route.query.mapId).then(resp => {
const routeData = this.$router.resolve({
path:'/plan/newTool',
query:{
mapId:this.$route.query.mapId,
lineCode:this.$route.query.lineCode,
token:getToken(),
project: this.project,
noPreLogout: true
}
});
window.open(routeData.href, '_blank');
2020-12-11 20:17:18 +08:00
});
},
goIbp() {
const deviceCode = this.$refs.selectStation.showStation;
getIbpInfoByStation(this.$route.query.mapId, deviceCode).then(resp => {
if (resp.data) {
const routeData = this.$router.resolve({
path:`/ibpShow`,
query:{
lineCode: this.$route.query.lineCode,
mapId: this.$route.query.mapId,
group: this.$route.query.group,
stationCode: deviceCode,
loadAll: true,
noPreLogout: true
}
});
2021-03-13 00:20:59 +08:00
window.open(routeData.href, '_blank');
} else {
this.$messageBox('本车站暂无IBP盘数据');
}
}).catch((error) => {
if (error.code == '10007') {
this.$messageBox('本车站暂无IBP盘数据');
} else {
this.$message.error('获取IBP盘数据异常');
}
});
2019-12-30 09:00:16 +08:00
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.schema {
z-index: 36;
2019-12-30 09:00:16 +08:00
display: inline;
position: absolute;
2020-07-29 10:27:02 +08:00
right: 5px;
2019-12-30 09:00:16 +08:00
}
/deep/ .el-button+.el-button {
margin-left: 0px;
}
</style>