Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
0968bcfa9e
@ -7,34 +7,34 @@ const defaultConfig = {
|
|||||||
/** 间隔高度*/
|
/** 间隔高度*/
|
||||||
multiple: 3,
|
multiple: 3,
|
||||||
/** 偏移时间*/
|
/** 偏移时间*/
|
||||||
translation: 60 * 60 * 2,
|
translation: 60 * 60 * 2
|
||||||
}
|
};
|
||||||
|
|
||||||
class EqualDistanceParser {
|
class EqualDistanceParser {
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 加载配置*/
|
/** 加载配置*/
|
||||||
load(config = defaultConfig) {
|
load(config = defaultConfig) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.multiple = config.multiple;
|
this.multiple = config.multiple;
|
||||||
this.translation = config.translation;
|
this.translation = config.translation;
|
||||||
this.edge = config.edge;
|
this.edge = config.edge;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 解析excel数据转换为Json后台数据*/
|
/** 解析excel数据转换为Json后台数据*/
|
||||||
importData(sheet, data) {
|
importData(sheet, data) {
|
||||||
if (this.config &&
|
if (this.config &&
|
||||||
this.config.importData) {
|
this.config.importData) {
|
||||||
this.config.importData(sheet, data)
|
this.config.importData(sheet, data);
|
||||||
} else {
|
} else {
|
||||||
console.info('no import data function');
|
console.info('no import data function');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 将后台数据解析成图表*/
|
/** 将后台数据解析成图表*/
|
||||||
convertDataToModels(data, stations, kmRangeMap, lineStyle) {
|
convertDataToModels(data, stations, kmRangeMap, lineStyle) {
|
||||||
var models = [];
|
var models = [];
|
||||||
|
|
||||||
if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) {
|
if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) {
|
||||||
@ -74,12 +74,16 @@ class EqualDistanceParser {
|
|||||||
|
|
||||||
/** 计算折返点车次坐标点集合*/
|
/** 计算折返点车次坐标点集合*/
|
||||||
if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) {
|
if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) {
|
||||||
lastPoint = train.stationTimeList[idx];
|
const currentTimeList = service.tripNumberDataList[j].stationTimeList;
|
||||||
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0];
|
const nextTimeList = service.tripNumberDataList[j + 1].stationTimeList;
|
||||||
// ${train.directionCode}
|
if (currentTimeList[currentTimeList.length - 1].secondTime != nextTimeList[0].secondTime) {
|
||||||
const aa = `${train.tripNumber}`;
|
lastPoint = train.stationTimeList[idx];
|
||||||
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true), lastPoint.stationCode, aa, '折返轨']);
|
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0];
|
||||||
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true), lastPoint.stationCode, aa, '折返轨']);
|
// ${train.directionCode}
|
||||||
|
const aa = `${train.tripNumber}`;
|
||||||
|
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true), lastPoint.stationCode, aa, '折返轨']);
|
||||||
|
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true), lastPoint.stationCode, aa, '折返轨']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 如果是备用车,按车次添加线*/
|
/** 如果是备用车,按车次添加线*/
|
||||||
@ -232,11 +236,11 @@ class EqualDistanceParser {
|
|||||||
|
|
||||||
/** 根据方向计算y折返偏移量*/
|
/** 根据方向计算y折返偏移量*/
|
||||||
getValueYByDirectionCode(defaultValue, directionCode) {
|
getValueYByDirectionCode(defaultValue, directionCode) {
|
||||||
const sign = this.getReverse() ? -1 : 1;
|
const sign = this.getReverse() ? -1 : 1;
|
||||||
if (directionCode === '1') {
|
if (directionCode === '1') {
|
||||||
defaultValue -= sign*this.getEdge() / 2;
|
defaultValue -= sign * this.getEdge() / 2;
|
||||||
} else if (directionCode === '2') {
|
} else if (directionCode === '2') {
|
||||||
defaultValue += sign*this.getEdge() / 2;
|
defaultValue += sign * this.getEdge() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -256,33 +260,33 @@ class EqualDistanceParser {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
getMultiple() {
|
getMultiple() {
|
||||||
return this.config.multiple;
|
return this.config.multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTranslation() {
|
getTranslation() {
|
||||||
return this.config.translation
|
return this.config.translation;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEdge(){
|
getEdge() {
|
||||||
return this.config.edge;
|
return this.config.edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
getReverse() {
|
getReverse() {
|
||||||
return this.config.reverse;
|
return this.config.reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
__createMartPoint(...args) {
|
__createMartPoint(...args) {
|
||||||
return this.config.reverse ? createMartPointReverse(...args): createMartPoint(...args);
|
return this.config.reverse ? createMartPointReverse(...args) : createMartPoint(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
__createSeriesModel(...args) {
|
__createSeriesModel(...args) {
|
||||||
return createSeriesModel(...args);
|
return createSeriesModel(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
__createMarkLineModels(...args) {
|
__createMarkLineModels(...args) {
|
||||||
return createMarkLineModels(...args);
|
return createMarkLineModels(...args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EqualDistanceParser;
|
export default EqualDistanceParser;
|
||||||
|
@ -2,40 +2,40 @@ import { createSeriesModel, createMarkLineModels, createMartPoint, createMartPoi
|
|||||||
import store from '@/store/index';
|
import store from '@/store/index';
|
||||||
|
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
/** 最小时间*/
|
/** 最小时间*/
|
||||||
minTime: 0,
|
minTime: 0,
|
||||||
/** 最大时间*/
|
/** 最大时间*/
|
||||||
maxTime: 3600 * 24 - 1,
|
maxTime: 3600 * 24 - 1,
|
||||||
/** 边缘高度*/
|
/** 边缘高度*/
|
||||||
edge: 600,
|
edge: 600,
|
||||||
/** 间隔高度*/
|
/** 间隔高度*/
|
||||||
multiple: 1,
|
multiple: 1,
|
||||||
/** 偏移时间*/
|
/** 偏移时间*/
|
||||||
translation: 0,
|
translation: 0
|
||||||
}
|
};
|
||||||
|
|
||||||
class EqualRatioParser {
|
class EqualRatioParser {
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 加载配置*/
|
/** 加载配置*/
|
||||||
load(config = defaultConfig) {
|
load(config = defaultConfig) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 解析excel数据转换为Json后台数据*/
|
/** 解析excel数据转换为Json后台数据*/
|
||||||
importData(sheet, data) {
|
importData(sheet, data) {
|
||||||
if (this.config &&
|
if (this.config &&
|
||||||
this.config.importData) {
|
this.config.importData) {
|
||||||
this.config.importData(sheet, data)
|
this.config.importData(sheet, data);
|
||||||
} else {
|
} else {
|
||||||
console.info('no import data function');
|
console.info('no import data function');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 将后台数据解析成图表*/
|
/** 将后台数据解析成图表*/
|
||||||
convertDataToModels(data, stations, kmRangeMap, lineStyle) {
|
convertDataToModels(data, stations, kmRangeMap, lineStyle) {
|
||||||
var models = [];
|
var models = [];
|
||||||
if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) {
|
if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) {
|
||||||
/** 按服务遍历数据*/
|
/** 按服务遍历数据*/
|
||||||
@ -74,19 +74,23 @@ class EqualRatioParser {
|
|||||||
// if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode ||
|
// if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode ||
|
||||||
// index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime ||
|
// index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime ||
|
||||||
// index > 0 && index < train.stationTimeList.length - 1) {
|
// index > 0 && index < train.stationTimeList.length - 1) {
|
||||||
const aa = `${train.tripNumber}`;
|
const aa = `${train.tripNumber}`;
|
||||||
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeMap, elem, pointdata.directionCode, false), elem.stationCode, aa]);
|
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeMap, elem, pointdata.directionCode, false), elem.stationCode, aa]);
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 计算折返点车次坐标点集合*/
|
/** 计算折返点车次坐标点集合*/
|
||||||
if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) {
|
if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) {
|
||||||
lastPoint = train.stationTimeList[train.stationTimeList.length - 1];
|
const currentTimeList = service.tripNumberDataList[j].stationTimeList;
|
||||||
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0];
|
const nextTimeList = service.tripNumberDataList[j + 1].stationTimeList;
|
||||||
num = this.computedReentryNumber(train.tripNumber);
|
if (currentTimeList[currentTimeList.length - 1].secondTime != nextTimeList[0].secondTime) {
|
||||||
const aa = `${train.tripNumber}`;
|
lastPoint = train.stationTimeList[train.stationTimeList.length - 1];
|
||||||
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true, num), lastPoint.stationCode, aa]);
|
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0];
|
||||||
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, nextPoint, pointdata.directionCode, true, num), nextPoint.stationCode, aa]);
|
num = this.computedReentryNumber(train.tripNumber);
|
||||||
|
const aa = `${train.tripNumber}`;
|
||||||
|
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true, num), lastPoint.stationCode, aa]);
|
||||||
|
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, nextPoint, pointdata.directionCode, true, num), nextPoint.stationCode, aa]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 如果是备用车,按车次添加线*/
|
/** 如果是备用车,按车次添加线*/
|
||||||
@ -246,7 +250,7 @@ class EqualRatioParser {
|
|||||||
|
|
||||||
/** 根据方向计算y折返偏移量*/
|
/** 根据方向计算y折返偏移量*/
|
||||||
getValueYByDirectionCode(defaultValue, directionCode, num) {
|
getValueYByDirectionCode(defaultValue, directionCode, num) {
|
||||||
const sign = this.getReverse() ? -1 : 1;
|
const sign = this.getReverse() ? -1 : 1;
|
||||||
if (directionCode === '1') {
|
if (directionCode === '1') {
|
||||||
defaultValue -= sign * this.getEdge() / 2 * num;
|
defaultValue -= sign * this.getEdge() / 2 * num;
|
||||||
} else if (directionCode === '2') {
|
} else if (directionCode === '2') {
|
||||||
@ -270,33 +274,33 @@ class EqualRatioParser {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
getMultiple() {
|
getMultiple() {
|
||||||
return this.config.multiple;
|
return this.config.multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTranslation() {
|
getTranslation() {
|
||||||
return this.config.translation
|
return this.config.translation;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEdge(){
|
getEdge() {
|
||||||
return this.config.edge;
|
return this.config.edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
getReverse() {
|
getReverse() {
|
||||||
return this.config.reverse;
|
return this.config.reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
__createMartPoint(...args) {
|
__createMartPoint(...args) {
|
||||||
return this.config.reverse ? createMartPointReverse(...args): createMartPoint(...args);
|
return this.config.reverse ? createMartPointReverse(...args) : createMartPoint(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
__createSeriesModel(...args) {
|
__createSeriesModel(...args) {
|
||||||
return createSeriesModel(...args);
|
return createSeriesModel(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
__createMarkLineModels(...args) {
|
__createMarkLineModels(...args) {
|
||||||
return createMarkLineModels(...args);
|
return createMarkLineModels(...args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EqualRatioParser;
|
export default EqualRatioParser;
|
||||||
|
Loading…
Reference in New Issue
Block a user