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

410 lines
16 KiB
Vue
Raw Normal View History

<template>
<div style="height:100%">
2020-11-13 13:31:44 +08:00
<div class="schema" :style="{top: offset+'px'}">
2020-12-16 13:25:55 +08:00
<!--<el-select v-if="showSelectStation" v-model="chiShowStation" style="width: 100px;" size="small" @change="switchStationMode">-->
2020-12-24 15:33:06 +08:00
<!--<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />-->
2020-12-16 13:25:55 +08:00
<!--</el-select>-->
<el-select v-if="isAdmin && isSystemAdmin" 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>
<el-button-group>
2022-06-30 14:55:18 +08:00
<el-button v-if="userRole=== 'STATION_SUPERVISOR'&&$route.query.lineCode ==='16'" size="small" @click="goCtc">车务终端</el-button>
2022-06-29 15:57:24 +08:00
<el-button v-if="$route.query.lineCode ==='16'&&$store.state.training.prdType === '01'" size="small" @click="showTrainTicket">路票</el-button>
2022-08-03 14:37:59 +08:00
<el-button v-if="showRegisterBookBtn" size="small" @click="showRegisterBook">簿册</el-button>
2022-06-28 15:04:00 +08:00
<el-button v-if="showDispatcherStation" size="small" @click="changeShowMap">调度台</el-button>
2022-06-30 14:55:18 +08:00
<el-button v-if="ibpShow" size="small" @click="goIbp">IBP盘</el-button>
<el-button v-if="userRole=== 'DISPATCHER' && !$route.query.projectDevice && hasBigScreen" size="small" @click="goBigScreen">大屏</el-button>
2022-01-19 17:23:25 +08:00
<el-button v-if="(userRole==='DISPATCHER' || userRole=== 'STATION_SUPERVISOR') && !$route.query.projectDevice && iscsShow" size="small" @click="goIscs">ISCS</el-button>
2022-04-22 19:13:44 +08:00
<el-button v-if="running && !dataError && $route.query.type !== 'ILW' && !datie" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
<template v-if="isAdmin">
2022-04-22 19:13:44 +08:00
<el-button v-if="!running && !dataError && $route.query.type !== 'ILW' && !datie" size="small" type="warning" @click="loadRunPlan">
{{ $t('joinTraining.runGraphLoading') }}</el-button><!-- -->
</template>
</el-button-group>
<el-button v-if="(isAdmin || $route.query.type === 'ILW') && !dataError && !isScreen" size="small" :type="faultMode ? '' : 'primary' " @click="changeOperateMode()">{{ faultMode?' 切换到普通模式[Tab]':'切换到故障模式[Tab]' }}</el-button>
2022-06-27 13:09:22 +08:00
<!-- isCenter && !dataError && !isAdmin 此判断用于以后(目前 暂时不用) -->
<el-button v-if="isShowDirective" size="small" :type="directiveMode ? 'primary' : ''" @click="changeDirectiveMode()">{{ directiveMode? '切换到普通模式[Tab]':'切换到指令模式[Tab]' }}</el-button>
</div>
<!-- running && -->
<join-run-plan-view v-if="!dataError" ref="runPlanView" :group="group" />
2020-09-16 14:26:04 +08:00
<select-ibp ref="selectIbp" />
2022-06-27 18:08:25 +08:00
<train-ticket ref="trainTicket" />
2022-06-30 09:04:44 +08:00
<register-book ref="registerBook" />
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { getByGroupStationList } from '@/api/jmap/map';
import { getSessionStorage } from '@/utils/auth';
import JoinRunPlanView from '@/views/newMap/displayNew/demon/runPlanView';
2020-09-16 14:26:04 +08:00
import SelectIbp from '@/views/newMap/displayNew/demon/selectIbp';
2020-09-21 10:17:37 +08:00
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';
import { queryHasIscs } from '@/api/iscs';
2022-06-28 13:06:21 +08:00
import { getToken } from '@/utils/auth';
2022-06-29 15:57:24 +08:00
import TrainTicket from '../trainTicket/index';
2022-06-30 09:04:44 +08:00
import RegisterBook from '../registerBook/index';
export default {
name: 'MenuDemonSchema',
components:{
2020-09-16 14:26:04 +08:00
JoinRunPlanView,
2022-04-22 19:13:44 +08:00
SelectIbp,
2022-06-30 09:04:44 +08:00
TrainTicket,
RegisterBook
},
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-09-21 10:17:37 +08:00
},
deviceCode: {
type: String,
default() {
return '';
}
}
},
data() {
return {
mode: OperateMode.NORMAL,
OperateMode: OperateMode,
viewDisabled: true,
realData: {},
series: [],
chiShowStation: '',
2021-03-17 13:35:15 +08:00
kmRangeMap: {},
runPlanData: {},
userId: '',
faultMode: false,
2020-08-04 10:03:06 +08:00
directiveMode: false,
firstLoad: true,
iscsShow:false,
speedList:[
{ 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倍速' }
],
speed: 1
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
...mapGetters('map', [
'bigScreenConfig'
]),
2020-08-05 15:12:40 +08:00
running() {
return this.$store.state.training.started;
},
2022-06-24 14:57:20 +08:00
datie() {
2022-06-24 16:23:21 +08:00
return this.$route.query.lineCode == '16';
2022-06-24 14:57:20 +08:00
},
isScreen() {
return this.$store.state.training.prdType === '07';
},
2020-11-09 11:31:20 +08:00
project() {
return getSessionStorage('project');
2020-11-13 13:31:44 +08:00
},
isShowDirective() { // 哈尔滨项目 行调设备显示
return this.$route.query.type == 'CW' && this.project == 'heb';
},
hasBigScreen() {
return this.bigScreenConfig.bigScreenSplitConfig && this.bigScreenConfig.bigScreenSplitConfig.length;
},
isSystemAdmin() {
return this.$store.state.user.roles.includes('04') || this.$store.state.user.roles.includes('05');
2022-06-28 15:04:00 +08:00
},
showDispatcherStation() {
return this.$route.query.lineCode === '16' && this.$store.state.training.prdType === '02';
2022-06-30 14:55:18 +08:00
},
ibpShow() {
const lineCodeList = ['08', '16'];
return this.userRole === 'STATION_SUPERVISOR' && !this.$route.query.projectDevice && !lineCodeList.includes(this.$route.query.lineCode);
2022-08-03 14:37:59 +08:00
},
showRegisterBookBtn() {
const roleList = ['STATION_SUPERVISOR', 'STATION_ASSISTANT', 'STATION_SIGNALER', 'STATION_SWITCH_MAN', 'STATION_MASTER', 'STATION_WORKER', 'DEVICE_MANAGER'];
return this.$route.query.lineCode === '16' && roleList.includes(this.$store.state.training.userRole);
}
},
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.socket.simulationPlanChange': function (val) {
// 判断是否已经加载运行图,若加载只处理运行图数据,否则,缓存数据
if (JSON.stringify(this.$store.state.runPlan.planData) == '{}') {
this.$store.dispatch('runPlan/setUpdateTrainRpData', val);
} else {
this.$store.dispatch('runPlan/updateTrainRunplan', val);
}
},
// '$store.state.map.mapDataLoadedCount': function () {
// this.loadRunData(this.$route.query);
// },
'$store.state.training.subscribeCount': function () {
2020-09-03 14:44:16 +08:00
this.loadRunData(this.$route.query);
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;
this.firstLoad = false;
if (JSON.stringify(this.$store.state.runPlan.updateTrainRpData) != '{}') {
this.$store.dispatch('runPlan/updateTrainRunplan', this.$store.state.runPlan.updateTrainRpData);
this.$store.dispatch('runPlan/setUpdateTrainRpData', {});
}
}
},
async mounted() {
this.userId = this.$store.state.user.id;
EventBus.$on('CheckFaultModeEvent', () => {
if ((this.isAdmin || this.$route.query.type === 'ILW') && !this.dataError && !this.isScreen) {
this.changeOperateMode();
}
if (this.isShowDirective) {
this.changeDirectiveMode();
}
});
queryHasIscs({mapId: this.$route.query.mapId}).then(resp => {
if (resp.data) {
this.iscsShow = true;
} else {
this.iscsShow = false;
}
}).catch(() => {
this.$message.error('查询ISCS数据异常');
});
},
methods: {
loadRunData(opt) {
this.$store.dispatch('runPlan/clear').then(resp => {
if (opt && opt.mapId) {
this.viewDisabled = true;
getByGroupStationList(this.$route.query.group).then(response => {
const stations = response.data;
this.$store.dispatch('runPlan/setStations', stations).then(() => {
2020-12-24 15:33:06 +08:00
loadRunPlanData(this.group, this.dataError);
});
}).catch(() => {
this.$messageBox(this.$t('error.obtainStationListFailed'));
});
}
});
},
// initPlannedDriving(isDisable) {
// this.isDisable = isDisable;
// },
changeOperateMode() {
this.faultMode = !this.faultMode;
let mode = OperateMode.NORMAL;
if (this.faultMode) {
mode = OperateMode.FAULT;
}
this.$store.dispatch('training/changeOperateMode', { mode: mode });
},
2022-06-28 13:06:21 +08:00
goCtc() {
const routeData = this.$router.resolve({
path:'/displayNew/demon',
query:{
lineCode:this.$route.query.lineCode,
group: this.$route.query.group,
prdType: '01',
mapId:this.$route.query.mapId,
project: this.project,
newApi: false,
2022-07-18 13:07:45 +08:00
joint: true,
2022-06-28 13:06:21 +08:00
ctc: true,
try: this.$route.query.try || 0,
token:getToken(),
noPreLogout: true
}
});
window.open(routeData.href, '_blank');
},
changeDirectiveMode() { // 调整指令模式
this.directiveMode = !this.directiveMode;
let mode = OperateMode.NORMAL;
if (this.directiveMode) {
mode = OperateMode.DIRECTIVE;
}
this.$store.dispatch('training/changeOperateMode', { mode: mode });
},
setFault() {
this.$emit('faultChooseShow');
},
loadRunPlan() {
this.$emit('runPlanLoadShow');
},
viewRunPlan() {
if (this.$route.query.type === 'CW') {
const routeData = this.$router.resolve({
path:`/runPlanViewWindow`,
query:{
lineCode: this.$route.query.lineCode,
mapId:this.$route.query.mapId,
group:this.$route.query.group,
initTime: this.$store.state.training.initTime,
noPreLogout: true
}
});
2021-03-13 00:20:59 +08:00
window.open(routeData.href, '_blank');
} else {
this.$refs.runPlanView.doShow();
}
},
// 选择车站
2020-07-24 18:38:19 +08:00
switchStationMode(stationCode) {
this.$emit('switchStationMode', stationCode);
},
// 点击大屏预览
goBigScreen() {
const routeData = this.$router.resolve({
path:`/displayBigScreen/${this.$route.query.mapId}`,
query:{
lineCode: this.$route.query.lineCode,
mapId:this.$route.query.mapId,
group:this.$route.query.group,
prdType: '07',
try:0,
noPreLogout: true
}
});
2021-03-13 00:20:59 +08:00
window.open(routeData.href, '_blank');
},
goIscs() {
const routeData = this.$router.resolve({
path:`/displayIscs/system`,
query:{
lineCode: this.$route.query.lineCode,
mapId: this.$route.query.mapId,
group: this.$route.query.group,
noPreLogout: true
}
});
2021-03-13 00:20:59 +08:00
window.open(routeData.href, '_blank');
},
speedChange(val) {
timesSpeedPlayback(this.$route.query.group, val).then(resp => {
this.$message.success(`设置${val}倍速成功!`);
}).catch(e => {
this.$message.error('设置倍速失败!');
});
},
2022-06-27 13:09:22 +08:00
showTrainTicket() {
2022-06-27 18:08:25 +08:00
this.$refs.trainTicket.doShow();
2022-06-24 14:57:20 +08:00
},
2022-06-30 09:04:44 +08:00
showRegisterBook() {
this.$refs.registerBook.doShow();
},
2022-06-28 15:04:00 +08:00
changeShowMap() {
this.$emit('changeShowMap', false);
},
// 点击ibp预览
goIbp() {
2020-09-16 14:26:04 +08:00
// this.$refs.selectIbp.doShow();
2020-09-21 10:17:37 +08:00
getIbpInfoByStation(this.$route.query.mapId, this.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: this.deviceCode,
loadAll: true,
noPreLogout: true
}
});
2021-03-13 00:20:59 +08:00
window.open(routeData.href, '_blank');
2020-09-21 10:17:37 +08:00
} else {
this.$messageBox('本车站暂无IBP盘数据');
}
}).catch((error) => {
if (error.code == '10007') {
2020-09-21 10:17:37 +08:00
this.$messageBox('本车站暂无IBP盘数据');
} else {
this.$message.error('获取IBP盘数据异常');
}
});
2020-09-21 10:17:37 +08:00
}
}
};
</script>
<style>
.schema {
2020-12-16 09:40:37 +08:00
z-index: 18;
display: inline;
position: absolute;
2020-07-29 10:27:02 +08:00
right: 5px;
}
.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>