添加航班tab栏
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import timeFormatter from '../../../utils/time-formatter';
|
||||
|
||||
@Component({
|
||||
selector: 'app-related-tab',
|
||||
templateUrl: './related-tab.component.html',
|
||||
styleUrls: ['./related-tab.component.scss']
|
||||
})
|
||||
export class RelatedTabComponent implements OnInit {
|
||||
public lines;
|
||||
public airports;
|
||||
@Input() set flight(flight) {
|
||||
this.lines = Object.assign({}, flight);
|
||||
if (this.lines.preFlight && !this.lines.reaFlight) {
|
||||
this.airports = this.lines.renderFlight.ERUT.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(this.lines.preFlight.ERUT[i].SCDT), scat: timeFormatter(this.lines.preFlight.ERUT[i].SCAT) }
|
||||
}
|
||||
} else if (!this.lines.preFlight && this.lines.reaFlight) {
|
||||
this.airports = this.lines.renderFlight.ERUT.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(this.lines.reaFlight.ERUT[i].SCDT), scat: timeFormatter(this.lines.reaFlight.ERUT[i].SCAT) }
|
||||
}
|
||||
} 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 linkAirport = this.lines.preFlight.ERUT.concat(concatArray)
|
||||
this.airports = this.lines.renderFlight.ERUT.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(linkAirport[i].SCDT), scat: timeFormatter(linkAirport[i].SCAT) }
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user