2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-09 16:57:07 +08:00
|
|
|
<div id="PlanSchedule" :style="{top: top+'px', height: height+'px'}">
|
|
|
|
<div class="left">
|
|
|
|
<div :id="runPlanId" />
|
2019-07-26 13:32:43 +08:00
|
|
|
</div>
|
2019-08-13 15:54:26 +08:00
|
|
|
<div v-show="showTrain" class="position">
|
2019-08-09 16:57:07 +08:00
|
|
|
<data-table
|
|
|
|
ref="serviceTable"
|
2019-08-13 15:54:26 +08:00
|
|
|
:height="(height - 45)/2"
|
2019-08-09 16:57:07 +08:00
|
|
|
:config="serviceNumberConfig"
|
2019-08-13 15:54:26 +08:00
|
|
|
:style="{top: top-(height - 45)/2+'px'}"
|
2019-08-09 16:57:07 +08:00
|
|
|
@touch="scheduleTouch"
|
|
|
|
/>
|
|
|
|
<data-table
|
|
|
|
ref="tripTable"
|
|
|
|
:height="height/2"
|
|
|
|
:config="tripNumberConfig"
|
|
|
|
:style="{top: top-height/2+'px'}"
|
|
|
|
@touch="trainNumTouch"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-09 16:57:07 +08:00
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { timeFormat } from '@/utils/date';
|
2019-08-29 17:16:33 +08:00
|
|
|
import { getStationListBySkinCode, queryRunPlan } from '@/api/runplan';
|
2019-08-09 16:57:07 +08:00
|
|
|
import { loadMapData } from '@/utils/loaddata';
|
2019-08-13 15:54:26 +08:00
|
|
|
import { getPublishMapInfo } from '@/api/jmap/map';
|
2019-08-09 16:57:07 +08:00
|
|
|
import DataTable from './menus/components/dataTable';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
export default {
|
|
|
|
name: 'PlanSchedule',
|
|
|
|
components: {
|
|
|
|
DataTable
|
|
|
|
},
|
|
|
|
props: {
|
2019-08-29 17:16:33 +08:00
|
|
|
skinCode: {
|
2019-08-09 16:57:07 +08:00
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
2019-09-04 11:28:24 +08:00
|
|
|
// planConvert: {
|
|
|
|
// type: Object,
|
|
|
|
// required: true
|
|
|
|
// },
|
2019-08-09 16:57:07 +08:00
|
|
|
maxWidth: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
maxHeight: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2019-09-04 11:28:24 +08:00
|
|
|
planConvert: null,
|
2019-08-09 16:57:07 +08:00
|
|
|
top: 0,
|
|
|
|
height: 0,
|
2019-08-13 15:54:26 +08:00
|
|
|
mapName: '',
|
2019-08-09 16:57:07 +08:00
|
|
|
runPlanId: 'plan-tool',
|
|
|
|
myChart: null,
|
2019-08-13 15:54:26 +08:00
|
|
|
showTrain: false,
|
2019-08-09 16:57:07 +08:00
|
|
|
serviceNumberConfig: {
|
|
|
|
data: [],
|
2019-08-13 15:54:26 +08:00
|
|
|
title: '表号',
|
|
|
|
showHeader: false,
|
2019-08-09 16:57:07 +08:00
|
|
|
highlightCurrentRow: true,
|
|
|
|
handleChange: this.serviceNumberChange,
|
|
|
|
showClose: false,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
prop: 'serviceNumber',
|
|
|
|
label: '表号'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
tripNumberConfig: {
|
|
|
|
data: [],
|
2019-08-13 15:54:26 +08:00
|
|
|
title: '车次号',
|
|
|
|
showHeader: false,
|
2019-08-09 16:57:07 +08:00
|
|
|
highlightCurrentRow: true,
|
|
|
|
handleChange: this.tripNumberChange,
|
|
|
|
showClose: false,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
prop: 'tripNumber',
|
|
|
|
label: '车次号'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
realData: {},
|
|
|
|
kmRangeCoordMap: {},
|
|
|
|
option: {
|
2019-08-13 15:54:26 +08:00
|
|
|
title: { // 标题
|
2019-08-09 16:57:07 +08:00
|
|
|
text: '',
|
2019-08-13 15:54:26 +08:00
|
|
|
left: 'center', // 居中对齐
|
|
|
|
top: '10px'
|
2019-08-09 16:57:07 +08:00
|
|
|
},
|
2019-08-13 15:54:26 +08:00
|
|
|
grid: { // 整个坐标系位置
|
|
|
|
top: '50px',
|
2019-08-09 16:57:07 +08:00
|
|
|
left: '120px',
|
2019-08-13 15:54:26 +08:00
|
|
|
right: '80px',
|
2019-08-09 16:57:07 +08:00
|
|
|
bottom: '60px',
|
|
|
|
containLabel: true,
|
|
|
|
backgroundColor: 'floralwhite'
|
|
|
|
},
|
2019-08-13 15:54:26 +08:00
|
|
|
toolbox: { // 工具栏
|
|
|
|
top: '10px',
|
|
|
|
right: '120px',
|
2019-08-09 16:57:07 +08:00
|
|
|
feature: {
|
|
|
|
dataZoom: {
|
|
|
|
yAxisIndex: 'none'
|
|
|
|
},
|
|
|
|
restore: {},
|
|
|
|
saveAsImage: {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tooltip: {
|
|
|
|
axisPointer: {
|
|
|
|
trigger: 'item',
|
|
|
|
type: 'cross'
|
|
|
|
},
|
|
|
|
formatter: this.axisTooltip,
|
|
|
|
borderWidth: 1
|
|
|
|
},
|
|
|
|
xAxis: [
|
|
|
|
{
|
|
|
|
type: 'category',
|
|
|
|
boundaryGap: false,
|
|
|
|
data: [],
|
|
|
|
axisLine: {
|
|
|
|
onZero: false,
|
|
|
|
lineStyle: {
|
2019-08-13 15:54:26 +08:00
|
|
|
width: 1
|
|
|
|
// color: '#d14a61'
|
2019-08-09 16:57:07 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
formatter: this.xAxisLableFormat,
|
|
|
|
textStyle: {
|
|
|
|
color: '#333'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
axisPointer: {
|
|
|
|
snap: true,
|
|
|
|
label: {
|
|
|
|
formatter: this.xAxisPointFormat,
|
|
|
|
backgroundColor: 'rgb(255,0,0,0.5)',
|
|
|
|
color: 'white'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
yAxis: {
|
|
|
|
type: 'value',
|
|
|
|
splitLine: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
onZero: false,
|
|
|
|
lineStyle: {
|
2019-08-13 15:54:26 +08:00
|
|
|
width: 1
|
|
|
|
// color: '#d14a61'
|
2019-08-09 16:57:07 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
interval: 'auto',
|
|
|
|
formatter: this.yAxisLableFormat
|
|
|
|
},
|
|
|
|
axisPointer: {
|
|
|
|
xAxisIndex: 'all',
|
|
|
|
label: {
|
|
|
|
formatter: this.yAxisPointFormat,
|
|
|
|
backgroundColor: 'rgb(0,100,0,0.5)',
|
|
|
|
color: 'white'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
min: 0,
|
|
|
|
max: 0
|
|
|
|
},
|
|
|
|
series: [],
|
2019-08-13 15:54:26 +08:00
|
|
|
dataZoom: [ // 滑动滚轮
|
2019-08-09 16:57:07 +08:00
|
|
|
{
|
|
|
|
type: 'inside'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fiterMode: 'filter',
|
|
|
|
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
|
|
|
|
handleSize: '80%',
|
|
|
|
handleStyle: {
|
|
|
|
color: '#fff',
|
|
|
|
shadowBlur: 3,
|
|
|
|
shadowColor: 'rgba(0, 0, 0, 0.6)',
|
|
|
|
shadowOffsetX: 2,
|
|
|
|
shadowOffsetY: 2
|
|
|
|
},
|
2019-08-13 15:54:26 +08:00
|
|
|
bottom: '20px'
|
2019-08-09 16:57:07 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
absoluteTime: 2 * 3600,
|
|
|
|
indexKmRangeMap: {}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('runPlan', [
|
|
|
|
'stations'
|
|
|
|
]),
|
|
|
|
planId() {
|
|
|
|
return this.$route.query.planId;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
maxWidth() {
|
|
|
|
this.setPosition();
|
|
|
|
},
|
|
|
|
maxHeight() {
|
|
|
|
this.setPosition();
|
|
|
|
},
|
|
|
|
'$store.state.runPlan.planSizeCount': function () {
|
|
|
|
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
|
|
|
|
},
|
2019-08-09 18:29:08 +08:00
|
|
|
'$store.state.runPlan.refreshCount': function() {
|
|
|
|
this.loadChartPage();
|
|
|
|
},
|
2019-08-09 16:57:07 +08:00
|
|
|
$route() {
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
this.loadChartPage();
|
|
|
|
});
|
2019-08-09 16:57:07 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2019-09-02 15:37:57 +08:00
|
|
|
this.setPosition();
|
2019-08-09 16:57:07 +08:00
|
|
|
this.loadChartPage();
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
this.destroy();
|
|
|
|
},
|
|
|
|
methods: {
|
2019-08-13 15:54:26 +08:00
|
|
|
displayTrain() {
|
|
|
|
this.showTrain = !this.showTrain;
|
|
|
|
},
|
2019-08-09 16:57:07 +08:00
|
|
|
serviceNumberChange(row) {
|
|
|
|
let serviceNumber = null;
|
|
|
|
let serviceObj = {};
|
|
|
|
if (row) {
|
|
|
|
serviceNumber = row.serviceNumber;
|
|
|
|
serviceObj = this.$store.state.runPlan.editData[row.serviceNumber] || {};
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-13 15:54:26 +08:00
|
|
|
const op = this.myChart.getOption();
|
|
|
|
op.series.forEach((item, index) => {
|
|
|
|
item.lineStyle.color = '#000';
|
|
|
|
if (item.name == serviceNumber) {
|
|
|
|
item.lineStyle.color = 'red';
|
|
|
|
}
|
|
|
|
if (item.name == 'trainLabel') {
|
|
|
|
item.data = [];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.myChart.setOption(op);
|
|
|
|
}
|
2019-08-09 16:57:07 +08:00
|
|
|
this.$store.dispatch('runPlan/setSelected', { serviceNumber: serviceNumber, tripNumber: null });
|
|
|
|
this.analyticalTripNumber(serviceObj.trainMap || {});
|
|
|
|
},
|
|
|
|
tripNumberChange(row) {
|
|
|
|
const serviceNumber = this.$store.state.runPlan.selected.serviceNumber;
|
|
|
|
let tripNumber = null;
|
|
|
|
if (row) {
|
2019-08-13 15:54:26 +08:00
|
|
|
const data = [];
|
2019-08-09 16:57:07 +08:00
|
|
|
tripNumber = row.tripNumber;
|
2019-08-13 15:54:26 +08:00
|
|
|
const op = this.myChart.getOption();
|
|
|
|
op.series.forEach(item => {
|
|
|
|
if (item.name == serviceNumber) {
|
|
|
|
item.data.forEach(nor => {
|
|
|
|
if (nor[3] == tripNumber) {
|
|
|
|
data.push(nor);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.myChart && this.myChart.setOption({ series:
|
|
|
|
{
|
|
|
|
name: 'trainLabel',
|
|
|
|
lineStyle: {
|
|
|
|
color: 'green'
|
|
|
|
},
|
|
|
|
type: 'line',
|
|
|
|
data: data
|
|
|
|
}
|
|
|
|
});
|
2019-08-09 16:57:07 +08:00
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
this.$store.dispatch('runPlan/setSelected', { serviceNumber: serviceNumber, tripNumber: tripNumber });
|
|
|
|
},
|
|
|
|
async analyticalServiceNumber(data) {
|
|
|
|
this.serviceNumberConfig.data = Object.keys(data || {})
|
|
|
|
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
|
|
|
|
.map(serviceNumber => { return { serviceNumber }; });
|
|
|
|
},
|
|
|
|
async analyticalTripNumber(data) {
|
|
|
|
this.tripNumberConfig.data = Object.keys(data || {})
|
|
|
|
.sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; })
|
|
|
|
.map(tripNumber => { return { tripNumber }; });
|
|
|
|
},
|
|
|
|
async setPosition() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
let top = 3;
|
2019-08-13 15:54:26 +08:00
|
|
|
const width = this.maxWidth;
|
2019-08-09 16:57:07 +08:00
|
|
|
let height = this.maxHeight;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
const titleBar = document.getElementById('PlanTitleBar');
|
|
|
|
const menuBar = document.getElementById('PlanMenuBar');
|
|
|
|
const menuTool = document.getElementById('PlanMenuTool');
|
|
|
|
const statusBar = document.getElementById('PlanStatusBar');
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
if (titleBar) {
|
|
|
|
top += (titleBar.offsetHeight || 0);
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
if (menuBar) {
|
|
|
|
top += (menuBar.offsetHeight || 0);
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
if (menuTool) {
|
|
|
|
top += (menuTool.offsetHeight || 0);
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
if (statusBar) {
|
|
|
|
height -= (statusBar.offsetHeight || 0);
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
height = height - top;
|
|
|
|
this.$store.dispatch('runPlan/resize', { width, height });
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
if (this.top != top) {
|
|
|
|
this.top = top;
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
if (this.height != height) {
|
|
|
|
this.height = height - 20 * 2;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
async loadChartPage() {
|
|
|
|
try {
|
2019-08-13 15:54:26 +08:00
|
|
|
getPublishMapInfo(this.$route.query.mapId).then(resp => {
|
|
|
|
this.mapName = `${resp.data.name} (${this.$route.query.planName || ''})`;
|
|
|
|
});
|
2019-09-04 11:28:24 +08:00
|
|
|
this.planConvert = this.$theme.loadPlanConvert(this.skinCode);
|
|
|
|
this.$store.dispatch('runPlan/clear').then(() => {
|
2019-08-09 16:57:07 +08:00
|
|
|
this.loadInitChart().then(() => {
|
2019-09-04 11:28:24 +08:00
|
|
|
if (this.skinCode) {
|
2019-08-29 17:16:33 +08:00
|
|
|
loadMapData(this.skinCode);
|
2019-09-04 11:28:24 +08:00
|
|
|
getStationListBySkinCode(this.$route.query.skinCode).then(resp => {
|
2019-08-09 16:57:07 +08:00
|
|
|
this.$store.dispatch('runPlan/setStations', resp.data).then(() => {
|
2019-09-04 11:28:24 +08:00
|
|
|
this.loadInitData();
|
|
|
|
if (this.planId) {
|
|
|
|
this.myChart && this.myChart.showLoading();
|
|
|
|
queryRunPlan(this.planId).then(rest => {
|
|
|
|
this.$store.dispatch('runPlan/setPlanData', rest.data).then(() => {
|
|
|
|
this.analyticalServiceNumber(this.$store.state.runPlan.editData);
|
|
|
|
this.loadChartData();
|
|
|
|
this.myChart && this.myChart.hideLoading();
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
2019-08-09 16:57:07 +08:00
|
|
|
this.myChart && this.myChart.hideLoading();
|
2019-09-04 11:28:24 +08:00
|
|
|
this.$messageBox('获取运行图数据失败');
|
2019-08-09 16:57:07 +08:00
|
|
|
});
|
2019-09-04 11:28:24 +08:00
|
|
|
}
|
2019-08-09 16:57:07 +08:00
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox('请求车站数据失败');
|
|
|
|
this.$store.dispatch('runPlan/setStations', []);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
this.$messageBox(`加载运行图数据失败`);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async loadChartData() {
|
|
|
|
try {
|
|
|
|
const stations = this.$store.state.runPlan.stations;
|
|
|
|
const planData = this.$store.state.runPlan.planData;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
this.viewDisabled = true;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
this.option.series = [];
|
2019-09-04 11:28:24 +08:00
|
|
|
this.kmRangeCoordMap = this.planConvert.convertStationsToMap(stations);
|
|
|
|
this.pushModels(this.option.series, [this.planConvert.initializeYaxis(this.stations)]);
|
|
|
|
this.pushModels(this.option.series, this.planConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 0.5, color: '#000' }));
|
|
|
|
await this.loadInitChart();
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
this.viewDisabled = false;
|
|
|
|
} catch (error) {
|
|
|
|
this.viewDisabled = false;
|
|
|
|
this.$messageBox(`加在运行图数据失败:${error.message}`);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async loadInitData() {
|
|
|
|
await this.xAxisInit();
|
|
|
|
await this.yAxisInit();
|
|
|
|
await this.loadInitChart();
|
|
|
|
},
|
|
|
|
pushModels(series, models) {
|
|
|
|
if (models && models.length) {
|
|
|
|
models.forEach(elem => {
|
|
|
|
if (elem) {
|
|
|
|
series.push(elem);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
return series;
|
|
|
|
},
|
|
|
|
popModels(series, models) {
|
|
|
|
if (models && models.length) {
|
|
|
|
models.forEach(elem => {
|
|
|
|
const index = series.indexOf(elem);
|
|
|
|
if (index >= 0) {
|
|
|
|
series.split(index, 1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
return series;
|
|
|
|
},
|
|
|
|
loadInitChart() {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
try {
|
|
|
|
const that = this;
|
|
|
|
// 加载echart配置
|
|
|
|
require.config(
|
|
|
|
{
|
|
|
|
paths: {
|
|
|
|
echarts: './js/dist'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
// 按需加载所需图表,如需动态类型切换功能,别忘了同时加载相应图表
|
|
|
|
require(
|
|
|
|
[
|
|
|
|
'echarts',
|
|
|
|
'echarts/lib/chart/line'
|
|
|
|
],
|
|
|
|
function (ec) {
|
|
|
|
if (that.myChart && that.myChart.isDisposed) {
|
|
|
|
that.myChart.clear();
|
|
|
|
}
|
2019-08-13 15:54:26 +08:00
|
|
|
if (that.$route.query.planName) {
|
|
|
|
that.option.title.text = that.mapName;
|
|
|
|
}
|
2019-08-09 16:57:07 +08:00
|
|
|
that.myChart = ec.init(document.getElementById(that.runPlanId));
|
|
|
|
that.myChart.setOption(that.option);
|
|
|
|
that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height });
|
|
|
|
that.myChart.on('click', that.mouseClick);
|
|
|
|
resolve(true);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
} catch (error) {
|
|
|
|
reject(error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
xAxisPointFormat(params) {
|
|
|
|
return timeFormat(params.value);
|
|
|
|
},
|
|
|
|
yAxisPointFormat(params) {
|
2019-09-04 11:28:24 +08:00
|
|
|
return this.planConvert.computedFormatYAxis(this.stations, params);
|
2019-08-09 16:57:07 +08:00
|
|
|
},
|
|
|
|
xAxisLableFormat(value, index) {
|
|
|
|
if (value % 60 === 0) {
|
|
|
|
return timeFormat(value);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
yAxisLableFormat(value, index) {
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
xAxisInit() {
|
|
|
|
const list = [];
|
2019-09-04 11:28:24 +08:00
|
|
|
for (var time = 0 + this.planConvert.TranslationTime; time < 3600 * 24 + this.planConvert.TranslationTime; time++) {
|
2019-08-09 16:57:07 +08:00
|
|
|
list.push(time);
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
const startValue = 3600 * 6;
|
|
|
|
const offsetTime = 3600 * 1;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
this.option.xAxis[0].data = list;
|
|
|
|
if (!this.option.dataZoom[0].startValue) {
|
|
|
|
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
if (!this.option.dataZoom[0].endValue) {
|
|
|
|
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
yAxisInit() {
|
2019-09-04 11:28:24 +08:00
|
|
|
if (Object.keys(this.planConvert).length) {
|
|
|
|
this.pushModels(this.option.series, [this.planConvert.initializeYaxis(this.stations)]);
|
|
|
|
this.option.yAxis.min = this.planConvert.computedYaxisMinValue(this.stations);
|
|
|
|
this.option.yAxis.max = this.planConvert.computedYaxisMaxValue(this.stations);
|
2019-08-09 16:57:07 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
axisTooltip(param) {
|
2019-09-04 11:28:24 +08:00
|
|
|
const station = this.stations[Math.floor((param.data[1] - this.planConvert.EdgeHeight) / this.planConvert.CoordMultiple)] || { name: '', kmRange: '' };
|
2019-08-09 16:57:07 +08:00
|
|
|
return [
|
|
|
|
`Point Data <hr size=1 style="margin: 3px 0">`,
|
|
|
|
`车站名称: ${station.name}<br>`,
|
|
|
|
`车站公里标: ${station.kmRange} km <br>`,
|
2019-09-04 11:28:24 +08:00
|
|
|
`到站时间: ${timeFormat(param.data[0] + this.planConvert.TranslationTime)} (${param.data[0]})<br>`
|
2019-08-09 16:57:07 +08:00
|
|
|
].join('');
|
|
|
|
},
|
|
|
|
mouseClick(params) {
|
|
|
|
const model = {
|
|
|
|
serviceNumber: params.seriesName
|
|
|
|
};
|
2019-08-13 15:54:26 +08:00
|
|
|
|
|
|
|
const op = this.myChart.getOption();
|
|
|
|
op.series.forEach(item => {
|
|
|
|
item.lineStyle.color = '#000';
|
|
|
|
if (item.name == params.seriesName) {
|
|
|
|
item.lineStyle.color = 'red';
|
|
|
|
}
|
|
|
|
if (item.name == 'trainLabel') {
|
|
|
|
item.data = [];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.myChart.setOption(op);
|
2019-08-09 16:57:07 +08:00
|
|
|
this.$store.dispatch('runPlan/setSelected', model);
|
2019-08-13 15:54:26 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
},
|
|
|
|
reSize(opt) {
|
|
|
|
if (this.myChart) {
|
|
|
|
this.myChart.resize({
|
|
|
|
width: opt.width,
|
|
|
|
height: opt.height,
|
|
|
|
silent: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
destroy() {
|
|
|
|
if (this.myChart && this.myChart.isDisposed) {
|
|
|
|
this.myChart.dispose();
|
|
|
|
this.myChart = null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
scheduleTouch() {
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
},
|
|
|
|
trainNumTouch() {
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-09 16:57:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
2019-08-09 16:57:07 +08:00
|
|
|
<style scoped rel="stylesheet/scss" lang="scss">
|
2019-07-26 13:32:43 +08:00
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
|
|
|
#PlanSchedule {
|
2019-09-04 11:28:24 +08:00
|
|
|
z-index: 0;
|
2019-07-26 13:32:43 +08:00
|
|
|
position: absolute;
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
.left {
|
|
|
|
height: 100%;
|
2019-08-13 15:54:26 +08:00
|
|
|
width: 100%;
|
2019-07-26 13:32:43 +08:00
|
|
|
float: left;
|
|
|
|
}
|
|
|
|
|
2019-08-13 15:54:26 +08:00
|
|
|
.position {
|
|
|
|
position: absolute;
|
|
|
|
top: 2px;
|
|
|
|
right: 50px;
|
|
|
|
width: 220px;
|
|
|
|
height: calc(100% - 45px);
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
|
|
|
}
|
2019-08-09 16:57:07 +08:00
|
|
|
</style>
|