航班关联信息状态记录展示

This commit is contained in:
zhouyuejun
2019-01-16 16:13:51 +08:00
parent a16c6a72df
commit 8d1b77da8c
3 changed files with 110 additions and 20 deletions
@@ -1,5 +1,6 @@
import { Component, OnInit, Input } from '@angular/core';
import timeFormatter from '../../../utils/time-formatter';
import dateFormatter from '../../../utils/date-formatter';
@Component({
selector: 'app-related-tab',
@@ -8,8 +9,29 @@ import timeFormatter from '../../../utils/time-formatter';
})
export class RelatedTabComponent implements OnInit {
public lines;
public airports;
public airports;
public predelay;
public precancle;
public prefdiv;
public prefret;
public readelay;
public reacancle;
public reafdiv;
public reafret;
@Input() allAirports;
@Input() set flight(flight) {
this.predelay = '';
this.precancle = '';
this.prefdiv = '';
this.prefret = '';
this.readelay = '';
this.reacancle = '';
this.reafdiv = '';
this.reafret = '';
this.lines = Object.assign({}, flight);
if (this.lines.preFlight && !this.lines.reaFlight) {
this.airports = this.lines.renderFlight.ERUT.split(' - ');
@@ -23,7 +45,7 @@ export class RelatedTabComponent implements OnInit {
}
} else {
this.lines.preFlight.ERUT[this.lines.preFlight.ERUT.length - 1]['SCDT'] = this.lines.reaFlight.ERUT[0]['SCDT'];
let concatArray = this.lines.reaFlight.ERUT.slice(1);
let concatArray = this.lines.reaFlight.ERUT.slice(1);
let linkAirport = this.lines.preFlight.ERUT.concat(concatArray)
this.airports = this.lines.renderFlight.ERUT.split(' - ');
for (let i = 0; i < this.airports.length; i++) {
@@ -31,6 +53,58 @@ export class RelatedTabComponent implements OnInit {
}
}
if (this.lines.preFlight && this.lines.preFlight['ABN'] && this.lines.preFlight['ABN'].length > 0) {
let delyIndex = this.lines.preFlight['ABN'].findIndex(ele => ele.TYPE === 'DLY');
let cancleIndex = this.lines.preFlight['ABN'].findIndex(ele => ele.TYPE === 'CAN');
let fdivIndex = this.lines.preFlight['ABN'].findIndex(ele => ele.TYPE === 'ALT');
let fretIndex = this.lines.preFlight['ABN'].findIndex(ele => ele.TYPE === 'RTN');
if (delyIndex > -1) {
this.predelay = this.lines.preFlight['ABN'][delyIndex].BODY;
this.predelay['STRT'] = new Date(dateFormatter(this.predelay['STRT'])).getTime();
this.predelay['DURA'] = parseInt(this.predelay['DURA'].substr(0, 2)) * 3600000 + parseInt(this.predelay['DURA'].substr(2, 3)) * 60000 + this.predelay['STRT']
}
if (cancleIndex > -1) {
this.precancle = this.lines.preFlight['ABN'][cancleIndex].BODY;
this.precancle = new Date(dateFormatter(this.precancle)).getTime();
}
if (fdivIndex > -1) {
this.prefdiv = this.lines.preFlight['ABN'][fdivIndex].BODY;
let airportIndex = this.allAirports.findIndex(val => val.airportCodeIata === this.prefdiv.DDES);
if (airportIndex > -1) {
this.prefdiv.DDES = this.allAirports[airportIndex].briefNameChn
}
}
if (fretIndex > -1) {
this.prefret = this.lines.preFlight['ABN'][fretIndex].BODY;
}
}
if (this.lines.reaFlight && this.lines.reaFlight['ABN'] && this.lines.reaFlight['ABN'].length > 0) {
let delyIndex = this.lines.reaFlight['ABN'].findIndex(ele => ele.TYPE === 'DLY');
let cancleIndex = this.lines.reaFlight['ABN'].findIndex(ele => ele.TYPE === 'CAN');
let fdivIndex = this.lines.reaFlight['ABN'].findIndex(ele => ele.TYPE === 'ALT');
let fretIndex = this.lines.reaFlight['ABN'].findIndex(ele => ele.TYPE === 'RTN');
if (delyIndex > -1) {
this.readelay = this.lines.reaFlight['ABN'][delyIndex].BODY;
this.readelay['STRT'] = new Date(dateFormatter(this.readelay['STRT'])).getTime();
this.readelay['DURA'] = parseInt(this.readelay['DURA'].substr(0, 2)) * 3600000 + parseInt(this.readelay['DURA'].substr(2, 3)) * 60000 + this.readelay['STRT'];
}
if (cancleIndex > -1) {
this.reacancle = this.lines.reaFlight['ABN'][cancleIndex].BODY;
this.reacancle = new Date(dateFormatter(this.reacancle)).getTime();
}
if (fdivIndex > -1) {
this.reafdiv = this.lines.reaFlight['ABN'][fdivIndex].BODY;
let airportIndex = this.allAirports.findIndex(val => val.airportCodeIata === this.reafdiv.DDES);
if (airportIndex > -1) {
this.reafdiv.DDES = this.allAirports[airportIndex].briefNameChn
}
}
if (fretIndex > -1) {
this.reafret = this.lines.reaFlight['ABN'][fretIndex].BODY;
}
}
};
constructor() { }