rt-sim-training-client/src/views/newMap/newMapdraft/dataRelation/index.vue

300 lines
9.4 KiB
Vue
Raw Normal View History

2019-11-29 12:51:58 +08:00
<template>
<transition name="el-zoom-in-center">
<div class="map-control">
<div class="joylink-card">
<div class="clearfix">
<span>
{{ $t('map.mapName') }}
<b>{{ mapInfo.name }}</b>
</span>
<el-button type="text" class="mapEdit_box" @click="previewRouteEvent">{{ $t('map.preview') }}</el-button>
<el-button type="text" class="mapEdit_box" @click="createRouteEvent">{{ $t('map.newConstruction') }}</el-button>
<el-button type="text" class="mapEdit_box" @click="drawMap">{{ $t('map.drawMap') }}</el-button>
<el-button type="text" class="mapEdit_box" @click="showMap">{{ $t('map.viewLayer') }}</el-button>
</div>
<el-tabs v-model="enabledTab" type="card" class="map_card" @tab-click="changePane">
2019-12-18 13:21:07 +08:00
<el-tab-pane :label="$t('map.continueProtect')" class="tab_pane_box" name="protect">
<protect-operate
ref="protectOperate"
2019-12-10 10:18:25 +08:00
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
2019-12-18 13:21:07 +08:00
<el-tab-pane :label="$t('map.routeID')" class="tab_pane_box" name="route">
<route-operate
ref="routeOperate"
2019-11-29 12:51:58 +08:00
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
2019-12-11 13:56:46 +08:00
<el-tab-pane label="自动折返" class="tab_pane_box" name="turned">
2019-12-10 17:55:43 +08:00
<turned-operate
ref="trunedOperate"
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
2019-12-10 16:50:38 +08:00
</el-tab-pane>
2019-11-29 12:51:58 +08:00
<el-tab-pane :label="$t('map.automaticSignal')" class="tab_pane_box" name="automatic">
<automatic-operate
ref="automaticOperate"
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
2019-12-10 18:11:11 +08:00
<el-tab-pane :label="$t('map.signalApprochSection')" class="tab_pane_box" name="signal">
2019-11-29 12:51:58 +08:00
<signal-operate
ref="signalOperate"
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane :label="$t('map.pathUnit')" class="tab_pane_box" name="path">
<path-operate
ref="pathOperate"
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane :label="$t('map.routing')" class="tab_pane_box" name="routing">
<routing-operate
ref="routingOperate"
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
</el-tabs>
</div>
</div>
</transition>
</template>
<script>
import RouteOperate from './routeoperate/index';
import RoutingOperate from './routingoperate/index';
import AutomaticOperate from './automaticoperate/index';
import PathOperate from './pathoperate/index';
import SignalOperate from './signaloperate/index';
2019-12-10 10:18:25 +08:00
import ProtectOperate from './protectoperate/index';
2019-12-10 16:50:38 +08:00
import TurnedOperate from './turnedoperate/index';
2019-11-29 12:51:58 +08:00
export default {
name: 'DataRelation',
components: {
RouteOperate,
RoutingOperate,
AutomaticOperate,
PathOperate,
2019-12-10 10:18:25 +08:00
SignalOperate,
2019-12-10 16:50:38 +08:00
ProtectOperate,
TurnedOperate
2019-11-29 12:51:58 +08:00
},
props: {
selected: {
type: Object,
default: function () {
return null;
}
},
mapInfo: {
type: Object,
default: function() { return {name: this.$t('map.pleaseSelectMap')}; }
}
},
data() {
return {
2019-12-18 13:21:07 +08:00
enabledTab: 'protect',
2019-12-13 14:46:38 +08:00
oldDevice: null
2019-11-29 12:51:58 +08:00
};
},
mounted() {
},
methods: {
showMap() {
this.$emit('showMap');
},
createRouteEvent() {
switch (this.enabledTab) {
2019-12-10 10:18:25 +08:00
case 'protect':
this.$refs.protectOperate.createRouteEvent();
break;
2019-11-29 12:51:58 +08:00
case 'route':
this.$refs.routeOperate.createRouteEvent();
break;
case 'routing':
this.$refs.routingOperate.createRouteEvent();
break;
case 'automatic':
this.$refs.automaticOperate.createRouteEvent();
break;
case 'signal':
this.$refs.signalOperate.createRouteEvent();
break;
case 'path':
this.$refs.pathOperate.createRouteEvent();
break;
2019-12-11 13:56:46 +08:00
case 'turned':
this.$refs.trunedOperate.createRouteEvent();
break;
2019-11-29 12:51:58 +08:00
}
},
previewRouteEvent() {
switch (this.enabledTab) {
2019-12-10 10:18:25 +08:00
case 'protect':
this.$refs.protectOperate.previewRouteEvent();
break;
2019-11-29 12:51:58 +08:00
case 'route':
this.$refs.routeOperate.previewRouteEvent();
break;
case 'routing':
this.$refs.routingOperate.previewRouteEvent();
break;
case 'automatic':
this.$refs.automaticOperate.previewRouteEvent();
break;
case 'signal':
this.$refs.signalOperate.previewRouteEvent();
break;
case 'path':
this.$refs.pathOperate.previewRouteEvent();
break;
2019-12-11 13:56:46 +08:00
case 'turned':
this.$refs.trunedOperate.previewRouteEvent();
break;
2019-11-29 12:51:58 +08:00
}
},
changePane(data) {
this.enabledTab = data.name;
},
setSelected(selected) {
2019-12-13 14:46:38 +08:00
this.handleHightLight(selected);
2019-11-29 12:51:58 +08:00
switch (this.enabledTab) {
2019-12-10 10:18:25 +08:00
case 'protect':
this.$refs.protectOperate.setSelected(selected);
break;
2019-11-29 12:51:58 +08:00
case 'route':
this.$refs.routeOperate.setSelected(selected);
break;
case 'routing':
this.$refs.routingOperate.setSelected(selected);
break;
case 'automatic':
this.$refs.automaticOperate.setSelected(selected);
break;
case 'signal':
this.$refs.signalOperate.setSelected(selected);
break;
case 'path':
this.$refs.pathOperate.setSelected(selected);
break;
2019-12-11 13:56:46 +08:00
case 'turned':
this.$refs.trunedOperate.setSelected(selected);
break;
2019-11-29 12:51:58 +08:00
}
},
setCenter(code) {
this.$emit('setCenter', code);
},
drawMap() {
this.$emit('selectView', 'draft');
2019-12-13 14:46:38 +08:00
},
handleHightLight(selected) {
if (this.oldDevice && (this.oldDevice._type === 'Section' || this.oldDevice._type === 'Psd') && this.oldDevice.instance && typeof this.oldDevice.instance.drawSelected === 'function') {
if (this.isSwitchSection) {
if (this.oldDevice._type == 'Section' && this.oldDevice.type == '04') {
this.oldDevice.relevanceSectionList.forEach(item => {
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
sectionModel.instance.drawSelected(false);
});
this.isSwitchSection = false;
}
}
this.oldDevice.instance.drawSelected(false);
}
if (selected && (selected._type === 'Section' || selected._type === 'Psd') && selected.instance && typeof selected.instance.drawSelected === 'function' ) {
if (selected._type == 'Section' && selected.type == '04') {
this.isSwitchSection = true;
selected.relevanceSectionList.forEach(item => {
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
sectionModel.instance.drawSelected(true);
});
}
selected.instance.drawSelected(true);
}
this.oldDevice = selected;
2019-11-29 12:51:58 +08:00
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.map-context {
display: block;
float: left;
margin-left: 5px;
}
.map-control {
float: right;
width: 100%;
height: 100%;
.clearfix{
height: 47px;
padding: 15px;
}
.joylink-card{
height: 100%;
}
}
.mapEdit_box{
float: right;
padding: 3px 0;
margin-right: 5px;
}
.map_card {
height: calc(100% - 47px);
.tab_pane_box{
height: 100%;
}
}
.physical-view {
line-height: 25px;
height: 118px;
padding-left: 12px;
.el-checkbox {
width: 70px;
margin: 0;
margin-right: 30px;
}
}
/deep/ {
.map_card .el-tabs__header .el-tabs__item.is-active {
border-bottom-color: #f5f7fa;
background: #f5f7fa;
}
.map_card .el-tabs__content{
height: calc(100% - 56px);
}
}
/deep/ .map-draft-group {
float: right;
margin: 10px 5px;
}
/deep/ {
.view-control {
overflow-y: auto;
}
}
</style>