工具类抽取及历史数据处理

This commit is contained in:
zhouyuejun
2018-12-15 17:04:16 +08:00
parent 595a3f38ab
commit 1e735059f8
52 changed files with 890 additions and 948 deletions
-153
View File
@@ -1,153 +0,0 @@
import { Injectable } from '@angular/core';
import { HttpClientService } from '../services/http-client.service';
import { Subject, forkJoin, zip } from 'rxjs'
@Injectable()
export class BasicDataService {
public flightTypes:Array<any>;
public flightTypes_subject = new Subject<any>();
public flightStatus:Array<any>;
public flightStatus_subject = new Subject<any>();
public checkin_group: Array<any>;
public checkin_group_subject = new Subject<any>();
public gate: Array<any>;
public gate_subject = new Subject<any>();
public terminal: Array<any>;
public terminal_subject = new Subject<any>();
public chut: Array<any>;
public chut_subject = new Subject<any>();
public stand: Array<any>;
public stand_subject = new Subject<any>();
public carousel: Array<any>;
public carousel_subject = new Subject<any>();
public checkin_desk: Array<any>;
public checkin_desk_subject = new Subject<any>();
public airport: Array<any>;
public airport_subject = new Subject<any>();
public city: Array<any>;
public city_subject = new Subject<any>();
public aircraft_type: Array<any>;
public aircraft_type_subject = new Subject<any>();
public aircraft: Array<any>;
public aircraft_subject = new Subject<any>();
public terminal_area: Array<any>;
public terminal_area_subject = new Subject<any>();
public airline: Array<any>;
public airline_subject = new Subject<any>();
public country: Array<any>;
public country_subject = new Subject<any>();
public aircraft_type_group: Array<any>;
public aircraft_type_group_subject = new Subject<any>();
public airportgroup: Array<any>;
public airportgroup_subject = new Subject<any>();
public airlinegroup: Array<any>;
public airlinegroup_subject = new Subject<any>();
constructor(
private httpClient: HttpClientService
) { }
loadBasicData() {
let flightTypesHttp = this.httpClient.get('/adminapi/basicdata/sysFlightTypes');
let flightStatusHttp = this.httpClient.get('/adminapi/basicdata/sysFlightStatus');
let checkinGroupHttp = this.httpClient.get('/adminapi/basicdata/checkinGroups');
let gateHttp = this.httpClient.get('/adminapi/basicdata/ormsGates');
let terminalHttp = this.httpClient.get('/adminapi/basicdata/ormsTerminals');
let chutHttp = this.httpClient.get('/adminapi/basicdata/ormsChuts');
let standHttp = this.httpClient.get('/adminapi/basicdata/ormsStands');
let carouselHttp = this.httpClient.get('/adminapi/basicdata/ormsCarousels');
let checkinDeskHttp = this.httpClient.get('/adminapi/basicdata/ormsCheckindesks');
let airportHttp = this.httpClient.get('/adminapi/basicdata/sysAirports');
let cityHttp = this.httpClient.get('/adminapi/basicdata/sysCitys');
let aircraftTypeHttp = this.httpClient.get('/adminapi/basicdata/sysAircrafttypes');
let aircraftHttp = this.httpClient.get('/adminapi/basicdata/sysAircrafts');
let terminalAreaHttp = this.httpClient.get('/adminapi/basicdata/ormsTerminalareas');
let airlineHttp = this.httpClient.get('/adminapi/basicdata/sysAirlines');
let countryHttp = this.httpClient.get('/adminapi/basicdata/sysCountry');
let aircrafttypesGroupHttp = this.httpClient.get('/adminapi/basicdata/sysAircrafttypesGroup');
let airportGroupsHttp = this.httpClient.get('/adminapi/basicdata/sysAirportGroups');
let airlineGroupHttp = this.httpClient.get('/adminapi/basicdata/sysAirlineGroup');
zip(
flightTypesHttp,
flightStatusHttp,
checkinGroupHttp,
gateHttp,
terminalHttp,
chutHttp,
standHttp,
carouselHttp,
checkinDeskHttp,
airportHttp,
cityHttp,
aircraftTypeHttp,
aircraftHttp,
terminalAreaHttp,
airlineHttp,
countryHttp,
aircrafttypesGroupHttp,
airportGroupsHttp,
airlineGroupHttp
).subscribe(
([
flightTypesRes,
flightStatusRes,
checkinGroupRes,
gateRes,
terminalRes,
chutRes,
standRes,
carouselRes,
checkinDeskRes,
airportRes,
cityRes,
aircraftTypeRes,
aircraftRes,
terminalAreaRes,
airlineRes,
countryRes,
aircraftTypeGroupRes,
airportGroupRes,
airlineGroupRes
]) => {
this.flightTypes = flightTypesRes.body;
this.flightTypes_subject.next(flightTypesRes.body)
this.flightStatus = flightStatusRes.body;
this.flightStatus_subject.next(flightStatusRes.body);
this.checkin_group = checkinGroupRes.body;
this.checkin_group_subject.next(checkinGroupRes.body);
this.gate = gateRes.body;
this.gate_subject.next(gateRes.body);
this.terminal = terminalRes.body;
this.terminal_subject.next(terminalRes.body);
this.chut = chutRes.body;
this.chut_subject.next(chutRes.body);
this.stand = standRes.body;
this.stand_subject.next(standRes.body);
this.carousel = carouselRes.body;
this.carousel_subject.next(carouselRes.body);
this.checkin_desk = checkinDeskRes.body;
this.checkin_desk_subject.next(checkinDeskRes.body);
this.aircraft_type = aircraftTypeRes.body;
this.aircraft_type_subject.next(aircraftTypeRes.body);
this.aircraft = aircraftRes.body;
this.aircraft_subject.next(aircraftRes.body);
this.terminal_area = terminalAreaRes.body;
this.terminal_area_subject.next(terminalAreaRes.body);
this.airline = airlineRes.body;
this.airline_subject.next(airlineRes.body);
this.city = cityRes.body;
this.city_subject.next(cityRes.body);
this.airport = airportRes.body;
this.airport_subject.next(airportRes.body);
this.country = countryRes.body;
this.country_subject.next(countryRes.body);
this.aircraft_type_group = aircraftTypeGroupRes.body;
this.aircraft_type_group_subject.next(aircraftTypeGroupRes.body);
this.airportgroup = airportGroupRes.body;
this.airportgroup_subject.next(airportGroupRes.body);
this.airlinegroup = airlineGroupRes.body;
this.airlinegroup_subject.next(airlineGroupRes.body);
}
)
}
}
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service'
import { BasicDataService } from '../../../services/basic-data-service'
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service'
import { BasicDataService } from '../../../services/basic-data-service'
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ChangeDetectorRef } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import * as $ from 'jquery';
@Component({
selector: 'app-city',
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service'
import { BasicDataService } from '../../../services/basic-data-service'
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service';
import { BasicDataService } from '../../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BasicDataService } from '../../basic-data-service'
import { BasicDataService } from '../../../services/basic-data-service'
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@@ -1,189 +1,146 @@
<div class="main-page">
<div class="page-content">
<div class="search-filter mb-3">
<div class="first-condition row">
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
<option value="">选择列名</option>
<option value="">航班号</option>
<option value="">飞机号</option>
<option value="">航线</option>
<option value="">前站起飞时间</option>
<option value="">计划到达/出发</option>
<option value="">预计到达/出发</option>
<option value="">实际到达/出发</option>
<option value="">机型</option>
<option value="">停机</option>
<option value="">登机门</option>
<option value="">商调完成</option>
<option value="">值机打开</option>
<option value="">值机关闭</option>
<option value="">登机开始</option>
<option value="">登机结束</option>
</select>
<label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
<span>过滤</span>
</label>
<label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
<span>查找定位</span>
</label>
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputEnter()">
</div>
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
<!-- <button type="button" class="btn btn-info mr-3">打印</button>
<button type="button" class="btn btn-info mr-3">航班延误信息修订</button>-->
<button type="button" class="btn btn-info mr-3">刷新</button>
</div>
</div>
<div class="page-content">
<div class="search-filter mb-3">
<div class="first-condition row">
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
<select [(ngModel)]="SEL_COL" class="mr-4 form-control" name="" id="">
<option value="">选择列名</option>
<option *ngFor="let airline_col of render_col_lists" [value]="airline_col.COL_CODE">{{airline_col.COL_CN}}</option>
</select>
<label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
<span>过滤</span>
</label>
<label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
<span>查找定</span>
</label>
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter)="inputEnter()">
</div>
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
<button type="button" class="btn btn-info mr-3" (click)="refresh()">刷新</button>
</div>
</div>
<div class="second-condition mb-3 row">
<div class="input-container mr-4">
<label for="airlineId">航空公司:&nbsp;&nbsp;</label>
<select class="form-control" (ngModelChange)="selectChange()">
<option value=""></option>
<!-- <option *ngFor="let item of airlines" [value]="item.airlineId">{{item.airlineName}}</option> -->
</select>
</div>
<div class="input-container mr-4">
<label for="routeType">航线类别:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.TT" (ngModelChange)="selectChange()">
<option value=""></option>
<option value="D">国内</option>
<option value="I">国际</option>
<option value="M">混合</option>
<option value="R">地区</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.routeType">{{item.routeType}}</option> -->
</select>
</div>
<div class="input-container mr-4">
<label for="flightTask">航班任务:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.flightTask" (ngModelChange)="selectChange()">
<option value=""></option>
<option value="S">正班</option>
<option value="N">包机</option>
<option value="E">急救</option>
<option value="B">专机</option>
<option value="G">通用</option>
<option value="J">加班</option>
<option value="M">军用</option>
<option value="Q">补班</option>
<option value="X">其他</option>
<option value="A">计划外</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.flightTask">{{item.flightTask}}</option> -->
</select>
<div class="second-condition mb-3 row">
<div class="input-container mr-4">
<label for="">航空公司:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.ALCD" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option>
<option *ngFor="let airline of airlinesSelections" [value]="airline.airlineCodeIata">{{airline.airlineName}}</option>
</select>
</div>
<div class="input-container mr-4">
<label for="">航线类别:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.FLIN" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option>
<option value="D">国内</option>
<option value="I">国际</option>
<option value="M">混合</option>
<option value="R">地区</option>
</select>
</div>
<div class="input-container mr-4">
<label for="">航班类别:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.FLTY" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option>
<option *ngFor="let type of flightTypeSelections" [value]="type.flightTypeCode">{{type.flightTypeNameCn}}</option>
</select>
</div>
<div class="input-container mr-4">
<label for="">到达/出发:</label>
<select [(ngModel)]="filterItems.MVIN" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option>
<option value="A">到达</option>
<option value="D">离港</option>
</select>
</div>
<div class="input-container mr-4">
<label for="">机坪代理:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.FHAG" class="form-control">
<option value=""></option>
<option value="GH">国航代理</option>
<option value="CH">川航代理</option>
</select>
</div>
<div class="input-container mr-4">
<label for="">旅客代理:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.PHAG" class="form-control">
<option value=""></option>
<option value="GH">国航代理</option>
<option value="CH">川航代理</option>
</select>
</div>
<div class="input-container mr-4">
<label for="">维护代理:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.MHAG" class="form-control">
<option value=""></option>
<option value="GH">国航代理</option>
<option value="CH">川航代理</option>
</select>
</div>
</div>
<div class="third-condition row">
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox" [(ngModel)]="checkboxGroup.related" (ngModelChange)="checkboxChange()">
<span>航班关联信息</span>
</label>
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox" [(ngModel)]="checkboxGroup.detail" (ngModelChange)="checkboxChange()">
<span>详细信息</span>
</label>
<!-- <label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox" [(ngModel)]="checkboxGroup.vip" (ngModelChange)="checkboxChange()">
<span>航班VIP信息</span>
</label>
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox" [(ngModel)]="checkboxGroup.guarantee" (ngModelChange)="checkboxChange()">
<span>保障信息</span>
</label>
<label class="radio-inline custom-checkbox nowrap">
<input type="checkbox" [(ngModel)]="checkboxGroup.special" (ngModelChange)="checkboxChange()">
<span>航班特服信息</span>
</label> -->
</div>
</div>
<div class="input-container mr-4">
<label for="arriOrDept">到达/出发:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.arriOrDept" (ngModelChange)="selectChange()">
<option value=""></option>
<option value="A">到达</option>
<option value="D">出发</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.arriOrDept">{{item.arriOrDept}}</option> -->
</select>
<div class="airline-table">
<div id="table-container" class="table-container" [ngClass]="{'table-c': !tabClose,'table-o': tabClose}">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<th>序号</th>
<th *ngFor="let airline_col of render_col_lists">{{airline_col.COL_CN}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let airline_row of render_data;let i = index;last as isLast" (click)="selectRow(airline_row)"
[ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}">
<td>{{i+1}}</td>
<td *ngFor="let airline_col of render_col_lists" [ngClass]="getPosition(airline_col.COL_CODE,airline_row)">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
</tr>
</tbody>
</table>
</div>
<div class="airline-message" [ngClass]="{'tab-c': tabClose,'tab-o': !tabClose}">
<!-- <nz-tabset [nzTabPosition]="'top'" [nzType]="'card'" [nzShowPagination]="false">
<nz-tab nzTitle="关联信息" (nzClick)="nzClick()" *ngIf="checkboxGroup.related">
<app-related-tab [flight]="row_state"></app-related-tab>
</nz-tab>
<nz-tab nzTitle="详细信息" (nzClick)="nzClick()" *ngIf="checkboxGroup.detail">
<app-detail-tab [flight]="row_state"></app-detail-tab>
</nz-tab>
<nz-tab nzTitle="保障信息" (nzClick)="nzClick()" *ngIf="checkboxGroup.guarantee">
<app-guarantee-tab></app-guarantee-tab>
</nz-tab>
<nz-tab nzTitle="VIP信息" (nzClick)="nzClick()" *ngIf="checkboxGroup.vip">
<app-vip-tab></app-vip-tab>
</nz-tab>
<nz-tab nzTitle="特服信息" (nzClick)="nzClick()" *ngIf="checkboxGroup.special">
<app-special-tab></app-special-tab>
</nz-tab>
</nz-tabset> -->
</div>
</div>
<div class="input-container mr-4">
<label for="flightTypeCode">航班代理:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.flightTypeCode" (ngModelChange)="selectChange()">
<option value=""></option>
<option value="T">国航代理</option>
<option value="G">川航代理</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.flightTypeCode">{{item.flightTypeCode}}</option> -->
</select>
</div>
<div class="input-container mr-4">
<label for="">异常状态:&nbsp;&nbsp;</label>
<select class="form-control" (ngModelChange)="selectChange()">
<option value=""></option>
<!-- <option *ngFor="let item of seasonals" [value]="item.arriOrDept">{{item.arriOrDept}}</option> -->
</select>
</div>
</div>
<div class="third-condition row">
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox">
<span>航班关联信息</span>
</label>
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox">
<span>详细信息</span>
</label>
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox">
<span>保障信息</span>
</label>
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox">
<span>航班VIP信息</span>
</label>
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox">
<span>航班特服信息</span>
</label>
</div>
</div>
<div class="airline-table">
<div id="table-container" class="table-container">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<th>序号</th>
<!-- <th>航班号</th>
<th>飞机号</th>
<th>航线</th>
<th>前站起飞时间</th>
<th>计划到达/出发</th>
<th>预计到达/出发</th>
<th>实际到达/出发</th>
<th>机型</th>
<th>停机位</th>
<th>登机门</th>
<th>商调完成</th>
<th>值机打开</th>
<th>值机关闭</th>
<th>登机开始</th>
<th>登机结束</th>
<th>航空公司</th>
<th>航线类别</th>
<th>航班任务</th>
<th>到达/出发</th>
<th>航班代理</th>
<th>异常状态</th>-->
<th *ngFor="let airline_col of historical_lists">{{airline_col.COL_CN}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let historical of render_data;let i = index" (click)="selectRow(historical)"
[ngClass]="{'selected':row_state['renderFlight']===historical['renderFlight']}">
<td>{{i+1}}</td>
<!--<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td>
<td>{{historical.}}</td> -->
<td *ngFor="let airline_col of historical_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{historical['renderFlight'][airline_col.COL_CODE]}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -1,337 +1,381 @@
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 dateFormatter from '../../utils/data-formatter';
import { HttpParams } from '@angular/common/http';
import { BasicDataService } from '../../services/basic-data-service';
import { OperateSpinServiceService } from '../../services/operate-spin-service.service';
import { DynamicFlightOrder } from '../../utils/dynamic-flight-order';
import { FlightsDataHandle } from '../../utils/flights-data-handle';
import * as $ from 'jquery';
@Component({
selector: 'app-historical-data',
templateUrl: './historical-data.component.html',
styleUrls: ['./historical-data.component.scss']
selector: 'app-historical-data',
templateUrl: './historical-data.component.html',
styleUrls: ['./historical-data.component.scss']
})
export class HistoricalDataComponent implements OnInit {
constructor(
private httpCilent: HttpClientService,
private changeDetectorRef: ChangeDetectorRef
) { }
public raw_data: Array<object> = []; //原始数据,即航班计划
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
public render_data: Array<object> = []; //显示数据,即需要显示的数据
public historical_lists: Array<object>; //列数据
public row_state: any = { renderFlight: {} };
// 搜索条件
SEARCH = ''; //手动输入条件
FLT_POS = 1; //过滤还是定位
SEL_COL = ''; //选择列名
public filterItems = {
TT: '',//航线类别
flightTask:'',//航班任务
arriOrDept:'',//到达/出发
flightTypeCode:''//航班代理
}
public formatter = {
'TT': {
'D': '国内'
},
'flightTask': {
'S': '正班'
},
'arriOrDept': {
'A': '到达'
},
'flightTypeCode': {
'T': '国航代理'
},
'SODT': dateFormatter,
'ESTT': dateFormatter,
'ACTT': dateFormatter
}
selectRow(i) {
this.row_state = i;
this.changeDetectorRef.detectChanges();
}
getColor(col_CODE) {
if (col_CODE === 'SODT') {
return 'skyblue'
} else {
return null
constructor(
private basicDataService: BasicDataService,
private operateSpinServiceService: OperateSpinServiceService,
private httpCilent: HttpClientService,
private toastService: ToastService,
private changeDetectorRef: ChangeDetectorRef,
) {
this.operateSpinServiceService.showSpin();
this.changeDetectorRef.detach();
}
}
public orderHandle = new DynamicFlightOrder();
public dataHandle = new FlightsDataHandle();
ngOnInit() {
this.changeDetectorRef.detach();
/* 获取显示列 */
this.httpCilent.get('/assets/mock-data/historical-code.json').subscribe(
data => {
data.sort(function (a, b) {
return (a['COL_ORDER'] - b['COL_ORDER']);
})
this.historical_lists = data;
}
)
/* 获取历史数据信息 */
this.httpCilent.get('/assets/mock-data/historical-data.json').subscribe(
data => {
//解析数据
data.forEach(element => {
this.raw_data.push(JSON.parse(element.value));
});
public tabClose: boolean = true;
let combined_linked_data = this.raw_data;
//各项基础数据
public flightTypes: Array<any>;
public terminals: Array<any>;
public flightStatus: Array<any>;
public airports: Array<any>;
public citys: Array<any>;
public airlines: Array<any>;
combined_linked_data.forEach(element => {
let row_flights = {};
let render_flight = {};
let render_pre_flight = {};
let render_rea_flight = {};
row_flights['preFlight'] = element;
public airlinesSelections: Array<any> = [];
public flightTypeSelections: Array<any> = [];
for (let i = 0; i < this.historical_lists.length; i++) {
let key = this.historical_lists[i]['COL_CODE']
render_flight[key] = typeof (this.formatter[key]) === 'function' ? this.formatter[key](row_flights['preFlight'][key], 1) : this.formatter[key] ? this.formatter[key][row_flights['preFlight'][key]] : row_flights['preFlight'][key];
public raw_data: Array<object> = []; //原始数据,未经过任何转换和组合
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
public render_data: Array<object> = []; //显示数据,即需要显示的数据
public col_lists: Array<object>; //列数据
public render_col_lists: Array<object>;
public row_state: any = { renderFlight: {} };
public checkboxGroup = {
'related': false,
'detail': false,
'vip': false,
'special': false,
'guarantee': false
}
ngOnInit() {
/* 获取用户设置 */
this.httpCilent.get('/adminapi/settings/uisettings').subscribe(
data => {
data.body.forEach(element => {
if (element.groupCode === 'userSettingCol') {
this.col_lists = JSON.parse(element.settingContent).allCols;
this.render_col_lists = JSON.parse(element.settingContent).targetList;
}
})
}
)
//获取航班动态信息
this.httpCilent.post('/adminapi/hitFlightData/list', { searchDate: new Date().getTime() }).subscribe(
data => {
this.raw_data = data.body;
//查找链接航班并将其组合成一条数据
let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data);
combined_linked_data.forEach(element => {
let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists);
this.combined_data.push(flights_item);
});
//从基础数据服务中拿出部分基础数据
this.flightTypes = this.basicDataService.flightTypes;
this.terminals = this.basicDataService.terminal;
this.flightStatus = this.basicDataService.flightStatus;
this.airlines = this.basicDataService.airline;
this.citys = this.basicDataService.city;
this.airports = this.basicDataService.airport;
if (this.airports && this.airports.length > 0) {
let combined_data = []
this.combined_data.forEach(item => {
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus, this.flightTypes));
})
this.combined_data = combined_data;
this.doSequence(this.combined_data);
} else {
this.basicDataService.flightTypes_subject.subscribe(
val => this.flightTypes = val
)
this.basicDataService.terminal_subject.subscribe(
val => this.terminals = val
)
this.basicDataService.flightStatus_subject.subscribe(
val => this.flightStatus = val
);
this.basicDataService.airline_subject.subscribe(
val => this.airlines = val
);
this.basicDataService.city_subject.subscribe(
val => this.citys = val
);
this.basicDataService.airport_subject.subscribe(
val => {
this.airports = val;
let combined_data = []
this.combined_data.forEach(item => {
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus, this.flightTypes));
})
this.combined_data = combined_data;
this.doSequence(this.combined_data);
}
);
}
row_flights['renderFlight'] = render_flight;
if (element['isLinked']) {
row_flights['preFlight'] = element['linkFlight'];
delete element['linkFlight'];
delete element['isLinked'];
row_flights['reaFlight'] = element;
}
)
for (let i = 0; i < this.historical_lists.length; i++) {
let key = this.historical_lists[i]['COL_CODE']
if (this.formatter.hasOwnProperty(key)) {
if (typeof (this.formatter[key]) === 'function') {
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key](row_flights['preFlight'][key], 1)) : (this.formatter[key](row_flights['preFlight'][key], 1) + '/' + this.formatter[key](row_flights['reaFlight'][key], 1));
render_pre_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1);
render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1);
//固定表头
var tableCont = document.querySelector('#table-container')
function scrollHandle() {
var scrollTop = this.scrollTop;
this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
}
tableCont.addEventListener('scroll', scrollHandle)
}
/**
*
* @param combined_data
*/
doSequence(combined_data) {
this.raw_data.forEach(element => {
if (this.airlinesSelections.findIndex(airline => airline.airlineCodeIata === element['ALCD']) === -1) {
let index = this.airlines.findIndex(val => val.airlineCodeIata === element['ALCD']);
this.airlinesSelections.push(this.airlines[index]);
}
if (this.flightTypeSelections.findIndex(flightType => flightType.flightTypeCode === element['FLTY']) === -1) {
let index = this.flightTypes.findIndex(val => val.flightTypeCode === element['FLTY']);
this.flightTypeSelections.push(this.flightTypes[index]);
}
})
// combined_data.forEach(element => {
// element['ORDER'] = this.orderHandle.sequence(element);
// })
// combined_data.sort(function (a, b) {
// return (a['ORDER'] - b['ORDER']);
// })
this.render_data = combined_data;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
this.changeDetectorRef.detectChanges();
this.operateSpinServiceService.hideSpin()
}
/**
*
*/
refresh() {
const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '刷新成功!', 3000);
this.toastService.toast(toastCfg);
}
/**
*
* @param filterItems
* @return
*/
SEARCH = ''; //手动输入条件
FLT_POS = 1; //过滤还是定位
SEL_COL = ''; //选择列名
public filterItems = {
ALCD: '', //航空公司
FLIN: '', //航线类别
FLTY: '', //航班类别
MVIN: '', //到达/出发
FHAG: '', //机坪代理
MHAG: '', //维护代理
PHAG: '', //旅客代理
}
/**
*
*/
inputEnter() {
if (this.FLT_POS === 1) {
this.selectChange()
} else {
this.inputPosition(this.render_data)
}
}
/**
*
*/
selectChange() {
this.operateSpinServiceService.showSpin();
setTimeout(() => {
let filter_data = [];
let filterItems = this.filterItems;
this.combined_data.forEach(item => {
filter_data.push(Object.assign({}, item));
})
//下拉框筛选
filter_data = filter_data.filter(item => {
if (this.orderHandle.isArriFlight(item)) {
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['preFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key][row_flights['preFlight'][key]]) : (this.formatter[key][row_flights['preFlight'][key]] + '/' + this.formatter[key][row_flights['reaFlight'][key]]);
render_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]];
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
is_satis = false;
break;
}
} else {
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (row_flights['preFlight'][key]) : (row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key]);
render_pre_flight[key] = row_flights['preFlight'][key];
render_rea_flight[key] = row_flights['reaFlight'][key];
}
}
row_flights['renderFlight'] = render_flight;
row_flights['renderPreFlight'] = render_pre_flight;
row_flights['renderReaFlight'] = render_rea_flight;
return is_satis;
} else if (this.orderHandle.isDeptFlight(item)) {
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['reaFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
return is_satis;
} else {
let pre_satis = true;
let rea_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['preFlight'][key] === filterItems[key]) {
pre_satis = true;
continue;
} else {
pre_satis = false;
break;
}
}
}
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['reaFlight'][key] === filterItems[key]) {
rea_satis = true;
continue;
} else {
rea_satis = false;
break;
}
}
}
if (pre_satis && !rea_satis) {
item['renderFlight'] = item['renderPreFlight'];
delete item['reaFlight'];
delete item['renderReaFlight'];
return pre_satis;
} else if (!pre_satis && rea_satis) {
item['renderFlight'] = item['renderReaFlight'];
delete item['preFlight'];
delete item['renderPreFlight'];
return rea_satis;
} else if (pre_satis && rea_satis) {
return pre_satis && rea_satis;
} else {
return false;
}
}
this.combined_data.push(row_flights);
})
//this.doSequence(this.combined_data);
this.render_data = this.combined_data
this.changeDetectorRef.detectChanges();
}
)
/**
*
*/
var tableCont = document.querySelector('#table-container');
function scrollHandle (){
var scrollTop = this.scrollTop;
this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
}
tableCont.addEventListener('scroll',scrollHandle);
}
/**
*
* @param filterItems
* @return
*/
//输入框回车事件
inputEnter() {
if (this.FLT_POS === 1) {
this.selectChange()
} else {
this.selectChange()
this.inputPosition(this.render_data)
}
}
//下拉框选择筛选
selectChange() {
let filter_data = [];
let filterItems = this.filterItems;
this.combined_data.forEach(item => {
filter_data.push(Object.assign({}, item));
})
//下拉框筛选
filter_data = filter_data.filter(item => {
if (item) {
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['preFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
return is_satis;
} else if (item) {
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['reaFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
return is_satis;
} else {
let pre_satis = true;
let rea_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['preFlight'][key] === filterItems[key]) {
pre_satis = true;
continue;
} else {
pre_satis = false;
break;
}
}
}
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['reaFlight'][key] === filterItems[key]) {
rea_satis = true;
continue;
} else {
rea_satis = false;
break;
}
}
}
if (pre_satis && !rea_satis) {
item['renderFlight'] = item['renderPreFlight'];
return pre_satis;
} else if (!pre_satis && rea_satis) {
item['renderFlight'] = item['renderReaFlight'];
return rea_satis;
} else if (pre_satis && rea_satis) {
return pre_satis && rea_satis;
if (this.FLT_POS === 1) {
this.inputFilter(filter_data);
} else {
return false;
this.render_data = filter_data;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
this.changeDetectorRef.detectChanges();
}
}, 10)
}
/**
*
* @param filterData
*/
inputFilter(filterData) {
if (this.SEARCH) {
if (this.SEL_COL) {
let sel_col = this.SEL_COL;
filterData = filterData.filter(item => {
if (item['renderFlight'][sel_col]) {
if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
return true;
}
} else {
return false;
}
})
} else {
filterData = filterData.filter(item => {
let is_satis = false;
let cols = this.col_lists;
for (let i = 0; i < cols.length; i++) {
if (item['renderFlight'][cols[i]['COL_CODE']]) {
if (item['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
is_satis = true;
break;
} else {
is_satis = false;
continue;
}
} else {
is_satis = false;
continue;
}
}
return is_satis;
})
}
}
})
if (this.FLT_POS === 1) {
this.inputFilter(filter_data);
} else {
this.render_data = filter_data;
this.render_data = filterData;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
// this.inputPosition(this.render_data);
this.changeDetectorRef.detectChanges();
this.operateSpinServiceService.hideSpin()
}
}
//输入框筛选
inputFilter(filterData) {
if (this.SEARCH) {
/**
*
*/
positionArray: Array<any> = [];
positionArrayIndex: number = 0;
inputPosition(filterData) {
let transArray = []
if (this.SEL_COL) {
let sel_col = this.SEL_COL;
filterData = filterData.filter(item => {
if (item['renderFlight'][sel_col]) {
if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
return true;
filterData.forEach(element => {
if (element['renderFlight'][sel_col]) {
if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
transArray.push(element)
}
} else {
if (this.SEARCH) {
return false;
} else {
return true;
if (!this.SEARCH) {
transArray.push(element)
}
}
})
});
} else {
filterData = filterData.filter(item => {
let is_satis = false;
for (const key in item['renderFlight']) {
if (item['renderFlight'].hasOwnProperty(key)) {
if (item['renderFlight'][key]) {
if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) {
is_satis = true;
break;
} else {
is_satis = false;
continue;
}
} else {
if (this.SEARCH) {
is_satis = false;
continue;
} else {
is_satis = true;
break;
}
}
} else {
continue;
}
}
return is_satis;
})
}
}
this.render_data = filterData;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
this.changeDetectorRef.detectChanges();
}
positionArray: Array<any> = [];
positionArrayIndex: number = 0;
//输入框定位
inputPosition(filterData) {
let transArray = []
if (this.SEL_COL) {
let sel_col = this.SEL_COL;
filterData.forEach(element => {
if (element['renderFlight'][sel_col]) {
if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
transArray.push(element)
}
} else {
if (!this.SEARCH) {
transArray.push(element)
}
}
});
} else {
filterData.forEach(element => {
for (const key in element['renderFlight']) {
if (element['renderFlight'].hasOwnProperty(key)) {
if (element['renderFlight'][key]) {
if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) {
filterData.forEach(element => {
let cols = this.col_lists;
for (let i = 0; i < cols.length; i++) {
if (element['renderFlight'][cols[i]['COL_CODE']]) {
if (element['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
transArray.push(element)
break;
} else {
@@ -345,35 +389,87 @@ inputPosition(filterData) {
break;
}
}
}
});
}
if (transArray.length > 0) {
if (transArray.toString() == this.positionArray.toString()) {
this.positionArrayIndex++;
if (this.positionArrayIndex === this.positionArray.length) {
this.positionArrayIndex = 0;
}
this.row_state = this.positionArray[this.positionArrayIndex];
} else {
this.positionArray = transArray;
this.positionArrayIndex = 0;
this.row_state = this.positionArray[this.positionArrayIndex];
}
} else {
alert('没有搜索到相关数据');
}
this.changeDetectorRef.detectChanges();
let tr = $(".selected");
let objTr = tr[0];
if (objTr) {
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
}
}
/**
*
* @param i
*/
selectRow(i) {
this.row_state = i;
this.changeDetectorRef.detectChanges();
}
/**
*
* @param col_CODE
* @param flight
*/
getPosition(col_CODE, flight) {
if (this.orderHandle.isDeptFlight(flight)) {
if (col_CODE === 'FLNO' || col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
return 'text-right';
}
} else if (this.orderHandle.isLinked(flight)) {
if (col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
if (!flight['renderPreFlight'][col_CODE] && flight['renderReaFlight'][col_CODE]) {
return 'text-right';
}
}
}
}
/**
*
*/
checkboxChange() {
for (const key in this.checkboxGroup) {
if (this.checkboxGroup.hasOwnProperty(key)) {
if (this.checkboxGroup[key]) {
this.tabClose = false;
break;
} else {
this.tabClose = true;
continue;
}
}
});
}
if (transArray.length > 0) {
if (transArray.toString() == this.positionArray.toString()) {
this.positionArrayIndex++;
if (this.positionArrayIndex === this.positionArray.length) {
this.positionArrayIndex = 0;
}
this.row_state = this.positionArray[this.positionArrayIndex];
} else {
this.positionArray = transArray;
this.positionArrayIndex = 0;
this.row_state = this.positionArray[this.positionArrayIndex];
}
} else {
alert('没有搜索到相关数据');
this.changeDetectorRef.detectChanges()
}
this.changeDetectorRef.detectChanges();
let tr = $(".selected");
let objTr = tr[0];
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
/**
* tab项切换事件
*/
nzClick() {
this.changeDetectorRef.detectChanges();
}
}
@@ -1,13 +1,16 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { NgZorroAntdModule } from 'ng-zorro-antd'
import { HistoricalDataComponent } from './historical-data.component';
import { HistoricalDataRouting } from './historical-data-routing.module';
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
CommonModule,
HistoricalDataRouting,
FormsModule
FormsModule,
NgZorroAntdModule,
HistoricalDataRouting
],
declarations: [HistoricalDataComponent]
})
+8 -17
View File
@@ -5,16 +5,16 @@ 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';
import { OperateSpinServiceService } from '../operate-spin-service.service';
import { BasicDataService } from '../../services/basic-data-service';
import { OperateSpinServiceService } from '../../services/operate-spin-service.service';
import { WebsocketService } from '../../services/websocket.service';
import { DynamicFlightOrder } from './utils/dynamic-flight-order';
import { FlightsDataHandle } from './utils/flights-data-handle';
import { CellColorHandle } from './utils/cell-color-handle';
import { AlertMessageHandle } from './utils/alert-message-handle';
import { DynamicFlightOrder } from '../../utils/dynamic-flight-order';
import { FlightsDataHandle } from '../../utils/flights-data-handle';
import { CellColorHandle } from '../../utils/cell-color-handle';
import { AlertMessageHandle } from '../../utils/alert-message-handle';
import dateFormatter from '../../utils/data-formatter';
import dateFormatter from '../../utils/date-formatter';
import * as $ from 'jquery';
@Component({
@@ -321,16 +321,7 @@ export class MainComponent implements OnInit {
*
*/
refresh() {
// let testss = this.render_data.reverse();
// let tstt = [];
// testss.forEach(element => {
// tstt.push(Object.assign({}, element))
// })
// this.render_data = testss;
// this.changeDetectorRef.detectChanges();
const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '登录成功!', 3000);
const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '刷新成功!', 3000);
this.toastService.toast(toastCfg);
}
@@ -1,89 +0,0 @@
export class AlertMessageHandle{
public alertMessage = {
'FLOP-CNCL':'',
'FLOP-FRET':'',
'FLOP-FDIV':'',
'FLOP-FDEL':'',
'FLOP-DELY':'',
'FLOP-ACTT':'',
'FLOP-GTDT':'',
'FLOP-PSDT':'',
'FLOP-ESTT':'',
'FLOP-PADT':'',
'FLOP-CKDT':'',
'FLOP-BOTM':'',
'FLOP-CLDT':'',
'FLOP-ROUT':'',
'FLOP-VIPP':'',
'FLOP-HNAG':'',
'FLOP-FLBG':'',
'FLOP-RENO':'',
'FLOP-ABTM':'',
'FLOP-CHOT':'',
'FLOP-TRML':'',
}
public flopCncl(){
return '航班取消事件'
}
public flopFret(){
return '航班返航事件'
}
public flopFdiv(){
return '航班备降事件'
}
public flopFdel(){
return '航班删除事件'
}
public flopDely(){
return '航班延误事件'
}
public flopActt(){
return '航班实际时间事件'
}
public flopGtdt(){
return '航班登机门事件'
}
public flopPsdt(){
return '航班机位变更事件'
}
public flopEstt(){
return '航班预计时间事件'
}
public flopPadt(){
return '航班站起飞时间事件'
}
public flopCkdt(){
return '航班值机柜台事件'
}
public flopBotm(){
return '航班登机开始事件'
}
public flopCldt(){
return '航班行李转盘事件'
}
public flopRout(){
return '航班航线事件'
}
public flopVipp(){
return '航班VIP事件'
}
public flopHnag(){
return '航班代理事件'
}
public flopFlbg(){
return '航班首末件行李到达事件'
}
public flopReno(){
return '航班飞机号变更事件'
}
public flopAbtm(){
return '航班靠桥撤桥事件'
}
public flopChdt(){
return '航班上下轮档事件'
}
public flopTrml(){
return '航班航站楼事件'
}
}
@@ -1,185 +0,0 @@
import { DynamicFlightOrder } from './dynamic-flight-order';
export class CellColorHandle {
public orderHandle = new DynamicFlightOrder();
public reno(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['RENO'] && flight['preFlight']['RENO'].indexOf('(') > 0) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['RENO'] && flight['reaFlight']['RENO'].indexOf('(') > 0) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
} else {
if ((flight['preFlight']['RENO'] && flight['preFlight']['RENO'].indexOf('(') > 0) || (flight['reaFlight']['RENO'] && flight['reaFlight']['RENO'].indexOf('(') > 0)) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
}
}
public actt(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
} else {
if (flight['reaFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
}
}
public estt(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
} else {
if (flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
}
}
public sodt(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['SODT'] && !flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
} else {
if (flight['reaFlight']['SODT'] && !flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
}
}
public padt(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['PADT'] && flight['preFlight']['PADT'].indexOf('(') > 0) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['PADT'] && flight['reaFlight']['PADT'].indexOf('(') > 0) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
} else {
if ((flight['preFlight']['PADT'] && flight['preFlight']['PADT'].indexOf('(') > 0) || (flight['reaFlight']['PADT'] && flight['reaFlight']['PADT'].indexOf('(') > 0)) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
}
}
public psst(flight, colorSetting) {
}
public cotm(flight, colorSetting) {
if (flight['renderFlight']['COTM'] && !flight['renderFlight']['CCTM']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return false;
}
}
public cctm(flight, colorSetting) {
if (flight['renderFlight']['CCTM']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return false;
}
}
public botm(flight, colorSetting) {
if (flight['renderFlight']['BOTM'] && !flight['renderFlight']['GCTM']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return false;
}
}
public gctm(flight, colorSetting) {
if (flight['renderFlight']['GCTM']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return false;
}
}
}
@@ -1,307 +0,0 @@
import dateFormatter from '../../../utils/data-formatter';
export class DynamicFlightOrder {
public TOP_1 = 1000000000000;
public TOP_2 = 2000000000000;
public TOP_3 = 3000000000000;
public TOP_4 = 4000000000000;
public TOP_5 = 5000000000000;
public TOP_6 = 6000000000000;
public TOP_7 = 7000000000000;
public TOP_8 = 8000000000000;
public TOP_9 = 9000000000000;
public TOP_10 = 10000000000000;
public TOP_11 = 11000000000000;
public TOP_12 = 12000000000000;
public TOP_13 = 13000000000000;
public TOP_14 = 14000000000000;
/**
*
* @param flight
* @return
*/
public getActualDatetime(flight) {
return flight['ACTT'];
}
/**
*
* @param flight
* @return
*/
public getEstimatedDatetime(flight) {
return flight['ESTT']
}
/**
*
* @param flight
* @return
*/
public getScheduledDatetime(flight) {
return flight['SODT']
}
/**
*
* @param flight
* @return
*/
public isLinked(flight) {
if (flight['preFlight'] && flight['reaFlight']) {
return true
} else {
return false
}
}
/**
*
* @param flight
* @return
*/
public isDeptFlight(flight) {
if (!flight['preFlight'] && flight['reaFlight']) {
return true
} else {
return false
}
}
/**
*
* @param flight
* @return
*/
public isArriFlight(flight) {
if (flight['preFlight'] && !flight['reaFlight']) {
return true;
} else {
return false;
}
}
/**
*
* @param flight
* @return
*/
public isFlying(flight) {
if (this.isArriFlight(flight) || this.isLinked(flight)) {
if (flight['preFlight']['PADT']) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/**
*
* @param flight
* @return
*/
public isCancled(flight) {
if (this.isArriFlight(flight)) {
if (flight['preFlight']['CNCL']) {
return true;
} else {
return false;
}
} else if (this.isDeptFlight(flight)) {
if (flight['reaFlight']['CNCL']) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/**
* ()
* @param flight
* @return
*/
public isDelayed(flight) {
if (this.isDeptFlight(flight) || this.isLinked(flight)) {
if (flight['reaFlight']['DELY']) {
return true
} else {
return false
}
} else {
return false;
}
}
/**
*
* @param flight
* @return
*/
public isDone(flight) {
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
if (!this.getActualDatetime(flight['reaFlight'])) {
return false;
} else {
return true;
}
} else if (this.isArriFlight(flight)) {
if (!this.getActualDatetime(flight['preFlight'])) {
return false;
} else {
return true;
}
} else {
return false;
}
}
/**
*
* @param flight
* @return
*/
public startBoading(flight) {
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
if (!flight['reaFlight']['BOTM']) {
return false;
} else {
return true;
}
} else {
return false;
}
}
/**
*
* @param flight
* @return
*/
public isBoading(flight) {
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
if (flight['reaFlight']['BOTM'] && !(flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM'])) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/**
*
* @param flight
* @return
*/
public isOverBoading(flight) {
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
if (flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM']) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/**
*
* @param flight
* @return
*/
public sequence(flight) {
let dateTag: number = 10;
let dateToCompare = new Date().getTime();
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) {
if (this.isLinked(flight)) {
if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
dateTag = this.TOP_1;
}
else {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
dateTag = this.TOP_2;
}
}
else {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
dateTag = this.TOP_3;
}
return dateToCompare + dateTag;
}
if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
dateTag = this.TOP_4;
return dateToCompare + dateTag;
}
if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) {
if (this.getEstimatedDatetime(flight['preFlight'])) {
dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime();
} else {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
}
dateTag = this.TOP_5;
return dateToCompare + dateTag;
}
if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
dateTag = this.TOP_6;
return dateToCompare + dateTag;
}
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
dateTag = this.TOP_7;
return dateToCompare + dateTag;
}
if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) {
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
dateTag = this.TOP_8;
return dateToCompare + dateTag;
}
if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
dateTag = this.TOP_9;
return dateToCompare + dateTag;
}
if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) {
if (this.isLinked(flight)) {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
dateTag = this.TOP_10;
} else if (this.isArriFlight(flight)) {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
dateTag = this.TOP_11;
}
return dateToCompare + dateTag;
}
if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) {
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime();
dateTag = this.TOP_12;
return dateToCompare + dateTag;
}
if (this.isCancled(flight)) {
if (this.isDeptFlight(flight)) {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
} else {
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
}
dateTag = this.TOP_13;
return dateToCompare + dateTag;
}
return this.TOP_14
}
}
@@ -1,742 +0,0 @@
import gctmFormatter from '../../../utils/gctm-formatter';
import botmFormatter from '../../../utils/botm-formatter';
import abdgFormatter from '../../../utils/abdg-formatter';
import aotm_aFormatter from '../../../utils/aotm_a-formatter';
import aotm_dFormatter from '../../../utils/aotm_d-formatter';
import beltFormatter from '../../../utils/belt-formatter';
import chkcFormatter from '../../../utils/chkc-formatter';
import cctmFormatter from '../../../utils/cctm-formatter';
import cotmFormatter from '../../../utils/cotm-formatter';
import chtmOnFormatter from '../../../utils/chtm_on-formatter';
import chtmOffFormatter from '../../../utils/chtm_off-formatter';
import laclFormatter from '../../../utils/lacl-formatter';
import chutFormatter from '../../../utils/chut-formatter';
import acttFormatter from '../../../utils/actt-formatter';
import psstFormatter from '../../../utils/psst-formatter';
import esttFormatter from '../../../utils/estt-formatter';
import mvinFormatter from '../../../utils/mvin-formatter';
import erutFormatter from '../../../utils/erut-formatter';
import flinFormatter from '../../../utils/flin-formatter';
import sodtFormatter from '../../../utils/sodt-formatter';
import gateFormatter from '../../../utils/gate-formatter';
import padtFormatter from '../../../utils/padt-formatter';
import { DynamicFlightOrder } from './dynamic-flight-order';
export class FlightsDataHandle {
public formatter = {
'GCTM': gctmFormatter,
'BOTM': botmFormatter,
'ABDG': abdgFormatter,
'AOTM_A': aotm_aFormatter,
'AOTM_D': aotm_dFormatter,
'BELT': beltFormatter,
'CHKC': chkcFormatter,
'CCTM': cctmFormatter,
'COTM': cotmFormatter,
'CHTM_ON': chtmOnFormatter,
'CHTM_OFF': chtmOffFormatter,
'LACL': laclFormatter,
'CHUT': chutFormatter,
'ACTT': acttFormatter,
'PSST': psstFormatter,
'ESTT': esttFormatter,
'MVIN': mvinFormatter,
'ERUT': erutFormatter,
'FLIN': flinFormatter,
'SODT': sodtFormatter,
'GATE': gateFormatter,
'PADT': padtFormatter
}
public orderHandle = new DynamicFlightOrder();
public findLinkFlights(raw_flights) {
let combined_raw_flights: Array<any> = [];
let copy_raw_flights = [];
raw_flights.forEach(element => {
copy_raw_flights.push(Object.assign({}, element))
})
for (let i = 0; i < copy_raw_flights.length; i++) {
if (copy_raw_flights[i]['MVIN'] === 'A') {
if (copy_raw_flights[i]['TAID']) {
let index = copy_raw_flights.findIndex(val => { return val['FLID'] === copy_raw_flights[i]['TAID'] });
if (index > -1) {
copy_raw_flights[i]['isLinked'] = true;
copy_raw_flights[i]['linkFlight'] = copy_raw_flights[index];
if (!copy_raw_flights[i]['linkFlight']['TAID']) {
copy_raw_flights[i]['linkFlight']['TAID'] = copy_raw_flights[i]['FLID'];
}
copy_raw_flights.splice(index, 1);
i--;
}
}
}
}
copy_raw_flights.forEach(element => {
let flights_item = {};
if (element['MVIN'] === 'A' && !element['isLinked']) {
flights_item['preFlight'] = element;
} else if (element['MVIN'] === 'D' && !element['isLinked']) {
flights_item['reaFlight'] = element;
} else {
flights_item['reaFlight'] = element['linkFlight'];
delete element['linkFlight'];
delete element['isLinked'];
flights_item['preFlight'] = element;
}
combined_raw_flights.push(flights_item);
});
return combined_raw_flights;
}
public flightsRenderTransfer(item, col_lists) {
let render_flight = {},
render_pre_flight = {},
render_rea_flight = {},
flights_item = Object.assign({}, item)
if (flights_item['preFlight'] && !flights_item['reaFlight']) {
for (let i = 0; i < col_lists.length; i++) {
let key = col_lists[i]['COL_CODE'];
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](flights_item['preFlight']) : flights_item['preFlight'][key];
}
flights_item['renderFlight'] = render_flight;
} else if (!flights_item['preFlight'] && flights_item['reaFlight']) {
for (let i = 0; i < col_lists.length; i++) {
let key = col_lists[i]['COL_CODE']
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](flights_item['reaFlight']) : flights_item['reaFlight'][key];
}
flights_item['renderFlight'] = render_flight;
} else {
for (let i = 0; i < col_lists.length; i++) {
let preHasValue, reaHasValue;
let key = col_lists[i]['COL_CODE'];
if (this.formatter.hasOwnProperty(key)) {
preHasValue = this.formatter[key](flights_item['preFlight']);
reaHasValue = this.formatter[key](flights_item['reaFlight']);
} else {
preHasValue = flights_item['preFlight'][key];
reaHasValue = flights_item['reaFlight'][key];
}
if (preHasValue && !reaHasValue) {
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
render_flight[key] = preHasValue + ' / ';
} else {
render_flight[key] = preHasValue;
}
} else if (!preHasValue && reaHasValue) {
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
render_flight[key] = ' / ' + reaHasValue;
} else {
render_flight[key] = reaHasValue;
}
} else if (preHasValue && reaHasValue) {
if (preHasValue === reaHasValue) {
render_flight[key] = preHasValue;
} else {
if (key === 'ERUT') {
render_flight[key] = preHasValue.split(' - ').slice(0, -1).join(' - ') + ' - ' + reaHasValue;
} else {
render_flight[key] = preHasValue + ' / ' + reaHasValue;
}
}
} else {
render_flight[key] = '';
}
render_pre_flight[key] = preHasValue;
render_rea_flight[key] = reaHasValue;
}
flights_item['renderPreFlight'] = render_pre_flight;
flights_item['renderReaFlight'] = render_rea_flight;
flights_item['renderFlight'] = Object.assign({}, render_flight);
}
return flights_item;
}
public basicDataTransHandle(item, airports, citys, airlines, flightStatus, flightTypes) {
if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) {
//航线处理
let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
let erutChnArray = []
for (let i = 0; i < erutCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
erutChnArray.push(citys[cityIndex].cityNameChn);
} catch (error) {
erutChnArray.push(erutCodeArray[i]);
}
}
item['renderFlight']['ERUT'] = erutChnArray.join(' - ');
//航空公司处理
let airlineIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
item['renderFlight']['ALCD'] = airlines[airlineIndex].airlineName;
//运营状态处理
item['renderFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc;
//航班类型处理
item['renderFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderFlight']['FLTY']).flightTypeNameCn;
} else {
//航线处理
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
let erutLinkChnArray = []
for (let i = 0; i < erutLinkCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
erutLinkChnArray.push(citys[cityIndex].cityNameChn);
} catch (error) {
erutLinkChnArray.push(erutLinkCodeArray[i]);
}
}
item['renderFlight']['ERUT'] = erutLinkChnArray.join(' - ');
//航空公司处理
let airlineLinkIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
item['renderFlight']['ALCD'] = airlines[airlineLinkIndex].airlineName;
//运营状态处理
let ftssLinkCodeArray = item['renderFlight']['FTSS'].split(' / ');
let ftssLinkChnArray = [];
for (let i = 0; i < ftssLinkCodeArray.length; i++) {
ftssLinkChnArray.push(flightStatus.find(val => val.sttc === ftssLinkCodeArray[i]).stdc)
}
item['renderFlight']['FTSS'] = ftssLinkChnArray.join(' / ');
//航班类型处理
let fltyLinkCodeArray = item['renderFlight']['FLTY'].split(' / ');
let fltyLinkChnArray = [];
for (let i = 0; i < fltyLinkCodeArray.length; i++) {
fltyLinkChnArray.push(flightTypes.find(val => val.flightTypeCode === fltyLinkCodeArray[i]).flightTypeNameCn)
}
item['renderFlight']['FLTY'] = fltyLinkChnArray.join(' / ');
//航线处理
let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - ');
let erutPreChnArray = []
for (let i = 0; i < erutPreCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
erutPreChnArray.push(citys[cityIndex].cityNameChn);
} catch (error) {
erutPreChnArray.push(erutPreCodeArray[i]);
}
}
item['renderPreFlight']['ERUT'] = erutPreChnArray.join(' - ');
//航空公司处理
let airlinePreIndex = airlines.findIndex(val => val.airlineCode === item['renderPreFlight']['ALCD']);
item['renderPreFlight']['ALCD'] = airlines[airlinePreIndex].airlineName;
//运营状态处理
item['renderPreFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc
//航班类型处理
item['renderPreFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderPreFlight']['FLTY']).flightTypeNameCn;
//航线处理
let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - ');
let erutReaChnArray = []
for (let i = 0; i < erutReaCodeArray.length; i++) {
try {
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
erutReaChnArray.push(citys[cityIndex].cityNameChn);
} catch (error) {
erutReaChnArray.push(erutReaCodeArray[i]);
}
}
item['renderReaFlight']['ERUT'] = erutReaChnArray.join(' - ');
//航空公司处理
let airlineReaIndex = airlines.findIndex(val => val.airlineCode === item['renderReaFlight']['ALCD']);
item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName;
//运营状态处理
item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc
//航班类型处理
item['renderReaFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderReaFlight']['FLTY']).flightTypeNameCn;
}
return item;
}
public dynamicMessageHandle(message, combined_data, render_data, col_lists, filterItems, LASTSEARCH, LAST_SEL_COL, airports, citys, airlines, flightStatus, flightTypes) {
if (message.MVIN === 'A') {
//针对combined_data的处理
let index = combined_data.findIndex(element => {
if (this.orderHandle.isArriFlight(element) || this.orderHandle.isLinked(element)) {
if (element['preFlight']['FLID'] === message.FLID) {
return true;
} else {
return false;
}
} else {
return false;
}
});
if (index > -1) {
combined_data[index]['preFlight'] = message;
combined_data[index] = this.flightsRenderTransfer(combined_data[index], col_lists);
combined_data[index] = this.basicDataTransHandle(combined_data[index], airports, citys, airlines, flightStatus, flightTypes);
if (message.UPTP === 'FLOP-AOTP') {
if (this.orderHandle.isArriFlight(combined_data[index])) {
if (message.TAID) {
combined_data.splice(index, 1);
let i = combined_data.findIndex(element => {
if (this.orderHandle.isDeptFlight(element)) {
if (message.TAID === element['reaFlight']['FLID']) {
return true;
} else {
return false;
}
} else {
return false;
}
})
combined_data[i]['reaFlight']['TAID'] = message.FLID;
let newFlight = {};
newFlight['preFlight'] = message;
newFlight['reaFlight'] = combined_data[i]['reaFlight'];
combined_data.splice(i, 1);
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
combined_data.push(newFlight)
}
} else if (this.orderHandle.isLinked(combined_data[index])) {
if (!message.TAID) {
let newPreFlight = {},
newReaFlight = {};
newPreFlight['preFlight'] = combined_data[index]['preFlight'];
newPreFlight['renderFlight'] = combined_data[index]['renderPreFlight'];
combined_data.push(newPreFlight);
delete combined_data[index]['reaFlight']['TAID'];
newPreFlight['reaFlight'] = combined_data[index]['reaFlight'];
newPreFlight['renderFlight'] = combined_data[index]['renderReaFlight'];
combined_data.push(newReaFlight);
combined_data.splice(index, 1);
}
}
}
} else {
let newFlight = {};
newFlight['preFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
combined_data.push(newFlight);
}
//针对render_data的处理
let index1 = render_data.findIndex(element => {
if (this.orderHandle.isArriFlight(element) || this.orderHandle.isLinked(element)) {
if (element['preFlight']['FLID'] === message.FLID) {
return true;
} else {
return false;
}
} else {
return false;
}
})
if (index1 > -1) {
render_data[index1]['preFlight'] = message;
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (key === 'Abnormal_state') {
if (render_data[index1]['preFlight'][filterItems[key]]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
} else {
if (render_data[index1]['preFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
}
let search_satis = true;
if (LASTSEARCH) {
if (LAST_SEL_COL) {
if (render_data[index1]['preFlight'][LAST_SEL_COL]) {
if (render_data[index1]['preFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) {
search_satis = true;
} else {
search_satis = false;
}
} else {
search_satis = false;
}
} else {
let cols = col_lists;
for (let i = 0; i < cols.length; i++) {
if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) {
if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(LASTSEARCH, 'i'))) {
search_satis = true;
break;
} else {
search_satis = false;
continue;
}
} else {
search_satis = false;
continue;
}
}
}
}
if (is_satis && search_satis) {
if (message.UPTP === 'FLOP-TAOP') {
if (this.orderHandle.isArriFlight(render_data[index1])) {
if (message.TAID) {
let i = render_data.findIndex(element => {
if (this.orderHandle.isDeptFlight(element)) {
if (message.TAID === element['reaFlight']['FLID']) {
return true;
} else {
return false;
}
} else {
return false;
}
})
if (i > -1) {
render_data.splice(index1, 1);
render_data[i]['reaFlight']['TAID'] = message.FLID;
let newFlight = {};
newFlight['preFlight'] = message;
newFlight['reaFlight'] = render_data[i]['reaFlight'];
render_data.splice(i, 1);
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
render_data.push(newFlight)
}
}
} else if (this.orderHandle.isLinked(render_data[index1])) {
if (!message.TAID) {
let newPreFlight = {},
newReaFlight = {};
delete render_data[index1]['preFlight']['TAID'];
newPreFlight['preFlight'] = render_data[index1]['preFlight'];
newPreFlight['renderFlight'] = render_data[index1]['renderPreFlight'];
delete render_data[index1]['reaFlight']['TAID'];
newPreFlight['reaFlight'] = render_data[index1]['reaFlight'];
newPreFlight['renderFlight'] = render_data[index1]['renderReaFlight'];
render_data.splice(index1, 1);
render_data.push(newPreFlight);
render_data.push(newReaFlight);
}
}
}
} else {
if (this.orderHandle.isArriFlight(render_data[index1])) {
render_data.splice(index1, 1);
} else if (this.orderHandle.isLinked(render_data[index1])) {
delete render_data[index1]['preFlight'];
delete render_data[index1]['renderPreFlight'];
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
}
}
} else {
let newFlight = {};
newFlight['preFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (key === 'Abnormal_state') {
if (newFlight['preFlight'][filterItems[key]]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
} else {
if (newFlight['preFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
}
let search_satis = true;
if (LASTSEARCH) {
if (LAST_SEL_COL) {
if (newFlight['preFlight'][LAST_SEL_COL]) {
if (newFlight['preFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) {
search_satis = true;
} else {
search_satis = false;
}
} else {
search_satis = false;
}
} else {
let cols = col_lists;
for (let i = 0; i < cols.length; i++) {
if (newFlight['renderFlight'][cols[i]['COL_CODE']]) {
if (newFlight['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(LASTSEARCH, 'i'))) {
search_satis = true;
break;
} else {
search_satis = false;
continue;
}
} else {
search_satis = false;
continue;
}
}
}
}
if (is_satis && search_satis) {
let i = render_data.findIndex(element => {
if (this.orderHandle.isDeptFlight(element)) {
if (message.TAID === element['reaFlight']['FLID']) {
return true;
} else {
return false;
}
} else {
return false;
}
})
if (i > -1) {
let newFlight = {};
newFlight['preFlight'] = message;
newFlight['reaFlight'] = Object.assign({}, render_data[i]['reaFlight']);
render_data.splice(i, 1);
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
render_data.push(newFlight);
} else {
render_data.push(newFlight);
}
}
}
} else {
//针对combined_data的处理
let index = combined_data.findIndex(element => {
if (this.orderHandle.isDeptFlight(element) || this.orderHandle.isLinked(element)) {
if (element['reaFlight']['FLID'] === message.FLID) {
return true;
} else {
return false;
}
} else {
return false;
}
});
if (index > -1) {
combined_data[index]['reaFlight'] = message;
combined_data[index] = this.flightsRenderTransfer(combined_data[index], col_lists);
combined_data[index] = this.basicDataTransHandle(combined_data[index], airports, citys, airlines, flightStatus, flightTypes);
} else {
let newFlight = {};
newFlight['reaFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
combined_data.push(newFlight);
}
//针对render_data的处理
let index1 = render_data.findIndex(element => {
if (this.orderHandle.isDeptFlight(element) || this.orderHandle.isLinked(element)) {
if (element['reaFlight']['FLID'] === message.FLID) {
return true;
} else {
return false;
}
} else {
return false;
}
});
if (index1 > -1) {
render_data[index1]['reaFlight'] = message;
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (key === 'Abnormal_state') {
if (render_data[index1]['reaFlight'][filterItems[key]]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
} else {
if (render_data[index1]['reaFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
}
let search_satis = true;
if (LASTSEARCH) {
if (LAST_SEL_COL) {
if (render_data[index1]['reaFlight'][LAST_SEL_COL]) {
if (render_data[index1]['reaFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) {
search_satis = true;
} else {
search_satis = false;
}
} else {
search_satis = false;
}
} else {
let cols = col_lists;
for (let i = 0; i < cols.length; i++) {
if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) {
if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(LASTSEARCH, 'i'))) {
search_satis = true;
break;
} else {
search_satis = false;
continue;
}
} else {
search_satis = false;
continue;
}
}
}
}
if (!is_satis || !search_satis) {
if (this.orderHandle.isDeptFlight(render_data[index1])) {
render_data.splice(index1, 1);
} else if (this.orderHandle.isLinked(render_data[index1])) {
delete render_data[index1]['reaFlight'];
delete render_data[index1]['renderReaFlight'];
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
}
}
} else {
let newFlight = {};
newFlight['reaFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (key === 'Abnormal_state') {
if (newFlight['reaFlight'][filterItems[key]]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
} else {
if (newFlight['reaFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
}
let search_satis = true;
if (LASTSEARCH) {
if (LAST_SEL_COL) {
if (newFlight['reaFlight'][LAST_SEL_COL]) {
if (newFlight['reaFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) {
search_satis = true;
} else {
search_satis = false;
}
} else {
search_satis = false;
}
} else {
let cols = col_lists;
for (let i = 0; i < cols.length; i++) {
if (newFlight['renderFlight'][cols[i]['COL_CODE']]) {
if (newFlight['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(LASTSEARCH, 'i'))) {
search_satis = true;
break;
} else {
search_satis = false;
continue;
}
} else {
search_satis = false;
continue;
}
}
}
}
if (is_satis && search_satis) {
let i = render_data.findIndex(element => {
if (this.orderHandle.isArriFlight(element)) {
if (message.TAID === element['preFlight']['FLID']) {
return true;
} else {
return false;
}
} else {
return false;
}
})
if (i > -1) {
let newFlight = {};
newFlight['reaFlight'] = message;
newFlight['preFlight'] = Object.assign({}, render_data[i]['preFlight']);
render_data.splice(i, 1);
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
render_data.push(newFlight);
} else {
render_data.push(newFlight);
}
}
}
}
return {
'combined_data': combined_data,
'render_data': render_data
}
}
}
@@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { OperateSpinServiceService } from './operate-spin-service.service';
describe('OperateSpinServiceService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [OperateSpinServiceService]
});
});
it('should be created', inject([OperateSpinServiceService], (service: OperateSpinServiceService) => {
expect(service).toBeTruthy();
}));
});
@@ -1,23 +0,0 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
@Injectable()
export class OperateSpinServiceService {
constructor() { }
public spinSubject = new Subject();
public isSpinning: boolean = false;
public showSpin() {
this.isSpinning = true;
this.spinSubject.next(this.isSpinning);
}
public hideSpin() {
this.isSpinning = false;
setTimeout(() => {
this.spinSubject.next(this.isSpinning);
}, 500)
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { BasicDataService } from './basic-data-service';
import { OperateSpinServiceService } from './operate-spin-service.service';
import { BasicDataService } from '../services/basic-data-service';
import { OperateSpinServiceService } from '../services/operate-spin-service.service';
import { HttpClientService } from '../services/http-client.service';
import { ToastService } from '../components/toast/toast.service';
+2 -2
View File
@@ -8,8 +8,8 @@ import { PagesRoutingModule } from './pages-routing.module';
import { SidebarMenuModule } from '../components/sidebar-menu/sidebar-menu.module';
import { BarMenuModule } from '../components/bar-menu/bar-menu.module';
import { BasicDataService } from './basic-data-service';
import { OperateSpinServiceService } from './operate-spin-service.service';
import { BasicDataService } from '../services/basic-data-service';
import { OperateSpinServiceService } from '../services/operate-spin-service.service';
@NgModule({
imports: [
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { HttpClientService } from '../../services/http-client.service';
import { BasicDataService } from '../basic-data-service';
import { BasicDataService } from '../../services/basic-data-service';
import { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery';
@Component({