添加航班tab栏

This commit is contained in:
zhouyuejun
2018-11-26 18:53:23 +08:00
parent b8f0b8f5f1
commit 5470628d7f
25 changed files with 435 additions and 92 deletions
+33 -66
View File
@@ -1,6 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { ChangeDetectorRef } from '@angular/core';
import { ToastService } from '../../components/toast/toast.service';
import { ToastConfig, ToastType } from '../../components/toast/toast-model';
import { HttpClientService } from '../../services/http-client.service';
import { BasicDataService } from '../basic-data-service'
@@ -42,8 +45,11 @@ export class MainComponent implements OnInit {
constructor(
private basicDataService: BasicDataService,
private httpCilent: HttpClientService,
private changeDetectorRef: ChangeDetectorRef
) { }
private changeDetectorRef: ChangeDetectorRef,
private toastService: ToastService,
) {
console.log(new Date().getTime())
}
//各项基础数据
public flightStatus: Array<any>;
@@ -209,6 +215,15 @@ export class MainComponent implements OnInit {
if (this.airports && this.airports.length > 0) {
this.basicDataTransHandle();
} else {
setTimeout(() => {
if (this.airports && this.airports.length > 0) {
} else {
const toastCfg = new ToastConfig(ToastType.ERROR, '', '基础数据获取失败!', 3000);
this.toastService.toast(toastCfg);
this.doSequence(this.combined_data);
}
}, 5000);
this.basicDataService.flightStatus_subject.subscribe(
val => this.flightStatus = val
);
@@ -240,70 +255,12 @@ export class MainComponent implements OnInit {
tableCont.addEventListener('scroll', scrollHandle)
}
/**
* 获取基础数据
*/
// getBasicData() {
// this.checkin_group = this.basicDataService.checkin_group;
// this.basicDataService.checkin_group_subject.subscribe(
// val => this.checkin_group = val
// );
// this.gate = this.basicDataService.gate;
// this.basicDataService.gate_subject.subscribe(
// val => this.gate = val
// );
// this.terminals = this.basicDataService.terminal;
// this.basicDataService.terminal_subject.subscribe(
// val => {
// this.terminals = val;
// this.changeDetectorRef.detectChanges();
// }
// );
// this.chut = this.basicDataService.chut;
// this.basicDataService.chut_subject.subscribe(
// val => this.chut = val
// );
// this.stand = this.basicDataService.stand;
// this.basicDataService.stand_subject.subscribe(
// val => this.stand = val
// );
// this.carousel = this.basicDataService.carousel;
// this.basicDataService.carousel_subject.subscribe(
// val => this.carousel = val
// );
// this.checkin_desk = this.basicDataService.checkin_desk;
// this.basicDataService.checkin_desk_subject.subscribe(
// val => this.checkin_desk = val
// );
// this.airports = this.basicDataService.airport;
// this.basicDataService.airport_subject.subscribe(
// val => this.airports = val
// );
// this.citys = this.basicDataService.city;
// this.basicDataService.city_subject.subscribe(
// val => this.citys = val
// );
// this.aircraft_type = this.basicDataService.aircraft_type;
// this.basicDataService.aircraft_type_subject.subscribe(
// val => this.aircraft_type = val
// );
// this.aircraft = this.basicDataService.aircraft;
// this.basicDataService.aircraft_subject.subscribe(
// val => this.aircraft = val
// );
// this.terminal_area = this.basicDataService.terminal_area;
// this.basicDataService.terminal_area_subject.subscribe(
// val => this.terminal_area = val
// );
// this.airlines = this.basicDataService.airline;
// this.basicDataService.airline_subject.subscribe(
// val => {
// this.airlines = val;
// this.changeDetectorRef.detectChanges();
// }
// );
// this.changeDetectorRef.detectChanges();
// }
getLast(isLast){
if(isLast){
console.log('666666');
}
}
basicDataTransHandle() {
this.combined_data.forEach(item => {
@@ -392,6 +349,13 @@ export class MainComponent implements OnInit {
this.render_data = sequenceData;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
console.log(new Date().getTime() +'---');
this.changeDetectorRef.detectChanges();
console.log(new Date().getTime() +'---');
}
nzClick(){
this.changeDetectorRef.detectChanges();
}
@@ -431,6 +395,7 @@ export class MainComponent implements OnInit {
* 下拉框选择筛选
*/
selectChange() {
console.log(new Date().getTime() + '-----');
let filter_data = [];
let filterItems = this.filterItems;
this.combined_data.forEach(item => {
@@ -573,6 +538,7 @@ export class MainComponent implements OnInit {
this.render_data = filterData;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
this.changeDetectorRef.detectChanges();
console.log(new Date().getTime() + '=====');
}
/**
@@ -956,6 +922,7 @@ export class MainComponent implements OnInit {
*/
selectRow(i) {
this.row_state = i;
// console.log(i)
this.changeDetectorRef.detectChanges();
}