增加AUSTool绘制区域功能
This commit is contained in:
parent
bdeb030276
commit
d3ea1cd22e
@ -87,7 +87,7 @@ export function modifyRpArea(areaNo, data) {
|
|||||||
/**
|
/**
|
||||||
* 删除区域
|
* 删除区域
|
||||||
*/
|
*/
|
||||||
export function deleteRpArea(areaNo) {
|
export function delRpArea(areaNo) {
|
||||||
return request({
|
return request({
|
||||||
url: `/api/rpTools/${areaNo}/area`,
|
url: `/api/rpTools/${areaNo}/area`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, prefixTime, convertSheetToList } from '@/utils/runPlan';
|
import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, prefixTime, convertSheetToList } from '@/utils/runPlan';
|
||||||
|
import { toTimeStamp } from '@/utils/date';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/** 边缘高度*/
|
/** 边缘高度*/
|
||||||
@ -11,8 +12,52 @@ export default {
|
|||||||
TranslationTime: 0,
|
TranslationTime: 0,
|
||||||
|
|
||||||
/** 将后台数据解析成图形*/
|
/** 将后台数据解析成图形*/
|
||||||
|
parseDataToGraph(chart, planData, stations, kmRangeCoordMap) {
|
||||||
|
const graphs = [];
|
||||||
|
if (planData &&
|
||||||
|
planData.areaList &&
|
||||||
|
planData.areaList.length) {
|
||||||
|
planData.areaList.forEach(el => {
|
||||||
|
const startTime = toTimeStamp(el.startTime);
|
||||||
|
const endTime = toTimeStamp(el.endTime);
|
||||||
|
|
||||||
|
const fartherKm = this.getCoordYByObj(stations, kmRangeCoordMap, {stationCode: el.fartherStationCode});
|
||||||
|
const closerKm = this.getCoordYByObj(stations, kmRangeCoordMap, {stationCode: el.closerStationCode});
|
||||||
|
const point1 = [ startTime, fartherKm];
|
||||||
|
const point2 = [ endTime, closerKm]
|
||||||
|
const position = chart.convertToPixel('grid', point1);
|
||||||
|
const position2 = chart.convertToPixel('grid', point2)
|
||||||
|
const width = Math.abs(position[0] - position2[0]);
|
||||||
|
const height = Math.abs(position[1] - position2[1]);
|
||||||
|
|
||||||
|
graphs.push({
|
||||||
|
type: 'rect',
|
||||||
|
subType: 'Area',
|
||||||
|
areaNo: el.areaNo,
|
||||||
|
position,
|
||||||
|
point1,
|
||||||
|
point2,
|
||||||
|
model: el,
|
||||||
|
shape: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
fill: 'rgb(255,0,0, 0.3)',
|
||||||
|
stroke: 'rgb(255, 0, 0, 0.8)'
|
||||||
|
},
|
||||||
|
z: 100
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return graphs;
|
||||||
|
},
|
||||||
|
|
||||||
/** 将后台数据解析成折线*/
|
/** 将后台数据解析成折线*/
|
||||||
parseDataToModels(planData, stations, kmRangeCoordMap) {
|
parseDataToSeries(chart, planData, stations, kmRangeCoordMap) {
|
||||||
var models = [];
|
var models = [];
|
||||||
/** 按车次遍历数据*/
|
/** 按车次遍历数据*/
|
||||||
if (planData && planData.length) {
|
if (planData && planData.length) {
|
||||||
@ -37,11 +82,11 @@ export default {
|
|||||||
/** 计算停站点坐标集合*/
|
/** 计算停站点坐标集合*/
|
||||||
trip.stationTimeList.forEach((elem,idx) => {
|
trip.stationTimeList.forEach((elem,idx) => {
|
||||||
if (elem.arrivalTime) {
|
if (elem.arrivalTime) {
|
||||||
opt.data.push([elem.arrivalTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]);
|
opt.data.push([elem.arrivalTime, this.getCoordYByObj(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem.departureTime) {
|
if (elem.departureTime) {
|
||||||
opt.data.push([elem.departureTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]);
|
opt.data.push([elem.departureTime, this.getCoordYByObj(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -53,7 +98,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/** 更新数据并解析成折线*/
|
/** 更新数据并解析成折线*/
|
||||||
updateDataToModels(planData, stations, kmRangeCoordMap, runPlanData, series) {
|
updateDataToModels(chart, planData, stations, kmRangeCoordMap, runPlanData, series) {
|
||||||
if (planData && planData.length) {
|
if (planData && planData.length) {
|
||||||
}
|
}
|
||||||
return series;
|
return series;
|
||||||
@ -109,7 +154,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/** 根据elem计算y值*/
|
/** 根据elem计算y值*/
|
||||||
getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial) {
|
getCoordYByObj(stations, kmRangeCoordMap, elem, directionCode, isSpecial) {
|
||||||
var defaultVlue = 0;
|
var defaultVlue = 0;
|
||||||
var station = stations.find(it => { return it.code == elem.stationCode; });
|
var station = stations.find(it => { return it.code == elem.stationCode; });
|
||||||
if (station) {
|
if (station) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan';
|
import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan';
|
||||||
|
import { toTimeStamp } from '@/utils/date';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/** 边缘高度*/
|
/** 边缘高度*/
|
||||||
@ -11,12 +12,44 @@ export default {
|
|||||||
TranslationTime: 0,
|
TranslationTime: 0,
|
||||||
|
|
||||||
/** 将后台数据解析成图形*/
|
/** 将后台数据解析成图形*/
|
||||||
parseDataToGraph(planData, stations) {
|
parseDataToGraph(chart, planData, stations, kmRangeCoordMap) {
|
||||||
const graphs = [];
|
const graphs = [];
|
||||||
if (planData &&
|
if (planData &&
|
||||||
planData.areaList &&
|
planData.areaList &&
|
||||||
planData.areaList.length) {
|
planData.areaList.length) {
|
||||||
planData.areaList.forEach(el => {
|
planData.areaList.forEach(el => {
|
||||||
|
const startTime = toTimeStamp(el.startTime);
|
||||||
|
const endTime = toTimeStamp(el.endTime);
|
||||||
|
|
||||||
|
const fartherKm = this.getCoordYByObj(stations, kmRangeCoordMap, {stationCode: el.fartherStationCode});
|
||||||
|
const closerKm = this.getCoordYByObj(stations, kmRangeCoordMap, {stationCode: el.closerStationCode});
|
||||||
|
const point1 = [ startTime, fartherKm];
|
||||||
|
const point2 = [ endTime, closerKm]
|
||||||
|
const position = chart.convertToPixel('grid', point1);
|
||||||
|
const position2 = chart.convertToPixel('grid', point2)
|
||||||
|
const width = Math.abs(position[0] - position2[0]);
|
||||||
|
const height = Math.abs(position[1] - position2[1]);
|
||||||
|
|
||||||
|
graphs.push({
|
||||||
|
type: 'rect',
|
||||||
|
subType: 'Area',
|
||||||
|
areaNo: el.areaNo,
|
||||||
|
position,
|
||||||
|
point1,
|
||||||
|
point2,
|
||||||
|
model: el,
|
||||||
|
shape: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
fill: 'rgb(255,0,0, 0.3)',
|
||||||
|
stroke: 'rgb(255, 0, 0, 0.8)'
|
||||||
|
},
|
||||||
|
z: 100
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +57,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/** 将后台数据解析成折线*/
|
/** 将后台数据解析成折线*/
|
||||||
parseDataToModels(planData, stations, kmRangeCoordMap) {
|
parseDataToSeries(chart, planData, stations, kmRangeCoordMap) {
|
||||||
const models = [];
|
const models = [];
|
||||||
if (planData &&
|
if (planData &&
|
||||||
planData.serviceList &&
|
planData.serviceList &&
|
||||||
@ -52,7 +85,7 @@ export default {
|
|||||||
|
|
||||||
trip.stationTimeList.forEach((elem,idx) => {
|
trip.stationTimeList.forEach((elem,idx) => {
|
||||||
if (elem.arrivalTime) {
|
if (elem.arrivalTime) {
|
||||||
opt.data.push([elem.arrivalTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), {
|
opt.data.push([elem.arrivalTime, this.getCoordYByObj(stations, kmRangeCoordMap, elem), {
|
||||||
stationCode: elem.stationCode,
|
stationCode: elem.stationCode,
|
||||||
serviceNo: el.serviceNo,
|
serviceNo: el.serviceNo,
|
||||||
tripNo: trip.tripNo,
|
tripNo: trip.tripNo,
|
||||||
@ -61,7 +94,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (elem.departureTime) {
|
if (elem.departureTime) {
|
||||||
opt.data.push([elem.departureTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), {
|
opt.data.push([elem.departureTime, this.getCoordYByObj(stations, kmRangeCoordMap, elem), {
|
||||||
stationCode: elem.stationCode,
|
stationCode: elem.stationCode,
|
||||||
serviceNo: el.serviceNo,
|
serviceNo: el.serviceNo,
|
||||||
tripNo: trip.tripNo,
|
tripNo: trip.tripNo,
|
||||||
@ -81,7 +114,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/** 更新数据并解析成折线*/
|
/** 更新数据并解析成折线*/
|
||||||
updateDataToModels(planData, stations, kmRangeCoordMap, runPlanData, series, lineStyle) {
|
updateDataToModels(chart, planData, stations, kmRangeCoordMap, series) {
|
||||||
if (planData && planData.length) {
|
if (planData && planData.length) {
|
||||||
}
|
}
|
||||||
return series;
|
return series;
|
||||||
@ -129,25 +162,8 @@ export default {
|
|||||||
return yText;
|
return yText;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/
|
|
||||||
computedReentryNumber(code) {
|
|
||||||
// return parseInt(code || 1) % 2 ? 1 : 2;
|
|
||||||
return 1;
|
|
||||||
},
|
|
||||||
|
|
||||||
/** 根据方向计算y折返偏移量*/
|
|
||||||
getYvalueByDirectionCode(defaultVlue, directionCode, num) {
|
|
||||||
if (directionCode === '1') {
|
|
||||||
defaultVlue += this.EdgeHeight / 2 * num;
|
|
||||||
} else if (directionCode === '2') {
|
|
||||||
defaultVlue -= this.EdgeHeight / 2 * num;
|
|
||||||
}
|
|
||||||
|
|
||||||
return defaultVlue;
|
|
||||||
},
|
|
||||||
|
|
||||||
/** 根据elem计算y值*/
|
/** 根据elem计算y值*/
|
||||||
getCoordYByElem(stations, kmRangeCoordMap, elem) {
|
getCoordYByObj(stations, kmRangeCoordMap, elem) {
|
||||||
var defaultVlue = 0;
|
var defaultVlue = 0;
|
||||||
var station = stations.find(it => { return it.code == elem.stationCode; });
|
var station = stations.find(it => { return it.code == elem.stationCode; });
|
||||||
if (station) {
|
if (station) {
|
||||||
|
@ -128,11 +128,7 @@ export const DeviceMenu = {
|
|||||||
SetDriver: '106',
|
SetDriver: '106',
|
||||||
Script: '107',
|
Script: '107',
|
||||||
IscsSystem: '108',
|
IscsSystem: '108',
|
||||||
IscsInterface: '109',
|
IscsInterface: '109'
|
||||||
|
|
||||||
planJustRunning: '1000',
|
|
||||||
planJustDeparture: '1001',
|
|
||||||
planSetParams: '1002'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
import { MenuEnum } from '../utils.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -29,6 +29,10 @@ export default {
|
|||||||
default() {
|
default() {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
config: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -38,8 +42,8 @@ export default {
|
|||||||
this.stations[this.selected.dataIndex].kmRange -
|
this.stations[this.selected.dataIndex].kmRange -
|
||||||
this.stations[this.selected.dataIndex+1].kmRange
|
this.stations[this.selected.dataIndex+1].kmRange
|
||||||
)
|
)
|
||||||
const min = Math.floor(offset / 19.4);
|
const min = Math.floor(offset / (this.config.maxSpeed * 1000/3600));
|
||||||
const max = Math.floor(offset / 8.3);
|
const max = Math.floor(offset / 1);
|
||||||
|
|
||||||
if (value < min) {
|
if (value < min) {
|
||||||
callback(new Error('Below minimum run time.'));
|
callback(new Error('Below minimum run time.'));
|
||||||
@ -69,7 +73,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$store.state.menuOperation.menuCount': function (val) {
|
'$store.state.menuOperation.menuCount': function (val) {
|
||||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.planJustRunning)) {
|
if (this.$store.getters['menuOperation/checkDialogIsOpen'](MenuEnum.planJustRunning)) {
|
||||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||||
} else {
|
} else {
|
||||||
this.doClose();
|
this.doClose();
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
import { MenuEnum } from '../utils.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -29,12 +29,16 @@ export default {
|
|||||||
default() {
|
default() {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
config: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
var validator = (rule, value, callback) => {
|
var validator = (rule, value, callback) => {
|
||||||
if (value > 0 && value <= 15) {
|
if (value > 0 && value <= this.config.minStopTime) {
|
||||||
callback(new Error('Stop time cannot be within 0-15 seconds.'));
|
callback(new Error(`Stop time cannot be within 0-${this.config.minStopTime} seconds.`));
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
@ -59,7 +63,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$store.state.menuOperation.menuCount': function (val) {
|
'$store.state.menuOperation.menuCount': function (val) {
|
||||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.planJustDeparture)) {
|
if (this.$store.getters['menuOperation/checkDialogIsOpen'](MenuEnum.planJustDeparture)) {
|
||||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||||
} else {
|
} else {
|
||||||
this.doClose();
|
this.doClose();
|
||||||
|
158
src/views/planMonitor/editToolAUS/dialog/planModifyArea.vue
Normal file
158
src/views/planMonitor/editToolAUS/dialog/planModifyArea.vue
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-dialogDrag append-to-body title="Modification of train diagram parameters" :visible.sync="dialogShow" width="30%" :close-on-click-modal="false" :before-close="doClose">
|
||||||
|
<el-form ref="form" label-width="160px" :model="formModel" :rules="rules">
|
||||||
|
<el-form-item label="Start station" prop="startStationCode">
|
||||||
|
<el-select v-model="formModel.startStationCode" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="(el,i) in stations"
|
||||||
|
:key="i"
|
||||||
|
:label="el.name"
|
||||||
|
:value="el.code">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="End station" prop="endStationCode">
|
||||||
|
<el-select v-model="formModel.endStationCode" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="(el,i) in stations"
|
||||||
|
:key="i"
|
||||||
|
:label="el.name"
|
||||||
|
:value="el.code">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Start time" prop="startTime">
|
||||||
|
<el-time-picker value-format="HH:mm:ss" v-model="formModel.startTime" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="End time" prop="endTime">
|
||||||
|
<el-time-picker value-format="HH:mm:ss" v-model="formModel.endTime" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
|
||||||
|
<el-button type="primary" @click="doConfirm">{{ $t('map.confirm') }}</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { MenuEnum } from '../utils.js';
|
||||||
|
import { getRpConfig } from '@/api/rpTools';
|
||||||
|
import { toTimeStamp } from '@/utils/date';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
stations: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
target: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
var startTimeValidator = (rule, value, callback) => {
|
||||||
|
const startTime = toTimeStamp(value);
|
||||||
|
const endTime = toTimeStamp(this.formModel.endTime);
|
||||||
|
if (startTime >= endTime) {
|
||||||
|
callback(new Error('The start time is greater than the end time.'));
|
||||||
|
} else if (Math.abs(startTime - endTime) < 10*60) {
|
||||||
|
callback(new Error('The time interval shall not be less than 10 min.'));
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var endTimeValidator = (rule, value, callback) => {
|
||||||
|
const startTime = toTimeStamp(this.formModel.startTime);
|
||||||
|
const endTime = toTimeStamp(value);
|
||||||
|
if (endTime <= startTime) {
|
||||||
|
callback(new Error('The end time is less than the start time.'));
|
||||||
|
} else if (Math.abs(startTime - endTime) < 10*60) {
|
||||||
|
callback(new Error('The time interval shall not be less than 10 min.'));
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
dialogShow: false,
|
||||||
|
formModel: {
|
||||||
|
areaNo: '',
|
||||||
|
startStationCode: '',
|
||||||
|
endStationCode: '',
|
||||||
|
startTime: 0,
|
||||||
|
endTime: 0
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
startStationCode: [
|
||||||
|
{
|
||||||
|
required: true, message: 'Please select the farther station.', trigger: 'blur'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
endStationCode: [
|
||||||
|
{
|
||||||
|
required: true, message: 'Please select the closer station.', trigger: 'blur'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
startTime: [
|
||||||
|
{
|
||||||
|
required: true, message: 'Please select the start time.', trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: startTimeValidator, trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
endTime: [
|
||||||
|
{
|
||||||
|
required: true, message: 'Please select the end time.', trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: endTimeValidator, trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$store.state.menuOperation.menuCount': function (val) {
|
||||||
|
if (this.$store.getters['menuOperation/checkDialogIsOpen'](MenuEnum.planModifyArea)) {
|
||||||
|
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||||
|
} else {
|
||||||
|
this.doClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
doShow() {
|
||||||
|
if (this.target &&
|
||||||
|
this.target.model) {
|
||||||
|
const model = this.target.model;
|
||||||
|
this.formModel = {
|
||||||
|
areaNo: model.areaNo,
|
||||||
|
startStationCode: model.fartherStationCode,
|
||||||
|
endStationCode: model.closerStationCode,
|
||||||
|
startTime: model.startTime,
|
||||||
|
endTime: model.endTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.dialogShow = true;
|
||||||
|
},
|
||||||
|
doClose() {
|
||||||
|
this.dialogShow = false;
|
||||||
|
},
|
||||||
|
doConfirm() {
|
||||||
|
this.$refs.form.validate((valid) => {
|
||||||
|
if(valid) {
|
||||||
|
this.$emit('modifyArea', this.formModel);
|
||||||
|
this.doClose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -34,10 +34,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
import { MenuEnum } from '../utils.js';
|
||||||
import { getRpConfig } from '@/api/rpTools';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
props: {
|
||||||
|
config: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogShow: false,
|
dialogShow: false,
|
||||||
@ -87,7 +92,7 @@ export default {
|
|||||||
selected: function(val) {
|
selected: function(val) {
|
||||||
},
|
},
|
||||||
'$store.state.menuOperation.menuCount': function (val) {
|
'$store.state.menuOperation.menuCount': function (val) {
|
||||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.planSetParams)) {
|
if (this.$store.getters['menuOperation/checkDialogIsOpen'](MenuEnum.planSetParams)) {
|
||||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||||
} else {
|
} else {
|
||||||
this.doClose();
|
this.doClose();
|
||||||
@ -96,20 +101,15 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doShow() {
|
doShow() {
|
||||||
getRpConfig().then(resp => {
|
|
||||||
const data = resp.data;
|
|
||||||
this.formModel = {
|
this.formModel = {
|
||||||
averageSpeed: data.averageSpeed,
|
averageSpeed: this.config.averageSpeed,
|
||||||
maxSpeed: data.maxSpeed,
|
maxSpeed: this.config.maxSpeed,
|
||||||
stopTime: data.stopTime,
|
stopTime: this.config.stopTime,
|
||||||
minStopTime: data.minStopTime,
|
minStopTime: this.config.minStopTime,
|
||||||
minIntervalTime: data.minIntervalTime,
|
minIntervalTime: this.config.minIntervalTime,
|
||||||
turnBackTime: data.turnBackTime
|
turnBackTime: this.config.turnBackTime
|
||||||
}
|
}
|
||||||
this.dialogShow = true;
|
this.dialogShow = true;
|
||||||
}).catch(error => {
|
|
||||||
this.$message.info(error.message)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
doClose() {
|
doClose() {
|
||||||
this.dialogShow = false;
|
this.dialogShow = false;
|
||||||
|
@ -7,18 +7,17 @@
|
|||||||
:height="height"
|
:height="height"
|
||||||
:width="width"
|
:width="width"
|
||||||
:model="model"
|
:model="model"
|
||||||
@tag="handleTarget"
|
@tag="onTarget"
|
||||||
@select="handleSelected"
|
@select="onSelected"
|
||||||
@clear="handleClear"
|
@clear="onClear"
|
||||||
@create="handleCreate"
|
@create="onCreate"
|
||||||
@translate="handleTranslate"
|
@translate="onTranslate"
|
||||||
@edit="handleEdit"
|
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="menus-left">
|
<div class="menus-left">
|
||||||
<el-button type="primary" @click="doNewPlan">New</el-button>
|
<el-button type="primary" @click="doNewPlan">New</el-button>
|
||||||
<el-button type="primary" @click="handleDialog(DeviceMenu.planSetParams)">Set Param</el-button>
|
<el-button type="primary" @click="onDialog(DeviceMenu.planSetParams)">Set Param</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="menus-right">
|
<div class="menus-right">
|
||||||
<span style="font-size:22px;padding:0 17px;">Plan</span>
|
<span style="font-size:22px;padding:0 17px;">Plan</span>
|
||||||
@ -26,16 +25,17 @@
|
|||||||
:model="model"
|
:model="model"
|
||||||
:selected="selected"
|
:selected="selected"
|
||||||
:target="target"
|
:target="target"
|
||||||
@remove="handleRemove"
|
@remove="onRemove"
|
||||||
@clear="handleClear"
|
@clear="onClear"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</schedule>
|
</schedule>
|
||||||
<plan-just-running :selected="selected" :stations="stations" @justRunning="doJustRunning" />
|
<plan-just-running :config="config" :selected="selected" :stations="stations" @justRunning="doJustRunning" />
|
||||||
<plan-just-stop :selected="selected" :stations="stations" @justStop="doJustStop"/>
|
<plan-just-stop :config="config" :selected="selected" :stations="stations" @justStop="doJustStop"/>
|
||||||
<plan-set-params @setParams="doSetPlanParams" ref="planSetParams" />
|
<plan-set-params :config="config" @setParams="doSetPlanParams" />
|
||||||
|
<plan-modify-area :target="target" :stations="stations" @modifyArea="doModifyArea" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -44,16 +44,18 @@ import Schedule from './schedule.vue';
|
|||||||
import PlanJustRunning from './dialog/planJustRunning.vue';
|
import PlanJustRunning from './dialog/planJustRunning.vue';
|
||||||
import PlanJustStop from './dialog/planJustStop.vue';
|
import PlanJustStop from './dialog/planJustStop.vue';
|
||||||
import PlanSetParams from './dialog/planSetParams.vue';
|
import PlanSetParams from './dialog/planSetParams.vue';
|
||||||
|
import PlanModifyArea from './dialog/planModifyArea.vue';
|
||||||
import Menus from './menus.vue';
|
import Menus from './menus.vue';
|
||||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||||
|
import { timeFormat } from '@/utils/date';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { getStationList } from '@/api/runplan';
|
import { getStationList } from '@/api/runplan';
|
||||||
import {
|
import {
|
||||||
getRpTools, clearRpPlan, addRpTrip, delRpTrip,
|
getRpTools, clearRpPlan, addRpTrip, delRpTrip,
|
||||||
justTripNoRunning, justTripNoStop,
|
justTripNoRunning, justTripNoStop,
|
||||||
translateTripNo,
|
translateTripNo,
|
||||||
modifyRpConfig,
|
getRpConfig, modifyRpConfig,
|
||||||
createRpArea
|
createRpArea, modifyRpArea, delRpArea
|
||||||
} from '@/api/rpTools';
|
} from '@/api/rpTools';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -62,6 +64,7 @@ export default {
|
|||||||
PlanJustRunning,
|
PlanJustRunning,
|
||||||
PlanJustStop,
|
PlanJustStop,
|
||||||
PlanSetParams,
|
PlanSetParams,
|
||||||
|
PlanModifyArea,
|
||||||
Menus
|
Menus
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -75,6 +78,8 @@ export default {
|
|||||||
model: {
|
model: {
|
||||||
choice: 'Plan',
|
choice: 'Plan',
|
||||||
action: '',
|
action: '',
|
||||||
|
},
|
||||||
|
config: {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -121,7 +126,7 @@ export default {
|
|||||||
},
|
},
|
||||||
loadInitData() {
|
loadInitData() {
|
||||||
getStationList(this.mapId).then(resp => {
|
getStationList(this.mapId).then(resp => {
|
||||||
const stations = resp.data.filter(el => {
|
const stations = this.stations = resp.data.filter(el => {
|
||||||
return ['车辆段', '停车场'].findIndex(it => { return el.name.includes(it) }) < 0;
|
return ['车辆段', '停车场'].findIndex(it => { return el.name.includes(it) }) < 0;
|
||||||
});
|
});
|
||||||
this.$store.commit('rpTools/setStations', stations);
|
this.$store.commit('rpTools/setStations', stations);
|
||||||
@ -131,27 +136,40 @@ export default {
|
|||||||
const planData = rest.data;
|
const planData = rest.data;
|
||||||
this.$store.commit('rpTools/setPlanData', planData);
|
this.$store.commit('rpTools/setPlanData', planData);
|
||||||
this.$refs.schedule.loadChartData(planData);
|
this.$refs.schedule.loadChartData(planData);
|
||||||
|
getRpConfig().then(resm => {
|
||||||
|
const data = resm.data;
|
||||||
|
this.config = {
|
||||||
|
averageSpeed: data.averageSpeed,
|
||||||
|
maxSpeed: data.maxSpeed,
|
||||||
|
stopTime: data.stopTime,
|
||||||
|
minStopTime: data.minStopTime,
|
||||||
|
minIntervalTime: data.minIntervalTime,
|
||||||
|
turnBackTime: data.turnBackTime
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
this.$message.info(error.message)
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox(error.message);
|
this.$messageBox(error.message);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleClear() {
|
onClear() {
|
||||||
this.model.action = '';
|
this.model.action = '';
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.$refs.schedule.setLineReset();
|
this.$refs.schedule.setLineReset();
|
||||||
this.$refs.schedule.clearGraphic();
|
this.$refs.schedule.clearGraphic();
|
||||||
},
|
},
|
||||||
handleDialog(menu) {
|
onDialog(menu) {
|
||||||
this.$store.dispatch('menuOperation/setPopMenu', { position: {x: 0, y: 0}, menu });
|
this.$store.dispatch('menuOperation/setPopMenu', { position: {x: 0, y: 0}, menu });
|
||||||
},
|
},
|
||||||
handleTarget(target) {
|
onTarget(target) {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
},
|
},
|
||||||
handleSelected(selected) {
|
onSelected(selected) {
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
},
|
},
|
||||||
handleCreate(data) {
|
onCreate(data) {
|
||||||
switch(this.model.choice) {
|
switch(this.model.choice) {
|
||||||
case 'Plan':
|
case 'Plan':
|
||||||
this.doCreateTrip(data);
|
this.doCreateTrip(data);
|
||||||
@ -161,19 +179,14 @@ export default {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleEdit() {
|
onTranslate(data) {
|
||||||
},
|
|
||||||
handleTranslate(data) {
|
|
||||||
switch(this.model.choice) {
|
switch(this.model.choice) {
|
||||||
case 'Plan':
|
case 'Plan':
|
||||||
this.doTranslateTrip(data);
|
this.doTranslateTrip(data);
|
||||||
break;
|
break;
|
||||||
case 'Construction':
|
|
||||||
this.doTranslateArea(data);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleRemove(){
|
onRemove(){
|
||||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
@ -207,11 +220,38 @@ export default {
|
|||||||
},
|
},
|
||||||
doSetPlanParams(data) {
|
doSetPlanParams(data) {
|
||||||
modifyRpConfig(data).then(resp => {
|
modifyRpConfig(data).then(resp => {
|
||||||
|
this.config = data;
|
||||||
this.$message.success('Parameters of plan were modified successfully.');
|
this.$message.success('Parameters of plan were modified successfully.');
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
doModifyArea(data) {
|
||||||
|
const startTime = data.startTime;
|
||||||
|
const endTime = data.endTime;
|
||||||
|
const startCodeIndex = this.stations.findIndex(el => { return el.code == data.startStationCode; })
|
||||||
|
const endCodeIndex = this.stations.findIndex(el => { return el.code == data.endStationCode; })
|
||||||
|
|
||||||
|
const model = {
|
||||||
|
fartherStationCode: startCodeIndex < endCodeIndex? data.endStationCode: data.startStationCode,
|
||||||
|
closerStationCode: startCodeIndex < endCodeIndex? data.startStationCode: data.endStationCode,
|
||||||
|
startTime: data.startTime,
|
||||||
|
endTime: data.endTime
|
||||||
|
}
|
||||||
|
|
||||||
|
modifyRpArea(data.areaNo, model).then(resp => {
|
||||||
|
getRpTools().then(rest => {
|
||||||
|
const planData = rest.data;
|
||||||
|
this.$store.commit('rpTools/setPlanData', planData);
|
||||||
|
this.$refs.schedule.loadChartData(planData);
|
||||||
|
this.$message.success('Construction area modified successfully.');
|
||||||
|
}).catch(() => {
|
||||||
|
this.$messageBox('Failed to load the plan.');
|
||||||
|
});
|
||||||
|
}).catch(error => {
|
||||||
|
this.$message.info(error.message);
|
||||||
|
})
|
||||||
|
},
|
||||||
doJustRunning(time) {
|
doJustRunning(time) {
|
||||||
if (this.selected) {
|
if (this.selected) {
|
||||||
const model = {
|
const model = {
|
||||||
@ -253,7 +293,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
doCreateTrip(data) {
|
doCreateTrip(data) {
|
||||||
addRpTrip(data).then(resp => {
|
if (Math.abs(data.endTime - data.startTime) < 2*60) {
|
||||||
|
this.$refs.schedule.clearGraphic(['mark']);
|
||||||
|
this.$message.info('The time interval shall not be less than 2 min.')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const model = {
|
||||||
|
endStationCode: data.endStationCode,
|
||||||
|
startStationCode: data.startStationCode,
|
||||||
|
startTime: timeFormat(data.startTime),
|
||||||
|
endTime: timeFormat(data.endTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
addRpTrip(model).then(resp => {
|
||||||
getRpTools().then(rest => {
|
getRpTools().then(rest => {
|
||||||
const planData = rest.data;
|
const planData = rest.data;
|
||||||
this.$store.commit('rpTools/setPlanData', planData);
|
this.$store.commit('rpTools/setPlanData', planData);
|
||||||
@ -267,11 +320,22 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
doCreateArea(data) {
|
doCreateArea(data) {
|
||||||
|
const startTime = data.startTime;
|
||||||
|
const endTime = data.endTime;
|
||||||
|
const startCodeIndex = this.stations.findIndex(el => { return el.code == data.startStationCode; })
|
||||||
|
const endCodeIndex = this.stations.findIndex(el => { return el.code == data.endStationCode; })
|
||||||
|
|
||||||
|
if (Math.abs(endTime - startTime) < 10*60) {
|
||||||
|
this.$refs.schedule.clearGraphic(['mark']);
|
||||||
|
this.$message.info('The time interval shall not be less than 10 min.')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const model = {
|
const model = {
|
||||||
closerStationCode: data.startStationCode,
|
fartherStationCode: startCodeIndex < endCodeIndex? data.endStationCode: data.startStationCode,
|
||||||
fartherStationCode: data.endStationCode,
|
closerStationCode: startCodeIndex < endCodeIndex? data.startStationCode: data.endStationCode,
|
||||||
startTime: data.startTime,
|
startTime: endTime < startTime? timeFormat(data.endTime): timeFormat(data.startTime),
|
||||||
endTime: data.endTime,
|
endTime: endTime < startTime? timeFormat(data.startTime): timeFormat(data.endTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
createRpArea(model).then(resp => {
|
createRpArea(model).then(resp => {
|
||||||
@ -287,7 +351,7 @@ export default {
|
|||||||
this.$refs.schedule.clearGraphic(['mark']);
|
this.$refs.schedule.clearGraphic(['mark']);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
doTranslateTrip(data) {
|
doTranslateTrip() {
|
||||||
if (this.selected) {
|
if (this.selected) {
|
||||||
const model = {
|
const model = {
|
||||||
seconds : this.selected.time
|
seconds : this.selected.time
|
||||||
@ -305,10 +369,6 @@ export default {
|
|||||||
this.$message.info(error.message);
|
this.$message.info(error.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
doTranslateArea(data) {
|
|
||||||
if (this.selected) {
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
doRemoveTrip() {
|
doRemoveTrip() {
|
||||||
if (this.selected) {
|
if (this.selected) {
|
||||||
@ -317,7 +377,7 @@ export default {
|
|||||||
const planData = rest.data;
|
const planData = rest.data;
|
||||||
this.$store.commit('rpTools/setPlanData', planData);
|
this.$store.commit('rpTools/setPlanData', planData);
|
||||||
this.$refs.schedule.loadChartData(planData);
|
this.$refs.schedule.loadChartData(planData);
|
||||||
this.handleClear();
|
this.onClear();
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$messageBox('Failed to load the plan.');
|
this.$messageBox('Failed to load the plan.');
|
||||||
});
|
});
|
||||||
@ -327,7 +387,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
doRemoveArea() {
|
doRemoveArea() {
|
||||||
if (this.selected) {
|
if (this.target) {
|
||||||
|
delRpArea(this.target.areaNo).then(resp => {
|
||||||
|
getRpTools().then(rest => {
|
||||||
|
const planData = rest.data;
|
||||||
|
this.$store.commit('rpTools/setPlanData', planData);
|
||||||
|
this.$refs.schedule.loadChartData(planData);
|
||||||
|
this.onClear();
|
||||||
|
}).catch(() => {
|
||||||
|
this.$messageBox('Failed to load the plan.');
|
||||||
|
});
|
||||||
|
}).catch(error => {
|
||||||
|
this.$message.info(error.message);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="menus">
|
<div class="menus">
|
||||||
<el-select v-model="model.choice" placeholder="请选择功能类型" style="margin-right:20px">
|
<el-select v-model="model.choice" placeholder="请选择功能类型" style="margin-right:20px" @change="$emit('clear')">
|
||||||
<el-option v-for="(el,i) in options" :key="i" :label="el.label" :value="el.value" />
|
<el-option v-for="(el,i) in options" :key="i" :label="el.label" :value="el.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<div v-if="option">
|
<div v-if="option">
|
||||||
@ -93,10 +93,6 @@ export default {
|
|||||||
label: 'Add',
|
label: 'Add',
|
||||||
value: 'Add',
|
value: 'Add',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'Translate',
|
|
||||||
value: 'Translate'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Edit',
|
label: 'Edit',
|
||||||
value: 'Edit'
|
value: 'Edit'
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import echarts from 'echarts';
|
import echarts from 'echarts';
|
||||||
import * as utils from './utils'
|
import * as utils from './utils'
|
||||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
import { MenuEnum } from './utils';
|
||||||
import { timeFormat } from '@/utils/date';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -11,8 +10,8 @@ export default {
|
|||||||
buildModel: {
|
buildModel: {
|
||||||
endStationCode: '',
|
endStationCode: '',
|
||||||
startStationCode: '',
|
startStationCode: '',
|
||||||
startTime: '',
|
startTime: 0,
|
||||||
endTime: ''
|
endTime: 0
|
||||||
},
|
},
|
||||||
selected: null,
|
selected: null,
|
||||||
target: null,
|
target: null,
|
||||||
@ -73,26 +72,47 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdatePosition(e) {
|
onUpdatePosition(e) {
|
||||||
|
const fixedList = ['Area'];
|
||||||
const option = this.myChart.getOption();
|
const option = this.myChart.getOption();
|
||||||
const elements = option.graphic[0].elements
|
const elements = option.graphic[0].elements
|
||||||
const graphic = echarts.util.map(elements, (item) => {
|
const graphic = echarts.util.map(elements, (el) => {
|
||||||
return { position: this.myChart.convertToPixel('grid', item.point)};
|
if (fixedList.includes(el.subType)) {
|
||||||
|
const position = this.myChart.convertToPixel('grid', el.point1);
|
||||||
|
const position2 = this.myChart.convertToPixel('grid', el.point2);
|
||||||
|
const width = Math.abs(position[0] - position2[0]);
|
||||||
|
const height = Math.abs(position[1] - position2[1])
|
||||||
|
|
||||||
|
return {
|
||||||
|
position,
|
||||||
|
shape: { width, height }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
position: this.myChart.convertToPixel('grid', el.point)
|
||||||
|
};
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.myChart.setOption({graphic});
|
this.myChart.setOption({graphic});
|
||||||
},
|
},
|
||||||
onZrMouseDown(e) {
|
onZrMouseDown(e) {
|
||||||
if (e.target && ['Area'].includes(e.target.subType)) {
|
if (e.target && ['Area'].includes(e.target.subType)) {
|
||||||
this.target = e.target;
|
this.target = e.target;
|
||||||
this.$emit('tag', this.target);
|
this.$emit('tag', this.target);
|
||||||
|
if (this.model.choice == 'Construction') {
|
||||||
|
if (this.model.action == 'Edit') {
|
||||||
|
this.pixelExecCb(e, this.handlePopDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.model.choice == 'Plan') {
|
if (this.model.choice == 'Plan') {
|
||||||
if (this.model.action == 'Add') {
|
if (this.model.action == 'Add') {
|
||||||
this.pixelExecCb(e, this.handleCreateMark);
|
this.pixelExecCb(e, this.onCreateMark);
|
||||||
}
|
}
|
||||||
} else if (this.model.choice == 'Construction') {
|
} else if (this.model.choice == 'Construction') {
|
||||||
if (this.model.action == 'Add') {
|
if (this.model.action == 'Add') {
|
||||||
this.pixelExecCb(e, this.handleCreateArea);
|
this.pixelExecCb(e, this.onCreateArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -100,12 +120,12 @@ export default {
|
|||||||
if (['Plan', 'Construction'].includes(this.model.choice)) {
|
if (['Plan', 'Construction'].includes(this.model.choice)) {
|
||||||
if(this.model.action == 'Translate' && this.dragging) {
|
if(this.model.action == 'Translate' && this.dragging) {
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
this.pixelExecCb(e, this.handleTranslate)
|
this.pixelExecCb(e, this.onTranslate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMouseDown(e) {
|
onMouseDown(e) {
|
||||||
if (['Plan', 'Construction'].includes(this.model.choice)) {
|
if (this.model.choice == 'Plan') {
|
||||||
if (this.model.action == 'Edit') {
|
if (this.model.action == 'Edit') {
|
||||||
this.pixelExecCb(e, this.handlePopDialog);
|
this.pixelExecCb(e, this.handlePopDialog);
|
||||||
}
|
}
|
||||||
@ -116,7 +136,7 @@ export default {
|
|||||||
if (this.model.choice == 'Plan') {
|
if (this.model.choice == 'Plan') {
|
||||||
this.handleSelectLine({e});
|
this.handleSelectLine({e});
|
||||||
if (this.model.action == 'Translate') {
|
if (this.model.action == 'Translate') {
|
||||||
this.handleCreateDrag({e, pointInPixel})
|
this.onCreateDrag({e, pointInPixel})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -132,7 +152,7 @@ export default {
|
|||||||
if (this.model.choice == 'Plan') {
|
if (this.model.choice == 'Plan') {
|
||||||
this.handleSelectLine({e});
|
this.handleSelectLine({e});
|
||||||
if(this.model.action == 'Translate') {
|
if(this.model.action == 'Translate') {
|
||||||
this.handleCreateDrag({e, pointInPixel})
|
this.onCreateDrag({e, pointInPixel})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -175,20 +195,86 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onCreateDrag({e, pointInPixel}) {
|
||||||
|
if (this.selected) {
|
||||||
|
const option = this.myChart.getOption();
|
||||||
|
const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'});
|
||||||
|
filters.push(utils.buildDragDataObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this))
|
||||||
|
option.graphic[0].elements = filters;
|
||||||
|
|
||||||
|
this.myChart.setOption(option, {notMerge: true});
|
||||||
|
|
||||||
|
this.myChart.dispatchAction({
|
||||||
|
type: 'showTip',
|
||||||
|
seriesIndex: this.selected.seriesIndex,
|
||||||
|
dataIndex: this.selected.dataIndex
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onCreateMark({e, pointInPixel, yObj, xVal}) {
|
||||||
|
if (!e.target) {
|
||||||
|
const option = this.myChart.getOption();
|
||||||
|
const graphic = option.graphic;
|
||||||
|
const elements = graphic[0].elements;
|
||||||
|
|
||||||
|
elements.push(utils.buildMarkPointObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this))
|
||||||
|
|
||||||
|
this.myChart.setOption(option, {notMerge: true});
|
||||||
|
|
||||||
|
const markList = this.markList = elements.filter(el => { return el.subType == 'mark'});
|
||||||
|
const elemList = elements.filter(el => { return el.subType != 'mark'});
|
||||||
|
|
||||||
|
if (markList.length == 1) {
|
||||||
|
this.buildModel.startStationCode = yObj.code;
|
||||||
|
this.buildModel.startTime = xVal;
|
||||||
|
} else if (markList.length >= 2) {
|
||||||
|
this.buildModel.endStationCode = yObj.code;
|
||||||
|
this.buildModel.endTime = xVal;
|
||||||
|
option.graphic[0].elements = elemList;
|
||||||
|
this.$emit('create', this.buildModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onCreateArea({e, pointInPixel, yObj, xVal}) {
|
||||||
|
if (!e.target) {
|
||||||
|
const option = this.myChart.getOption();
|
||||||
|
const graphic = option.graphic;
|
||||||
|
const elements = graphic[0].elements;
|
||||||
|
|
||||||
|
elements.push(utils.buildMarkPointObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this))
|
||||||
|
|
||||||
|
this.myChart.setOption(option, {notMerge: true});
|
||||||
|
|
||||||
|
const markList = this.markList = elements.filter(el => { return el.subType == 'mark'});
|
||||||
|
const elemList = elements.filter(el => { return el.subType != 'mark'});
|
||||||
|
|
||||||
|
if (markList.length == 1) {
|
||||||
|
this.buildModel.startStationCode = yObj.code;
|
||||||
|
this.buildModel.startTime = xVal;
|
||||||
|
} else if (markList.length >= 2) {
|
||||||
|
this.buildModel.endStationCode = yObj.code;
|
||||||
|
this.buildModel.endTime = xVal;
|
||||||
|
option.graphic[0].elements = elemList;
|
||||||
|
this.$emit('create', this.buildModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
handlePopDialog({e, pointInPixel}) {
|
handlePopDialog({e, pointInPixel}) {
|
||||||
if (e.componentType == "series" &&
|
|
||||||
e.componentSubType == "line" &&
|
|
||||||
e.seriesName.includes('plan-')) {
|
|
||||||
const value = e.value;
|
|
||||||
const point = {
|
const point = {
|
||||||
x: pointInPixel[0],
|
x: pointInPixel[0],
|
||||||
y: pointInPixel[1]
|
y: pointInPixel[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.componentType == "series" &&
|
||||||
|
e.componentSubType == "line" &&
|
||||||
|
e.seriesName.includes('plan-')) {
|
||||||
|
|
||||||
const option = this.myChart.getOption();
|
const option = this.myChart.getOption();
|
||||||
const dataList = option.series[e.seriesIndex].data;
|
const dataList = option.series[e.seriesIndex].data;
|
||||||
const length = dataList.length;
|
const length = dataList.length;
|
||||||
const nxt = dataList[e.dataIndex+1];
|
const nxt = dataList[e.dataIndex+1];
|
||||||
const pre = dataList[e.dataIndex-1];
|
const pre = dataList[e.dataIndex-1];
|
||||||
|
const value = e.value;
|
||||||
|
|
||||||
this.selected = {
|
this.selected = {
|
||||||
dataIndex: e.dataIndex,
|
dataIndex: e.dataIndex,
|
||||||
@ -205,10 +291,12 @@ export default {
|
|||||||
this.$emit('select', this.selected);
|
this.$emit('select', this.selected);
|
||||||
|
|
||||||
if (e.dataIndex < length - 1 && value[2] == nxt[2]) {
|
if (e.dataIndex < length - 1 && value[2] == nxt[2]) {
|
||||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: DeviceMenu.planJustDeparture });
|
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustDeparture });
|
||||||
} else if (e.dataIndex == 0 || e.dataIndex > 0 && value[1] == pre[1]) {
|
} else if (e.dataIndex == 0 || e.dataIndex > 0 && value[1] == pre[1]) {
|
||||||
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: DeviceMenu.planJustRunning });
|
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustRunning });
|
||||||
}
|
}
|
||||||
|
} else if (e.target && e.target.subType == 'Area') {
|
||||||
|
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planModifyArea });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSelectLine({e}) {
|
handleSelectLine({e}) {
|
||||||
@ -244,72 +332,6 @@ export default {
|
|||||||
this.setLineLight();
|
this.setLineLight();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleCreateDrag({e, pointInPixel}) {
|
|
||||||
if (this.selected) {
|
|
||||||
const option = this.myChart.getOption();
|
|
||||||
const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'});
|
|
||||||
// const point = [e.value[0], e.value[1]]
|
|
||||||
// filters.push(utils.buildDragDataObj(this.myChart.convertToPixel('grid', point), point, this))
|
|
||||||
filters.push(utils.buildDragDataObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this))
|
|
||||||
option.graphic[0].elements = filters;
|
|
||||||
|
|
||||||
this.myChart.setOption(option, {notMerge: true});
|
|
||||||
|
|
||||||
this.myChart.dispatchAction({
|
|
||||||
type: 'showTip',
|
|
||||||
seriesIndex: this.selected.seriesIndex,
|
|
||||||
dataIndex: this.selected.dataIndex
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleCreateMark({e, pointInPixel, yObj, xVal}) {
|
|
||||||
if (!e.target) {
|
|
||||||
const option = this.myChart.getOption();
|
|
||||||
const graphic = option.graphic;
|
|
||||||
const elements = graphic[0].elements;
|
|
||||||
|
|
||||||
elements.push(utils.buildMarkPointObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this))
|
|
||||||
|
|
||||||
this.myChart.setOption(option, {notMerge: true});
|
|
||||||
|
|
||||||
const markList = this.markList = elements.filter(el => { return el.subType == 'mark'});
|
|
||||||
const elemList = elements.filter(el => { return el.subType != 'mark'});
|
|
||||||
|
|
||||||
if (markList.length == 1) {
|
|
||||||
this.buildModel.startStationCode = yObj.code;
|
|
||||||
this.buildModel.startTime = timeFormat(xVal);
|
|
||||||
} else if (markList.length >= 2) {
|
|
||||||
this.buildModel.endStationCode = yObj.code;
|
|
||||||
this.buildModel.endTime = timeFormat(xVal);
|
|
||||||
option.graphic[0].elements = elemList;
|
|
||||||
this.$emit('create', this.buildModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleCreateArea({e, pointInPixel, yObj, xVal}) {
|
|
||||||
if (!e.target) {
|
|
||||||
const option = this.myChart.getOption();
|
|
||||||
const graphic = option.graphic;
|
|
||||||
const elements = graphic[0].elements;
|
|
||||||
|
|
||||||
elements.push(utils.buildMarkPointObj(pointInPixel, this.myChart.convertFromPixel('grid', pointInPixel), this))
|
|
||||||
|
|
||||||
this.myChart.setOption(option, {notMerge: true});
|
|
||||||
|
|
||||||
const markList = this.markList = elements.filter(el => { return el.subType == 'mark'});
|
|
||||||
const elemList = elements.filter(el => { return el.subType != 'mark'});
|
|
||||||
|
|
||||||
if (markList.length == 1) {
|
|
||||||
this.buildModel.startStationCode = yObj.code;
|
|
||||||
this.buildModel.startTime = timeFormat(xVal);
|
|
||||||
} else if (markList.length >= 2) {
|
|
||||||
this.buildModel.endStationCode = yObj.code;
|
|
||||||
this.buildModel.endTime = timeFormat(xVal);
|
|
||||||
option.graphic[0].elements = elemList;
|
|
||||||
this.$emit('create', this.buildModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleSeriesDragging({e, xVal}) {
|
handleSeriesDragging({e, xVal}) {
|
||||||
if (this.selected) {
|
if (this.selected) {
|
||||||
this.selected.dx = xVal - this.selected._x;
|
this.selected.dx = xVal - this.selected._x;
|
||||||
@ -335,8 +357,8 @@ export default {
|
|||||||
},
|
},
|
||||||
handleAreaDragging({e, xVal}) {
|
handleAreaDragging({e, xVal}) {
|
||||||
},
|
},
|
||||||
handleTranslate({e}) {
|
onTranslate({e}) {
|
||||||
this.$emit('translate', this.buildModel);
|
this.$emit('translate');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,20 +190,20 @@ export default {
|
|||||||
},
|
},
|
||||||
axisTooltip(param) {
|
axisTooltip(param) {
|
||||||
let data = '';
|
let data = '';
|
||||||
const arr = [];
|
const xVal = param.data[0];
|
||||||
const station = this.stations.find(el => { return el.code == param.value[2] })||{ name: '', kmRange: ''};
|
const yObj = param.data[1];
|
||||||
if (!arr.includes(`${param.data[0]}${param.data[1]}`)) {
|
const model = param.value[2];
|
||||||
arr.push(`${param.data[0]}${param.data[1]}`);
|
const station = this.stations.find(el => { return el.code == yObj.stationCode })||{ name: '', kmRange: ''};
|
||||||
console.log(param)
|
|
||||||
const list = [
|
const list = [
|
||||||
|
`Service No: ${model.serviceNo}<br>`,
|
||||||
|
`Trip No: ${model.tripNo}<br>`,
|
||||||
|
`direction: ${model.direction == 2? 'Up': 'Down'}<br>`,
|
||||||
`Station name: ${station.name}<br>`,
|
`Station name: ${station.name}<br>`,
|
||||||
`Kilometer post: ${station.kmRange} m <br>`,
|
`Kilometer post: ${station.kmRange} m <br>`,
|
||||||
`Arrival Time: ${timeFormat(param.data[0] + this.planUtil.TranslationTime)}<br>`,
|
`Arrival Time: ${timeFormat(xVal + this.planUtil.TranslationTime)}<br>`,
|
||||||
`Train number: ${param.seriesName}`,
|
|
||||||
`<hr size=1 style="margin: 3px 0">`
|
`<hr size=1 style="margin: 3px 0">`
|
||||||
];
|
];
|
||||||
data += list.join('');
|
data += list.join('');
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
loadInitChart() {
|
loadInitChart() {
|
||||||
@ -252,7 +252,8 @@ export default {
|
|||||||
this.planData = planData;
|
this.planData = planData;
|
||||||
|
|
||||||
this.pushModels(option.series, [this.planUtil.initializeYaxis(this.stations)]);
|
this.pushModels(option.series, [this.planUtil.initializeYaxis(this.stations)]);
|
||||||
this.pushModels(option.series, this.planUtil.parseDataToModels(planData, this.stations, this.kmRangeCoordMap));
|
this.pushModels(option.series, this.planUtil.parseDataToSeries(this.myChart, planData, this.stations, this.kmRangeCoordMap));
|
||||||
|
this.pushModels(option.graphic[0].elements, this.planUtil.parseDataToGraph(this.myChart, planData, this.stations, this.kmRangeCoordMap));
|
||||||
|
|
||||||
this.myChart.setOption(option, {notMerge: true});
|
this.myChart.setOption(option, {notMerge: true});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -329,7 +330,7 @@ export default {
|
|||||||
showAllSymbol: true,
|
showAllSymbol: true,
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
width: 2,
|
width: 2,
|
||||||
color: 'red'
|
color: '#0000FF'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -344,7 +345,7 @@ export default {
|
|||||||
showAllSymbol: true,
|
showAllSymbol: true,
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
width: 1,
|
width: 1,
|
||||||
color: '#000'
|
color: '#000000'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,37 +1,12 @@
|
|||||||
import echarts from 'echarts';
|
import echarts from 'echarts';
|
||||||
|
|
||||||
export function buildDragAreaObj(position, point, that) {
|
export const MenuEnum = {
|
||||||
const markList = that.markList||[];
|
planJustRunning: '1000',
|
||||||
const length = markList.length;
|
planJustDeparture: '1001',
|
||||||
const first = markList[0];
|
planSetParams: '1002',
|
||||||
const last = markList[length-1];
|
planModifyArea: '1003'
|
||||||
const width = first.position[0] - last.position[0]||20;
|
|
||||||
const height = first.position[1] - last.position[1]||20;
|
|
||||||
|
|
||||||
return {
|
|
||||||
type: 'rect',
|
|
||||||
subType: 'Area',
|
|
||||||
position: [...position],
|
|
||||||
point: [...point],
|
|
||||||
shape: {
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
width,
|
|
||||||
height
|
|
||||||
},
|
|
||||||
style: {
|
|
||||||
fill: 'rgb(255,0,0, 0.3)',
|
|
||||||
stroke: 'rgb(255, 0, 0, 0.8)'
|
|
||||||
},
|
|
||||||
draggable: 'horizontal',
|
|
||||||
ondrag: echarts.util.curry(that.onShapeDragging),
|
|
||||||
onmouseover: echarts.util.curry(that.onShapeMouseOver),
|
|
||||||
onmouseout: echarts.util.curry(that.onShapeMouseOut),
|
|
||||||
z: 100
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function buildDragDataObj(position, point, that) {
|
export function buildDragDataObj(position, point, that) {
|
||||||
return {
|
return {
|
||||||
type: 'circle',
|
type: 'circle',
|
||||||
|
Loading…
Reference in New Issue
Block a user