2020-03-31 19:06:23 +08:00
|
|
|
<template>
|
2020-07-14 16:07:43 +08:00
|
|
|
<div class="menuTrainListOut" :class="{'xian_01' : lineCode == '11', 'active': drawer}">
|
|
|
|
<div class="menuTrainListBtn" @click="clickBtn">
|
|
|
|
<i class="el-icon-more" />
|
2020-04-01 12:53:58 +08:00
|
|
|
</div>
|
2020-07-14 16:07:43 +08:00
|
|
|
<div :show-close="false" class="menuTrainList_box" style="height: 100%;">
|
2020-05-28 18:38:49 +08:00
|
|
|
<div v-if="lineCode=='10'||lineCode=='11'" class="menuTrainList">
|
2020-05-29 09:16:35 +08:00
|
|
|
<div class="bottomTrainListInfo">下行列车详细信息</div>
|
|
|
|
<el-table :data="bottomTrainList" height="45%" :highlight-current-row="true" @row-click="selectTrain">
|
2020-05-28 18:38:49 +08:00
|
|
|
<el-table-column property="groupNumber" label="车组号" width="70" />
|
|
|
|
<el-table-column property="tripNumber" label="车次号" width="70" />
|
|
|
|
<el-table-column property="destinationCode" label="目的地号" width="100" />
|
|
|
|
<el-table-column property="serviceNumber" label="表号" width="70" />
|
|
|
|
<el-table-column property="dt" label="早晚点" width="70">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<div>{{ covert(scope.row.dt) }}</div>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
<div class="topTrainListInfo">上行列车详细信息</div>
|
|
|
|
<el-table :data="topTrainList" height="45%" :highlight-current-row="true" style="border-radius:0px 0px 0px 5px;" @row-click="selectTrain">
|
|
|
|
<el-table-column property="groupNumber" label="车组号" width="70" />
|
|
|
|
<el-table-column property="tripNumber" label="车次号" width="70" />
|
|
|
|
<el-table-column property="destinationCode" label="目的地号" width="100" />
|
|
|
|
<el-table-column property="serviceNumber" label="表号" width="70" />
|
|
|
|
<el-table-column property="dt" label="早晚点" width="70">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<div>{{ covert(scope.row.dt) }}</div>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
</div>
|
|
|
|
<div v-else class="menuTrainList">
|
|
|
|
<el-table :data="trainList" height="100%" :highlight-current-row="true" style="border-radius:5px 0px 0px 5px;" @row-click="selectTrain">
|
2020-04-01 12:53:58 +08:00
|
|
|
<el-table-column property="groupNumber" label="车组号" width="130" />
|
|
|
|
<el-table-column property="tripNumber" label="车次号" width="130" />
|
2020-05-28 18:38:49 +08:00
|
|
|
<el-table-column property="serviceNumber" label="表号" width="130" />
|
2020-04-01 12:53:58 +08:00
|
|
|
</el-table>
|
|
|
|
</div>
|
2020-04-01 15:32:06 +08:00
|
|
|
</div>
|
2020-03-31 19:06:23 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
2020-07-02 17:44:20 +08:00
|
|
|
import { mapGetters } from 'vuex';
|
2020-03-31 19:06:23 +08:00
|
|
|
export default {
|
2020-04-01 12:53:58 +08:00
|
|
|
name: 'MenuTrainList',
|
2020-03-31 19:06:23 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2020-04-01 12:53:58 +08:00
|
|
|
drawer: false,
|
2020-03-31 19:06:23 +08:00
|
|
|
trainList:[],
|
2020-05-28 18:38:49 +08:00
|
|
|
oldDevice: null,
|
|
|
|
topTrainList:[],
|
|
|
|
bottomTrainList:[]
|
2020-03-31 19:06:23 +08:00
|
|
|
};
|
|
|
|
},
|
2020-05-26 15:59:11 +08:00
|
|
|
computed: {
|
2020-07-02 17:44:20 +08:00
|
|
|
...mapGetters('map', [
|
|
|
|
'map',
|
|
|
|
'mapConfig'
|
|
|
|
]),
|
2020-05-26 15:59:11 +08:00
|
|
|
lineCode() {
|
|
|
|
return this.$route.query.lineCode;
|
|
|
|
}
|
|
|
|
},
|
2020-03-31 19:06:23 +08:00
|
|
|
watch:{
|
2020-06-02 18:30:12 +08:00
|
|
|
'$store.state.map.activeTrainListUpdate': function (val) {
|
2020-06-17 15:31:15 +08:00
|
|
|
if (val) {
|
2020-06-22 14:29:55 +08:00
|
|
|
const activeTrainList = this.$store.state.map.activeTrainList;
|
2020-06-17 15:31:15 +08:00
|
|
|
if (this.lineCode == '10' || this.lineCode == '11') {
|
2020-06-22 14:29:55 +08:00
|
|
|
this.topTrainList = [];
|
|
|
|
this.bottomTrainList = [];
|
|
|
|
activeTrainList.forEach((trainCode)=>{
|
2020-06-17 18:36:22 +08:00
|
|
|
// train.serviceNumber != '' && train.serviceNumber != undefined &&
|
2020-06-22 14:29:55 +08:00
|
|
|
const train = this.$store.getters['map/getDeviceByCode'](trainCode);
|
2020-07-02 17:44:20 +08:00
|
|
|
let isUpDirection;
|
2020-07-17 18:28:38 +08:00
|
|
|
if (this.mapConfig.upRight) {
|
2020-07-02 17:44:20 +08:00
|
|
|
isUpDirection = train.right;
|
2020-07-17 18:28:38 +08:00
|
|
|
} else if (!this.mapConfig.upRight) {
|
2020-07-02 17:44:20 +08:00
|
|
|
isUpDirection = !train.right;
|
|
|
|
}
|
|
|
|
if (train && isUpDirection && train.sectionCode) {
|
2020-06-22 14:29:55 +08:00
|
|
|
this.topTrainList.push(train);
|
2020-07-02 17:44:20 +08:00
|
|
|
} else if (train && !isUpDirection && train.sectionCode) {
|
2020-06-22 14:29:55 +08:00
|
|
|
this.bottomTrainList.push(train);
|
|
|
|
}
|
2020-06-17 15:31:15 +08:00
|
|
|
});
|
|
|
|
} else {
|
2020-06-22 14:29:55 +08:00
|
|
|
this.trainList = [];
|
|
|
|
activeTrainList.forEach((trainCode)=>{
|
|
|
|
const train = this.$store.getters['map/getDeviceByCode'](trainCode);
|
|
|
|
if (train && train.sectionCode) {
|
|
|
|
this.trainList.push(train);
|
|
|
|
}
|
2020-06-17 15:31:15 +08:00
|
|
|
});
|
|
|
|
}
|
2020-05-28 18:38:49 +08:00
|
|
|
} else {
|
2020-06-17 15:31:15 +08:00
|
|
|
this.topTrainList = [];
|
|
|
|
this.bottomTrainList = [];
|
|
|
|
this.trainList = [];
|
2020-05-28 18:38:49 +08:00
|
|
|
}
|
2020-03-31 19:06:23 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2020-04-01 12:53:58 +08:00
|
|
|
},
|
|
|
|
methods:{
|
|
|
|
clickBtn() {
|
|
|
|
if (this.drawer) {
|
|
|
|
this.drawer = false;
|
|
|
|
} else {
|
|
|
|
this.drawer = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selectTrain(row, column, event) {
|
|
|
|
this.setCenter(row.code);
|
|
|
|
},
|
|
|
|
// 设置显示中心
|
|
|
|
setCenter(code) {
|
|
|
|
this.$emit('setCenter', code);
|
2020-05-28 18:38:49 +08:00
|
|
|
},
|
|
|
|
covert(data) {
|
2020-06-22 14:29:55 +08:00
|
|
|
const absData = Math.abs(data);
|
|
|
|
const hours = Math.floor(absData / 3600);
|
|
|
|
let min = Math.floor((absData % 3600) / 60);
|
|
|
|
let seconds = (absData % 3600) % 60;
|
2020-05-28 18:38:49 +08:00
|
|
|
min = min > 9 ? min : '0' + min;
|
|
|
|
seconds = seconds > 9 ? seconds : '0' + seconds;
|
2020-06-22 14:29:55 +08:00
|
|
|
const time = hours + ':' + min + ':' + seconds;
|
|
|
|
return data == 0 ? '00:00:00' : (data > 0 ? time + 'E' : time + 'L');
|
2020-04-01 12:53:58 +08:00
|
|
|
}
|
2020-03-31 19:06:23 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
2020-07-14 16:07:43 +08:00
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
.menuTrainListOut{
|
2020-04-01 12:53:58 +08:00
|
|
|
position: absolute;
|
2020-07-14 16:07:43 +08:00
|
|
|
right: 0;
|
|
|
|
top: 15%;
|
|
|
|
height: 70%;
|
|
|
|
transform: translateX(400px);
|
|
|
|
transition: all 0.4s;
|
|
|
|
&.active{
|
|
|
|
transform: translateX(0px);
|
|
|
|
}
|
2020-04-01 12:53:58 +08:00
|
|
|
}
|
|
|
|
.menuTrainListBtn{
|
2020-05-28 18:38:49 +08:00
|
|
|
width: 20px;
|
2020-04-01 12:53:58 +08:00
|
|
|
height: 40px;
|
|
|
|
background: #fff;
|
|
|
|
text-align: center;
|
|
|
|
border-radius: 6px 0px 0px 6px;
|
|
|
|
position: absolute;
|
|
|
|
top: 45%;
|
|
|
|
z-index: 2;
|
2020-07-14 16:07:43 +08:00
|
|
|
transform: translateX(-20px);
|
|
|
|
cursor: pointer;
|
|
|
|
.el-icon-more{
|
|
|
|
font-size: 20px;
|
|
|
|
margin-top: 9px;
|
|
|
|
transform-origin: 50% 50%;
|
|
|
|
transform: rotate(90deg);
|
|
|
|
margin-left:0px;
|
|
|
|
}
|
2020-04-01 12:53:58 +08:00
|
|
|
}
|
2020-07-14 16:07:43 +08:00
|
|
|
.menuTrainList_box{
|
|
|
|
height: 100%;
|
|
|
|
.menuTrainList{
|
|
|
|
width: 400px;
|
|
|
|
height: 100%;
|
|
|
|
border-radius: 10px 0px 0px 10px;
|
|
|
|
background: #fff;
|
|
|
|
}
|
2020-03-31 19:06:23 +08:00
|
|
|
}
|
2020-07-14 16:07:43 +08:00
|
|
|
|
|
|
|
.topTrainListInfo,
|
|
|
|
.bottomTrainListInfo{
|
2020-05-28 18:38:49 +08:00
|
|
|
padding: 10px 10px;
|
|
|
|
background: #cde2ef;
|
|
|
|
font-size: 13px;
|
|
|
|
border-radius: 5px 0px 0px 0px;
|
|
|
|
}
|
2020-03-31 19:06:23 +08:00
|
|
|
</style>
|