2020-01-06 18:39:44 +08:00
|
|
|
<template>
|
2020-07-31 16:03:32 +08:00
|
|
|
<div style="height:100%">
|
|
|
|
<div class="schema" :style="{top: offset+'px'}">
|
|
|
|
<el-select v-if="showSelectStation" v-model="chiShowStation" style="width: 100px;" size="small" @change="switchStationMode">
|
|
|
|
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
|
|
|
|
</el-select>
|
|
|
|
<el-button-group>
|
2020-09-16 10:10:13 +08:00
|
|
|
<!-- <el-button v-if="userRole=== 'DISPATCHER' && !$route.query.projectDevice" size="small" @click="goIbp">IBP盘</el-button> -->
|
2020-07-31 16:03:32 +08:00
|
|
|
<el-button v-if="userRole=== 'DISPATCHER' && !$route.query.projectDevice" size="small" @click="goBigScreen">大屏</el-button>
|
2020-08-05 15:12:40 +08:00
|
|
|
<el-button v-if="running && !dataError" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
|
2020-07-31 16:03:32 +08:00
|
|
|
<template v-if="isAdmin">
|
2020-08-05 15:12:40 +08:00
|
|
|
<el-button v-if="!running && !dataError" size="small" type="warning" @click="loadRunPlan">
|
2020-07-31 16:03:32 +08:00
|
|
|
{{ $t('joinTraining.runGraphLoading') }}</el-button><!-- 运行图加载 -->
|
|
|
|
</template>
|
|
|
|
<template v-if="isAdmin">
|
2020-08-03 14:12:56 +08:00
|
|
|
<el-button v-if="faultMode && !dataError" size="small" type="danger" @click="setFault">{{ $t('joinTraining.faultSetting') }}</el-button>
|
2020-07-31 16:03:32 +08:00
|
|
|
</template>
|
|
|
|
</el-button-group>
|
2020-08-03 16:59:23 +08:00
|
|
|
<el-button v-if="isAdmin && !dataError && !isScreen" size="small" :type="faultMode ? '' : 'primary' " @click="changeOperateMode()">{{ faultMode?' 切换到普通模式':'切换到故障模式' }}</el-button>
|
2020-08-03 14:12:56 +08:00
|
|
|
<!-- isCenter && !dataError && !isAdmin 此判断用于以后(目前 暂时不用) -->
|
2020-08-05 09:05:26 +08:00
|
|
|
<el-button v-if="isShowDirective" size="small" :type="directiveMode ? 'primary' : ''" @click="changeDirectiveMode()">{{ directiveMode? '切换到普通模式':'切换到指令模式' }}</el-button>
|
2020-07-31 16:03:32 +08:00
|
|
|
</div>
|
2020-08-05 15:12:40 +08:00
|
|
|
<join-run-plan-view v-if="running && !dataError" ref="runPlanView" :group="group" />
|
2020-01-06 18:39:44 +08:00
|
|
|
</div>
|
2020-07-31 16:03:32 +08:00
|
|
|
|
2020-01-06 18:39:44 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { OperateMode } from '@/scripts/ConstDic';
|
2020-03-13 18:19:04 +08:00
|
|
|
import { getByGroupStationList } from '@/api/jmap/map';
|
2020-03-17 14:54:03 +08:00
|
|
|
import { getEveryDayRunPlanNew } from '@/api/simulation';
|
2020-08-03 14:12:56 +08:00
|
|
|
import { getSessionStorage } from '@/utils/auth';
|
2020-07-31 16:03:32 +08:00
|
|
|
import JoinRunPlanView from '@/views/newMap/displayNew/demon/runPlanView';
|
2020-01-06 18:39:44 +08:00
|
|
|
export default {
|
|
|
|
name: 'MenuDemonSchema',
|
2020-07-31 16:03:32 +08:00
|
|
|
components:{
|
|
|
|
JoinRunPlanView
|
|
|
|
},
|
2020-01-06 18:39:44 +08:00
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
offset: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
userRole: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2020-03-25 15:22:52 +08:00
|
|
|
},
|
|
|
|
showSelectStation: {
|
|
|
|
type: Boolean,
|
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
stationList: {
|
2020-04-21 11:26:07 +08:00
|
|
|
type: Array,
|
2020-03-25 15:22:52 +08:00
|
|
|
default() {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
2020-05-09 20:24:59 +08:00
|
|
|
dataError: {
|
|
|
|
type: Boolean,
|
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
2020-06-30 14:27:32 +08:00
|
|
|
},
|
|
|
|
isAdmin: {
|
|
|
|
type: Boolean,
|
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
mode: OperateMode.NORMAL,
|
|
|
|
OperateMode: OperateMode,
|
|
|
|
viewDisabled: true,
|
|
|
|
realData: {},
|
|
|
|
series: [],
|
2020-05-19 13:41:48 +08:00
|
|
|
chiShowStation: '',
|
2020-01-06 18:39:44 +08:00
|
|
|
kmRangeCoordMap: {},
|
|
|
|
runPlanData: {},
|
2020-08-03 14:12:56 +08:00
|
|
|
userId: '',
|
|
|
|
faultMode: false,
|
2020-08-04 10:03:06 +08:00
|
|
|
directiveMode: false,
|
|
|
|
firstLoad: true
|
2020-01-06 18:39:44 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('runPlan', [
|
|
|
|
'stations'
|
|
|
|
]),
|
2020-08-05 15:12:40 +08:00
|
|
|
running() {
|
|
|
|
return this.$store.state.training.started;
|
|
|
|
},
|
2020-06-10 16:56:52 +08:00
|
|
|
isScreen() {
|
|
|
|
return this.$store.state.training.prdType === '07';
|
2020-08-03 14:12:56 +08:00
|
|
|
},
|
2020-08-05 15:12:40 +08:00
|
|
|
// isCenter() {
|
|
|
|
// return this.$store.state.training.prdType === '02';
|
|
|
|
// },
|
2020-08-03 14:12:56 +08:00
|
|
|
isShowDirective() { // 哈尔滨项目 行调设备显示
|
|
|
|
return this.$route.query.type == 'CW' && getSessionStorage('project') == 'heb';
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2020-09-03 14:44:16 +08:00
|
|
|
// '$store.state.training.switchcount': async function () {
|
|
|
|
// if (this.group) {
|
|
|
|
// const started = this.$store.state.training.started;
|
|
|
|
// if (started && !this.firstLoad) {
|
|
|
|
// await this.loadRunData(this.$route.query);
|
|
|
|
// } else if (this.firstLoad) {
|
|
|
|
// await this.loadRunData(this.$route.query);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
'$store.state.map.mapDataLoadedCount': function () {
|
|
|
|
this.loadRunData(this.$route.query);
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async mounted() {
|
|
|
|
this.userId = this.$store.state.user.id;
|
2020-08-04 10:03:06 +08:00
|
|
|
// await this.loadRunData(this.$route.query);
|
2020-01-06 18:39:44 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadRunData(opt) {
|
|
|
|
this.$store.dispatch('runPlan/clear').then(resp => {
|
|
|
|
if (opt && opt.mapId) {
|
|
|
|
this.viewDisabled = true;
|
2020-03-13 18:19:04 +08:00
|
|
|
getByGroupStationList(this.$route.query.group).then(response => {
|
2020-01-06 18:39:44 +08:00
|
|
|
const stations = response.data;
|
|
|
|
this.$store.dispatch('runPlan/setStations', stations).then(() => {
|
2020-03-17 14:54:03 +08:00
|
|
|
getEveryDayRunPlanNew(this.group).then(resp => {
|
2020-01-06 18:39:44 +08:00
|
|
|
this.$store.dispatch('runPlan/setPlanData', resp.data);
|
2020-03-17 14:54:03 +08:00
|
|
|
this.$store.dispatch('runPlan/setInitialPlanData', resp.data);
|
2020-01-06 18:39:44 +08:00
|
|
|
this.viewDisabled = false;
|
2020-08-05 09:36:13 +08:00
|
|
|
this.firstLoad = false;
|
2020-01-06 18:39:44 +08:00
|
|
|
}).catch(error => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', []);
|
|
|
|
if (error.code == 30001) {
|
|
|
|
this.$messageBox(this.$t('error.runGraphIsNotLoaded'));
|
|
|
|
} else {
|
2020-05-09 20:27:41 +08:00
|
|
|
!this.dataError && this.$messageBox(this.$t('error.obtainOperationGraphFailed'));
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('error.obtainStationListFailed'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2020-07-24 17:17:40 +08:00
|
|
|
// initPlannedDriving(isDisable) {
|
|
|
|
// this.isDisable = isDisable;
|
|
|
|
// },
|
2020-08-03 14:12:56 +08:00
|
|
|
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 });
|
2020-01-06 18:39:44 +08:00
|
|
|
},
|
|
|
|
setFault() {
|
|
|
|
this.$emit('faultChooseShow');
|
|
|
|
},
|
|
|
|
loadRunPlan() {
|
|
|
|
this.$emit('runPlanLoadShow');
|
|
|
|
},
|
|
|
|
viewRunPlan() {
|
2020-07-31 16:03:32 +08:00
|
|
|
this.$refs.runPlanView.doShow();
|
2020-01-06 18:39:44 +08:00
|
|
|
},
|
2020-07-28 11:14:06 +08:00
|
|
|
// 选择车站
|
2020-07-24 18:38:19 +08:00
|
|
|
switchStationMode(stationCode) {
|
|
|
|
this.$emit('switchStationMode', stationCode);
|
2020-07-28 11:14:06 +08:00
|
|
|
},
|
|
|
|
// 点击大屏预览
|
2020-07-22 13:30:56 +08:00
|
|
|
goBigScreen() {
|
|
|
|
const routeData = this.$router.resolve({
|
2020-07-22 14:19:58 +08:00
|
|
|
path:`/displayBigScreen/${this.$route.query.mapId}`,
|
2020-07-22 13:30:56 +08:00
|
|
|
query:{
|
|
|
|
lineCode: this.$route.query.lineCode,
|
|
|
|
mapId:this.$route.query.mapId,
|
|
|
|
group:this.$route.query.group,
|
|
|
|
prdType: '07',
|
2020-07-22 14:19:58 +08:00
|
|
|
try:0,
|
|
|
|
noPreLogout: true
|
2020-07-22 13:30:56 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
window.open(routeData.href, '_blank', 'noopener noreferrer');
|
2020-09-16 10:10:13 +08:00
|
|
|
},
|
|
|
|
// 点击ibp预览
|
|
|
|
goIbp() {
|
|
|
|
const routeData = this.$router.resolve({
|
|
|
|
path:`/ibpShow`,
|
|
|
|
query:{
|
|
|
|
lineCode: this.$route.query.lineCode,
|
|
|
|
mapId:this.$route.query.mapId,
|
|
|
|
group:this.$route.query.group
|
|
|
|
}
|
|
|
|
});
|
|
|
|
window.open(routeData.href, '_blank', 'noopener noreferrer');
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
.schema {
|
2020-08-14 17:52:14 +08:00
|
|
|
z-index: 34;
|
2020-01-06 18:39:44 +08:00
|
|
|
display: inline;
|
|
|
|
position: absolute;
|
2020-07-29 10:27:02 +08:00
|
|
|
right: 5px;
|
2020-01-06 18:39:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.schema .el-radio-group .el-radio-button__inner {
|
|
|
|
padding: 0px 15px 0px 15px;
|
|
|
|
height: 32px;
|
|
|
|
line-height: 32px;
|
|
|
|
font-size: 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* /deep/ .el-button+ .el-button {
|
|
|
|
margin-left: 0px;
|
|
|
|
} */
|
|
|
|
</style>
|