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

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
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ChangeDetectorRef } 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'; import * as $ from 'jquery';
@Component({ @Component({
selector: 'app-city', selector: 'app-city',
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@@ -1,189 +1,146 @@
<div class="main-page"> <div class="main-page">
<div class="page-content"> <div class="page-content">
<div class="search-filter mb-3"> <div class="search-filter mb-3">
<div class="first-condition row"> <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"> <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=""> <select [(ngModel)]="SEL_COL" class="mr-4 form-control" name="" id="">
<option value="">选择列名</option> <option value="">选择列名</option>
<option value="">航班号</option> <option *ngFor="let airline_col of render_col_lists" [value]="airline_col.COL_CODE">{{airline_col.COL_CN}}</option>
<option value="">飞机号</option> </select>
<option value="">航线</option> <label class="radio-inline custom-radio nowrap mr-4">
<option value="">前站起飞时间</option> <input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
<option value="">计划到达/出发</option> <span>过滤</span>
<option value="">预计到达/出发</option> </label>
<option value="">实际到达/出发</option> <label class="radio-inline custom-radio nowrap mr-4">
<option value="">机型</option> <input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
<option value="">停机</option> <span>查找定</span>
<option value="">登机门</option> </label>
<option value="">商调完成</option> <input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter)="inputEnter()">
<option value="">值机打开</option> </div>
<option value="">值机关闭</option> <div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
<option value="">登机开始</option> <button type="button" class="btn btn-info mr-3" (click)="refresh()">刷新</button>
<option value="">登机结束</option> </div>
</select> </div>
<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="second-condition mb-3 row"> <div class="second-condition mb-3 row">
<div class="input-container mr-4"> <div class="input-container mr-4">
<label for="airlineId">航空公司:&nbsp;&nbsp;</label> <label for="">航空公司:&nbsp;&nbsp;</label>
<select class="form-control" (ngModelChange)="selectChange()"> <select [(ngModel)]="filterItems.ALCD" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option> <option value=""></option>
<!-- <option *ngFor="let item of airlines" [value]="item.airlineId">{{item.airlineName}}</option> --> <option *ngFor="let airline of airlinesSelections" [value]="airline.airlineCodeIata">{{airline.airlineName}}</option>
</select> </select>
</div> </div>
<div class="input-container mr-4"> <div class="input-container mr-4">
<label for="routeType">航线类别:&nbsp;&nbsp;</label> <label for="">航线类别:&nbsp;&nbsp;</label>
<select class="form-control" [(ngModel)]="filterItems.TT" (ngModelChange)="selectChange()"> <select [(ngModel)]="filterItems.FLIN" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option> <option value=""></option>
<option value="D">国内</option> <option value="D">国内</option>
<option value="I">国际</option> <option value="I">国际</option>
<option value="M">混合</option> <option value="M">混合</option>
<option value="R">地区</option> <option value="R">地区</option>
<!-- <option *ngFor="let item of seasonals" [value]="item.routeType">{{item.routeType}}</option> --> </select>
</select> </div>
</div> <div class="input-container mr-4">
<div class="input-container mr-4"> <label for="">航班类别:&nbsp;&nbsp;</label>
<label for="flightTask">航班任务:&nbsp;&nbsp;</label> <select [(ngModel)]="filterItems.FLTY" (ngModelChange)="selectChange()" class="form-control">
<select class="form-control" [(ngModel)]="filterItems.flightTask" (ngModelChange)="selectChange()"> <option value=""></option>
<option value=""></option> <option *ngFor="let type of flightTypeSelections" [value]="type.flightTypeCode">{{type.flightTypeNameCn}}</option>
<option value="S">正班</option> </select>
<option value="N">包机</option> </div>
<option value="E">急救</option> <div class="input-container mr-4">
<option value="B">专机</option> <label for="">到达/出发:</label>
<option value="G">通用</option> <select [(ngModel)]="filterItems.MVIN" (ngModelChange)="selectChange()" class="form-control">
<option value="J">加班</option> <option value=""></option>
<option value="M">军用</option> <option value="A">到达</option>
<option value="Q">补班</option> <option value="D">离港</option>
<option value="X">其他</option> </select>
<option value="A">计划外</option> </div>
<!-- <option *ngFor="let item of seasonals" [value]="item.flightTask">{{item.flightTask}}</option> --> <div class="input-container mr-4">
</select> <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>
<div class="input-container mr-4"> <div class="airline-table">
<label for="arriOrDept">到达/出发:&nbsp;&nbsp;</label> <div id="table-container" class="table-container" [ngClass]="{'table-c': !tabClose,'table-o': tabClose}">
<select class="form-control" [(ngModel)]="filterItems.arriOrDept" (ngModelChange)="selectChange()"> <table id="table" class="table table-bordered table-striped">
<option value=""></option> <thead>
<option value="A">到达</option> <tr>
<option value="D">出发</option> <th>序号</th>
<!-- <option *ngFor="let item of seasonals" [value]="item.arriOrDept">{{item.arriOrDept}}</option> --> <th *ngFor="let airline_col of render_col_lists">{{airline_col.COL_CN}}</th>
</select> </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>
<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>
<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> </div>
@@ -1,337 +1,381 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ChangeDetectorRef } 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 { HttpClientService } from '../../services/http-client.service';
import dateFormatter from '../../utils/data-formatter'; import { BasicDataService } from '../../services/basic-data-service';
import { HttpParams } from '@angular/common/http'; 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'; import * as $ from 'jquery';
@Component({ @Component({
selector: 'app-historical-data', selector: 'app-historical-data',
templateUrl: './historical-data.component.html', templateUrl: './historical-data.component.html',
styleUrls: ['./historical-data.component.scss'] styleUrls: ['./historical-data.component.scss']
}) })
export class HistoricalDataComponent implements OnInit { export class HistoricalDataComponent implements OnInit {
constructor( constructor(
private httpCilent: HttpClientService, private basicDataService: BasicDataService,
private changeDetectorRef: ChangeDetectorRef private operateSpinServiceService: OperateSpinServiceService,
) { } private httpCilent: HttpClientService,
private toastService: ToastService,
public raw_data: Array<object> = []; //原始数据,即航班计划 private changeDetectorRef: ChangeDetectorRef,
) {
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据 this.operateSpinServiceService.showSpin();
this.changeDetectorRef.detach();
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
} }
} public orderHandle = new DynamicFlightOrder();
public dataHandle = new FlightsDataHandle();
ngOnInit() { public tabClose: boolean = true;
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));
});
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 => { public airlinesSelections: Array<any> = [];
let row_flights = {}; public flightTypeSelections: Array<any> = [];
let render_flight = {};
let render_pre_flight = {};
let render_rea_flight = {};
row_flights['preFlight'] = element;
for (let i = 0; i < this.historical_lists.length; i++) { public raw_data: Array<object> = []; //原始数据,未经过任何转换和组合
let key = this.historical_lists[i]['COL_CODE'] public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
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 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'] var tableCont = document.querySelector('#table-container')
if (this.formatter.hasOwnProperty(key)) { function scrollHandle() {
if (typeof (this.formatter[key]) === 'function') { var scrollTop = this.scrollTop;
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)); this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
render_pre_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1); }
render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1); 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 { } 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]]); is_satis = false;
render_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]]; break;
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
} }
} 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; return is_satis;
row_flights['renderPreFlight'] = render_pre_flight; } else if (this.orderHandle.isDeptFlight(item)) {
row_flights['renderReaFlight'] = render_rea_flight; 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); if (this.FLT_POS === 1) {
this.render_data = this.combined_data this.inputFilter(filter_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;
} else { } 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;
})
} }
} }
}) this.render_data = filterData;
if (this.FLT_POS === 1) {
this.inputFilter(filter_data);
} else {
this.render_data = filter_data;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
// this.inputPosition(this.render_data);
this.changeDetectorRef.detectChanges(); 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) { if (this.SEL_COL) {
let sel_col = this.SEL_COL; let sel_col = this.SEL_COL;
filterData = filterData.filter(item => { filterData.forEach(element => {
if (item['renderFlight'][sel_col]) { if (element['renderFlight'][sel_col]) {
if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
return true; transArray.push(element)
} }
} else { } else {
if (this.SEARCH) { if (!this.SEARCH) {
return false; transArray.push(element)
} else {
return true;
} }
} }
}) });
} else { } else {
filterData = filterData.filter(item => { filterData.forEach(element => {
let is_satis = false; let cols = this.col_lists;
for (const key in item['renderFlight']) { for (let i = 0; i < cols.length; i++) {
if (item['renderFlight'].hasOwnProperty(key)) { if (element['renderFlight'][cols[i]['COL_CODE']]) {
if (item['renderFlight'][key]) { if (element['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
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'))) {
transArray.push(element) transArray.push(element)
break; break;
} else { } else {
@@ -345,35 +389,87 @@ inputPosition(filterData) {
break; 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 { } else {
this.tabClose = true;
continue; 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 { this.changeDetectorRef.detectChanges()
alert('没有搜索到相关数据');
} }
this.changeDetectorRef.detectChanges(); /**
* tab项切换事件
let tr = $(".selected"); */
let objTr = tr[0]; nzClick() {
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); this.changeDetectorRef.detectChanges();
} }
} }
@@ -1,13 +1,16 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { NgZorroAntdModule } from 'ng-zorro-antd'
import { HistoricalDataComponent } from './historical-data.component'; import { HistoricalDataComponent } from './historical-data.component';
import { HistoricalDataRouting } from './historical-data-routing.module'; import { HistoricalDataRouting } from './historical-data-routing.module';
import { FormsModule } from '@angular/forms';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
HistoricalDataRouting, FormsModule,
FormsModule NgZorroAntdModule,
HistoricalDataRouting
], ],
declarations: [HistoricalDataComponent] 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 { ToastConfig, ToastType } from '../../components/toast/toast-model';
import { HttpClientService } from '../../services/http-client.service'; import { HttpClientService } from '../../services/http-client.service';
import { BasicDataService } from '../basic-data-service'; import { BasicDataService } from '../../services/basic-data-service';
import { OperateSpinServiceService } from '../operate-spin-service.service'; import { OperateSpinServiceService } from '../../services/operate-spin-service.service';
import { WebsocketService } from '../../services/websocket.service'; import { WebsocketService } from '../../services/websocket.service';
import { DynamicFlightOrder } from './utils/dynamic-flight-order'; import { DynamicFlightOrder } from '../../utils/dynamic-flight-order';
import { FlightsDataHandle } from './utils/flights-data-handle'; import { FlightsDataHandle } from '../../utils/flights-data-handle';
import { CellColorHandle } from './utils/cell-color-handle'; import { CellColorHandle } from '../../utils/cell-color-handle';
import { AlertMessageHandle } from './utils/alert-message-handle'; import { AlertMessageHandle } from '../../utils/alert-message-handle';
import dateFormatter from '../../utils/data-formatter'; import dateFormatter from '../../utils/date-formatter';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -321,16 +321,7 @@ export class MainComponent implements OnInit {
* 刷新 * 刷新
*/ */
refresh() { refresh() {
// let testss = this.render_data.reverse(); const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '刷新成功!', 3000);
// let tstt = [];
// testss.forEach(element => {
// tstt.push(Object.assign({}, element))
// })
// this.render_data = testss;
// this.changeDetectorRef.detectChanges();
const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '登录成功!', 3000);
this.toastService.toast(toastCfg); this.toastService.toast(toastCfg);
} }
+2 -2
View File
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router'; import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { BasicDataService } from './basic-data-service'; import { BasicDataService } from '../services/basic-data-service';
import { OperateSpinServiceService } from './operate-spin-service.service'; import { OperateSpinServiceService } from '../services/operate-spin-service.service';
import { HttpClientService } from '../services/http-client.service'; import { HttpClientService } from '../services/http-client.service';
import { ToastService } from '../components/toast/toast.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 { SidebarMenuModule } from '../components/sidebar-menu/sidebar-menu.module';
import { BarMenuModule } from '../components/bar-menu/bar-menu.module'; import { BarMenuModule } from '../components/bar-menu/bar-menu.module';
import { BasicDataService } from './basic-data-service'; import { BasicDataService } from '../services/basic-data-service';
import { OperateSpinServiceService } from './operate-spin-service.service'; import { OperateSpinServiceService } from '../services/operate-spin-service.service';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { HttpClientService } from '../../services/http-client.service'; 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 { ChangeDetectorRef } from '@angular/core';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
@@ -1,5 +1,5 @@
import { Pipe, PipeTransform, OnInit } from '@angular/core'; import { Pipe, PipeTransform, OnInit } from '@angular/core';
import { BasicDataService } from '../../pages/basic-data-service'; import { BasicDataService } from '../../services/basic-data-service';
@Pipe({ @Pipe({
name: 'terminalArea' name: 'terminalArea'
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClientService } from '../services/http-client.service'; import { HttpClientService } from './http-client.service';
import { Subject, forkJoin, zip } from 'rxjs' import { Subject, forkJoin, zip } from 'rxjs'
@Injectable() @Injectable()
-20
View File
@@ -1,20 +0,0 @@
/**
* 登机桥显示转换
*/
export default function (flight) {
if(flight['ABTM']){
if(Array.isArray(flight['ABTM'])&&flight['ABTM'].length>0){
let abdg = [];
for (let i = 0; i < flight['ABTM'].length; i++) {
abdg.push(flight['ABTM'][i]['ABDG']);
}
let set = new Set(abdg);
return Array.from(set).join(',');
}else{
return ''
}
}else{
return '';
}
}
-11
View File
@@ -1,11 +0,0 @@
/**
* 实际到达/出发时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['ACTT']) {
return timeFormatter(flight['ACTT']);
} else {
return '';
}
}
-20
View File
@@ -1,20 +0,0 @@
/**
* 登机桥靠桥时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['ABTM']) {
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
for (let i = 0; i < flight['ABTM'].length; i++) {
if (flight['ABTM'][i]['ABOP'] === 'A') {
return timeFormatter(flight['ABTM'][i]['AOTM']);
}
}
} else {
return '';
}
} else {
return '';
}
}
-20
View File
@@ -1,20 +0,0 @@
/**
* 登机桥撤桥时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['ABTM']) {
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
for (let i = 0; i < flight['ABTM'].length; i++) {
if (flight['ABTM'][i]['ABOP'] === 'D') {
return timeFormatter(flight['ABTM'][i]['AOTM']);
}
}
} else {
return '';
}
} else {
return '';
}
}
-20
View File
@@ -1,20 +0,0 @@
/**
* 转盘号显示转换
*/
export default function (flight) {
if (flight['CLDT']) {
if (Array.isArray(flight['CLDT']) && flight['CLDT'].length > 0) {
let belt = [];
for (let i = 0; i < flight['CLDT'].length; i++) {
belt.push(flight['CLDT'][i]['BELT']);
}
let set = new Set(belt);
return Array.from(set).join(',');
} else {
return '';
}
} else {
return '';
}
}
-13
View File
@@ -1,13 +0,0 @@
/**
* 登机开始时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['BOTM']) {
return timeFormatter(flight['BOTM']);
} else {
return '';
}
}
-15
View File
@@ -1,15 +0,0 @@
/**
* 值机结束时间显示转换
*/
import timeFormatter from './time-formatter';
export default function(flight){
if(flight['CKDT']){
if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){
return timeFormatter(flight['CKDT'][0]['CCTM']);
}else{
return '';
}
}else{
return '';
}
}
-19
View File
@@ -1,19 +0,0 @@
/**
* 值机柜台显示转换
*/
export default function(flight){
if(flight['CKDT']){
if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){
let chkc = [];
for (let i = 0; i < flight['CKDT'].length; i++) {
chkc.push(flight['CKDT'][i]['CHKC']);
}
let set = new Set(chkc);
return Array.from(set).join(',');
}else{
return '';
}
}else{
return '';
}
}
-20
View File
@@ -1,20 +0,0 @@
/**
* 下轮档时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['CHOT']) {
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
for (let i = 0; i < flight['CHOT'].length; i++) {
if (flight['CHOT'][i]['CHID'] === 'OFF') {
return timeFormatter(flight['CHOT'][i]['CHTM']);
}
}
} else {
return '';
}
} else {
return '';
}
}
-20
View File
@@ -1,20 +0,0 @@
/**
* 上轮档时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['CHOT']) {
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
for (let i = 0; i < flight['CHOT'].length; i++) {
if (flight['CHOT'][i]['CHID'] === 'ON') {
return timeFormatter(flight['CHOT'][i]['CHTM']);
}
}
} else {
return '';
}
} else {
return '';
}
}
-19
View File
@@ -1,19 +0,0 @@
/**
* 行李传送带号显示转换
*/
export default function (flight) {
if(flight['CHDT']){
if(Array.isArray(flight['CHDT'])&&flight['CHDT'].length>0){
let chdt = [];
for (let i = 0; i < flight['CHDT'].length; i++) {
chdt.push(flight['CHDT'][i]['CHUT']);
}
let set = new Set(chdt);
return Array.from(set).join(',');
}else{
return '';
}
}else{
return '';
}
}
-15
View File
@@ -1,15 +0,0 @@
/**
* 值机结束时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['CKDT']) {
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
return timeFormatter(flight['CKDT'][0]['COTM']);
} else {
return '';
}
} else {
return '';
}
}
@@ -1,4 +1,4 @@
import dateFormatter from '../../../utils/data-formatter'; import dateFormatter from './date-formatter';
export class DynamicFlightOrder { export class DynamicFlightOrder {
public TOP_1 = 1000000000000; public TOP_1 = 1000000000000;
-18
View File
@@ -1,18 +0,0 @@
/**
* 航线显示转换
*/
export default function(flight){
if(flight['ERUT']){
if(Array.isArray(flight['ERUT'])&&flight['ERUT'].length>0){
let erut = [];
for (let i = 0; i < flight['ERUT'].length; i++) {
erut.push(flight['ERUT'][i]['APCD']);
}
return erut.join(' - ');
}else{
return '';
}
}else{
return '';
}
}
-11
View File
@@ -1,11 +0,0 @@
/**
* 预计到达/出发时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['ESTT']) {
return timeFormatter(flight['ESTT']);
} else {
return '';
}
}
@@ -1,52 +1,32 @@
import gctmFormatter from '../../../utils/gctm-formatter'; import { TransferRenderHandle } from './transfer-render-handle';
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'; import { DynamicFlightOrder } from './dynamic-flight-order';
export class FlightsDataHandle { export class FlightsDataHandle {
public transferHandle = new TransferRenderHandle();
public formatter = { public formatter = {
'GCTM': gctmFormatter, 'GCTM': this.transferHandle.gctmFormatter.bind(this.transferHandle),
'BOTM': botmFormatter, 'BOTM': this.transferHandle.botmFormatter.bind(this.transferHandle),
'ABDG': abdgFormatter, 'ABDG': this.transferHandle.abdgFormatter.bind(this.transferHandle),
'AOTM_A': aotm_aFormatter, 'AOTM_A': this.transferHandle.aotm_aFormatter.bind(this.transferHandle),
'AOTM_D': aotm_dFormatter, 'AOTM_D': this.transferHandle.aotm_dFormatter.bind(this.transferHandle),
'BELT': beltFormatter, 'BELT': this.transferHandle.beltFormatter.bind(this.transferHandle),
'CHKC': chkcFormatter, 'CHKC': this.transferHandle.chkcFormatter.bind(this.transferHandle),
'CCTM': cctmFormatter, 'CCTM': this.transferHandle.cctmFormatter.bind(this.transferHandle),
'COTM': cotmFormatter, 'COTM': this.transferHandle.cotmFormatter.bind(this.transferHandle),
'CHTM_ON': chtmOnFormatter, 'CHTM_ON': this.transferHandle.chtmOnFormatter.bind(this.transferHandle),
'CHTM_OFF': chtmOffFormatter, 'CHTM_OFF': this.transferHandle.chtmOffFormatter.bind(this.transferHandle),
'LACL': laclFormatter, 'LACL': this.transferHandle.laclFormatter.bind(this.transferHandle),
'CHUT': chutFormatter, 'CHUT': this.transferHandle.chutFormatter.bind(this.transferHandle),
'ACTT': acttFormatter, 'ACTT': this.transferHandle.acttFormatter.bind(this.transferHandle),
'PSST': psstFormatter, 'PSST': this.transferHandle.psstFormatter.bind(this.transferHandle),
'ESTT': esttFormatter, 'ESTT': this.transferHandle.esttFormatter.bind(this.transferHandle),
'MVIN': mvinFormatter, 'MVIN': this.transferHandle.mvinFormatter.bind(this.transferHandle),
'ERUT': erutFormatter, 'ERUT': this.transferHandle.erutFormatter.bind(this.transferHandle),
'FLIN': flinFormatter, 'FLIN': this.transferHandle.flinFormatter.bind(this.transferHandle),
'SODT': sodtFormatter, 'SODT': this.transferHandle.sodtFormatter.bind(this.transferHandle),
'GATE': gateFormatter, 'GATE': this.transferHandle.gateFormatter.bind(this.transferHandle),
'PADT': padtFormatter 'PADT': this.transferHandle.padtFormatter.bind(this.transferHandle)
} }
public orderHandle = new DynamicFlightOrder(); public orderHandle = new DynamicFlightOrder();
-16
View File
@@ -1,16 +0,0 @@
/**
* 航线类别显示转换
*/
const flinChn = {
'D': '国内',
'I': '国际',
'M': '混合',
'R': '地区'
}
export default function (flight) {
if (flight['FLIN']) {
return flinChn[flight['FLIN']];
} else {
return '';
}
}
-20
View File
@@ -1,20 +0,0 @@
/**
* 登机门显示转换
*/
export default function (flight) {
if (flight['GTDT']) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
let gate = [];
for (let i = 0; i < flight['GTDT'].length; i++) {
gate.push(flight['GTDT'][i]['GATE']);
}
let set = new Set(gate);
return Array.from(set).join(',');
} else {
return '';
}
} else {
return '';
}
}
-16
View File
@@ -1,16 +0,0 @@
/**
* 登机结束时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['GTDT']) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
return timeFormatter(flight['GTDT'][0]['GCTM']);
} else {
return '';
}
} else {
return '';
}
}
-11
View File
@@ -1,11 +0,0 @@
/**
* 最后通知时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['LACL']) {
return timeFormatter(flight['LACL']);
} else {
return '';
}
}
-14
View File
@@ -1,14 +0,0 @@
/**
* 到达/出发显示转换
*/
export default function (flight) {
if (flight['MVIN']) {
if (flight['MVIN'] === 'A') {
return '到达';
} else if (flight['MVIN'] === 'D') {
return '出发';
}
} else {
return '';
}
}
-11
View File
@@ -1,11 +0,0 @@
/**
* 前站起飞时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['PADT']) {
return timeFormatter(flight['PADT']);
} else {
return '';
}
}
-19
View File
@@ -1,19 +0,0 @@
/**
* 计划停机位显示转换
*/
export default function(flight){
if(flight['PSDT']){
if(Array.isArray(flight['PSDT'])&&flight['PSDT'].length>0){
let chkc = [];
for (let i = 0; i < flight['PSDT'].length; i++) {
chkc.push(flight['PSDT'][i]['PSST']);
}
let set = new Set(chkc);
return Array.from(set).join(',');
}else{
return '';
}
}else{
return '';
}
}
-11
View File
@@ -1,11 +0,0 @@
/**
* 计划到达/出发时间显示转换
*/
import timeFormatter from './time-formatter';
export default function (flight) {
if (flight['SODT']) {
return timeFormatter(flight['SODT']);
} else {
return '';
}
}
+274
View File
@@ -0,0 +1,274 @@
import timeFormatter from './time-formatter';
export class TransferRenderHandle {
public gctmFormatter(flight) {
if (flight['GTDT']) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
return timeFormatter(flight['GTDT'][0]['GCTM']);
} else {
return '';
}
} else {
return '';
}
}
public botmFormatter(flight) {
if (flight['BOTM']) {
return timeFormatter(flight['BOTM']);
} else {
return '';
}
}
public abdgFormatter(flight) {
if (flight['ABTM']) {
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
let abdg = [];
for (let i = 0; i < flight['ABTM'].length; i++) {
abdg.push(flight['ABTM'][i]['ABDG']);
}
let set = new Set(abdg);
return Array.from(set).join(',');
} else {
return ''
}
} else {
return '';
}
}
public aotm_aFormatter(flight) {
if (flight['ABTM']) {
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
for (let i = 0; i < flight['ABTM'].length; i++) {
if (flight['ABTM'][i]['ABOP'] === 'A') {
return timeFormatter(flight['ABTM'][i]['AOTM']);
}
}
} else {
return '';
}
} else {
return '';
}
}
public aotm_dFormatter(flight) {
if (flight['ABTM']) {
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
for (let i = 0; i < flight['ABTM'].length; i++) {
if (flight['ABTM'][i]['ABOP'] === 'D') {
return timeFormatter(flight['ABTM'][i]['AOTM']);
}
}
} else {
return '';
}
} else {
return '';
}
}
public beltFormatter(flight) {
if (flight['CLDT']) {
if (Array.isArray(flight['CLDT']) && flight['CLDT'].length > 0) {
let belt = [];
for (let i = 0; i < flight['CLDT'].length; i++) {
belt.push(flight['CLDT'][i]['BELT']);
}
let set = new Set(belt);
return Array.from(set).join(',');
} else {
return '';
}
} else {
return '';
}
}
public chkcFormatter(flight) {
if (flight['CKDT']) {
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
let chkc = [];
for (let i = 0; i < flight['CKDT'].length; i++) {
chkc.push(flight['CKDT'][i]['CHKC']);
}
let set = new Set(chkc);
return Array.from(set).join(',');
} else {
return '';
}
} else {
return '';
}
}
public cctmFormatter(flight) {
if (flight['CKDT']) {
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
return timeFormatter(flight['CKDT'][0]['CCTM']);
} else {
return '';
}
} else {
return '';
}
}
public cotmFormatter(flight) {
if (flight['CKDT']) {
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
return timeFormatter(flight['CKDT'][0]['COTM']);
} else {
return '';
}
} else {
return '';
}
}
public chtmOnFormatter(flight) {
if (flight['CHOT']) {
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
for (let i = 0; i < flight['CHOT'].length; i++) {
if (flight['CHOT'][i]['CHID'] === 'ON') {
return timeFormatter(flight['CHOT'][i]['CHTM']);
}
}
} else {
return '';
}
} else {
return '';
}
}
public chtmOffFormatter(flight) {
if (flight['CHOT']) {
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
for (let i = 0; i < flight['CHOT'].length; i++) {
if (flight['CHOT'][i]['CHID'] === 'OFF') {
return timeFormatter(flight['CHOT'][i]['CHTM']);
}
}
} else {
return '';
}
} else {
return '';
}
}
public laclFormatter(flight) {
if (flight['LACL']) {
return timeFormatter(flight['LACL']);
} else {
return '';
}
}
public chutFormatter(flight) {
if (flight['CHDT']) {
if (Array.isArray(flight['CHDT']) && flight['CHDT'].length > 0) {
let chdt = [];
for (let i = 0; i < flight['CHDT'].length; i++) {
chdt.push(flight['CHDT'][i]['CHUT']);
}
let set = new Set(chdt);
return Array.from(set).join(',');
} else {
return '';
}
} else {
return '';
}
}
public acttFormatter(flight) {
if (flight['ACTT']) {
return timeFormatter(flight['ACTT']);
} else {
return '';
}
}
public psstFormatter(flight) {
if (flight['PSDT']) {
if (Array.isArray(flight['PSDT']) && flight['PSDT'].length > 0) {
let chkc = [];
for (let i = 0; i < flight['PSDT'].length; i++) {
chkc.push(flight['PSDT'][i]['PSST']);
}
let set = new Set(chkc);
return Array.from(set).join(',');
} else {
return '';
}
} else {
return '';
}
}
public esttFormatter(flight) {
if (flight['ESTT']) {
return timeFormatter(flight['ESTT']);
} else {
return '';
}
}
public mvinFormatter(flight) {
if (flight['MVIN']) {
if (flight['MVIN'] === 'A') {
return '到达';
} else if (flight['MVIN'] === 'D') {
return '出发';
}
} else {
return '';
}
}
public erutFormatter(flight) {
if (flight['ERUT']) {
if (Array.isArray(flight['ERUT']) && flight['ERUT'].length > 0) {
let erut = [];
for (let i = 0; i < flight['ERUT'].length; i++) {
erut.push(flight['ERUT'][i]['APCD']);
}
return erut.join(' - ');
} else {
return '';
}
} else {
return '';
}
}
public flinFormatter(flight) {
const flinChn = {
'D': '国内',
'I': '国际',
'M': '混合',
'R': '地区'
}
if (flight['FLIN']) {
return flinChn[flight['FLIN']];
} else {
return '';
}
}
public sodtFormatter(flight) {
if (flight['SODT']) {
return timeFormatter(flight['SODT']);
} else {
return '';
}
}
public gateFormatter(flight) {
if (flight['GTDT']) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
let gate = [];
for (let i = 0; i < flight['GTDT'].length; i++) {
gate.push(flight['GTDT'][i]['GATE']);
}
let set = new Set(gate);
return Array.from(set).join(',');
} else {
return '';
}
} else {
return '';
}
}
public padtFormatter(flight) {
if (flight['PADT']) {
return timeFormatter(flight['PADT']);
} else {
return '';
}
}
}