数据处理格式调整 -- 单独到/离港航班对象
This commit is contained in:
@@ -7,14 +7,14 @@
|
|||||||
<option value="">选择列名</option>
|
<option value="">选择列名</option>
|
||||||
</select>
|
</select>
|
||||||
<label class="radio-inline custom-radio nowrap mr-4">
|
<label class="radio-inline custom-radio nowrap mr-4">
|
||||||
<input type="radio" value="" name="filter-position">
|
<input type="radio" [(ngModel)]="filterItems.FLT_POS" value="1" name="filter-position">
|
||||||
<span>过滤</span>
|
<span>过滤</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="radio-inline custom-radio nowrap mr-4">
|
<label class="radio-inline custom-radio nowrap mr-4">
|
||||||
<input type="radio" value="" name="filter-position">
|
<input type="radio" [(ngModel)]="filterItems.FLT_POS" value="2" name="filter-position">
|
||||||
<span>查找定位</span>
|
<span>查找定位</span>
|
||||||
</label>
|
</label>
|
||||||
<input class="form-control" type="text">
|
<input class="form-control" [(ngModel)]="filterItems.SEARCH" type="text">
|
||||||
</div>
|
</div>
|
||||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
<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>
|
||||||
@@ -27,20 +27,28 @@
|
|||||||
<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="">航空公司: </label>
|
<label for="">航空公司: </label>
|
||||||
<select class="form-control" name="" id="">
|
<select [(ngModel)]="filterItems.ALCD" class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">航线类别: </label>
|
<label for="">航线类别: </label>
|
||||||
<select class="form-control" name="" id="">
|
<select [(ngModel)]="filterItems.FLIN" class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<option value="D">国内</option>
|
||||||
|
<option value="I">国际</option>
|
||||||
|
<option value="M">混合</option>
|
||||||
|
<option value="R">地区</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">航班类别: </label>
|
<label for="">航班类别: </label>
|
||||||
<select class="form-control" name="" id="">
|
<select [(ngModel)]="filterItems.FLTY" class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<option value="">客机</option>
|
||||||
|
<option value="">货机</option>
|
||||||
|
<option value="">军用</option>
|
||||||
|
<option value="">VIP</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="input-container mr-4">
|
<!-- <div class="input-container mr-4">
|
||||||
@@ -51,8 +59,10 @@
|
|||||||
</div> -->
|
</div> -->
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">到达/出发:</label>
|
<label for="">到达/出发:</label>
|
||||||
<select class="form-control" name="" id="">
|
<select [(ngModel)]="filterItems.MVIN" class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<option value="A">到达</option>
|
||||||
|
<option value="D">离港</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
@@ -63,32 +73,40 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">航站楼: </label>
|
<label for="">航站楼: </label>
|
||||||
<select class="form-control" name="" id="">
|
<select [(ngModel)]="filterItems.TRML" class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<option value="T1">T1</option>
|
||||||
|
<option value="T2">T2</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">异常状态: </label>
|
<label for="">异常状态: </label>
|
||||||
<select class="form-control" name="" id="">
|
<select class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">机坪代理: </label>
|
<label for="">机坪代理: </label>
|
||||||
<select class="form-control" name="" id="">
|
<select [(ngModel)]="filterItems.FHAG" class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<option value="GH">国航代理</option>
|
||||||
|
<option value="CH">川航代理</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">旅客代理: </label>
|
<label for="">旅客代理: </label>
|
||||||
<select class="form-control" name="" id="">
|
<select [(ngModel)]="filterItems.PHAG" class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<option value="GH">国航代理</option>
|
||||||
|
<option value="CH">川航代理</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">维护代理: </label>
|
<label for="">维护代理: </label>
|
||||||
<select class="form-control" name="" id="">
|
<select [(ngModel)]="filterItems.MHAG" class="form-control">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<option value="GH">国航代理</option>
|
||||||
|
<option value="CH">川航代理</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -123,15 +141,15 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>序号</th>
|
<th>序号</th>
|
||||||
<th>重要提示</th>
|
<th>重要提示</th>
|
||||||
<th *ngFor="let airline_col of airline_col_lists">{{airline_col.COL_CN}}</th>
|
<th *ngFor="let airline_col of col_lists">{{airline_col.COL_CN}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let airline_row of airline_row_lists;let i = index" (click)="selectRow($event,i)"
|
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow($event,i)"
|
||||||
[ngClass]="{'active':row_state===i}">
|
[ngClass]="{'active':row_state===i}">
|
||||||
<td>{{i+1}}</td>
|
<td>{{i+1}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td *ngFor="let airline_col of airline_col_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_col.COL_CODE|dataFormatter:airline_row}}</td>
|
<td *ngFor="let airline_col of col_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ChangeDetectorRef } from '@angular/core';
|
||||||
|
|
||||||
import { HttpClientService } from '../../services/http-client.service';
|
import { HttpClientService } from '../../services/http-client.service';
|
||||||
|
|
||||||
@@ -13,11 +14,25 @@ import arriDept from '../../utils/arri-dept';
|
|||||||
styleUrls: ['./main.component.scss']
|
styleUrls: ['./main.component.scss']
|
||||||
})
|
})
|
||||||
export class MainComponent implements OnInit {
|
export class MainComponent implements OnInit {
|
||||||
public airline_col_lists: Array<object>;
|
|
||||||
public airline_row_lists: Array<object> = [];
|
constructor(
|
||||||
|
private httpCilent: HttpClientService,
|
||||||
|
private changeDetectorRef: ChangeDetectorRef
|
||||||
|
) { }
|
||||||
|
|
||||||
|
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||||
|
|
||||||
|
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||||
|
|
||||||
|
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public col_lists: Array<object>; //列数据
|
||||||
public airline_color: Array<object> = [];
|
public airline_color: Array<object> = [];
|
||||||
public row_state: number;
|
public row_state: number;
|
||||||
|
|
||||||
|
|
||||||
public TOP_1 = 1000000000000;
|
public TOP_1 = 1000000000000;
|
||||||
public TOP_2 = 2000000000000;
|
public TOP_2 = 2000000000000;
|
||||||
public TOP_3 = 3000000000000;
|
public TOP_3 = 3000000000000;
|
||||||
@@ -32,36 +47,42 @@ export class MainComponent implements OnInit {
|
|||||||
public TOP_12 = 12000000000000;
|
public TOP_12 = 12000000000000;
|
||||||
public TOP_13 = 13000000000000;
|
public TOP_13 = 13000000000000;
|
||||||
public TOP_14 = 14000000000000;
|
public TOP_14 = 14000000000000;
|
||||||
public LEVEL_1 = 100000000000000;
|
|
||||||
public LEVEL_2 = 200000000000000;
|
|
||||||
public LEVEL_3 = 300000000000000;
|
|
||||||
public LEVEL_4 = 400000000000000;
|
|
||||||
public LEVEL_5 = 500000000000000;
|
|
||||||
public LEVEL_6 = 600000000000000;
|
|
||||||
public LEVEL_7 = 700000000000000;
|
|
||||||
public LEVEL_8 = 800000000000000;
|
|
||||||
public LEVEL_9 = 900000000000000;
|
|
||||||
public LEVEL_10 = 1000000000000000;
|
|
||||||
public LEVEL_11 = 1100000000000000;
|
|
||||||
public LEVEL_12 = 1200000000000000;
|
|
||||||
public LEVEL_13 = 1300000000000000;
|
|
||||||
public LEVEL_14 = 1400000000000000;
|
|
||||||
|
|
||||||
filterItems = {
|
public filterItems = {
|
||||||
SEARCH:'',
|
SEARCH: '', //手动输入条件
|
||||||
ALCD:'',
|
FLT_POS:'1', //过滤还是定位
|
||||||
FLIN:'',
|
ALCD: '', //航空公司
|
||||||
FLTY:'',
|
FLIN: '', //航线类别
|
||||||
|
FLTY: '', //航班类别
|
||||||
|
MVIN: '', //到达/出发
|
||||||
|
TRML: '', //航站楼
|
||||||
|
FHAG: '', //机坪代理
|
||||||
|
MHAG: '', //维护代理
|
||||||
|
PHAG: '', //旅客代理
|
||||||
|
}
|
||||||
|
|
||||||
|
public formatter = {
|
||||||
|
'MVIN': {
|
||||||
|
'A': '到达',
|
||||||
|
'D': '出发',
|
||||||
|
'DF': '其他'
|
||||||
|
},
|
||||||
|
'FLIN': {
|
||||||
|
'D': '国内',
|
||||||
|
'I': '国际',
|
||||||
|
'M': '混合',
|
||||||
|
'R': '地区',
|
||||||
|
'DF': '其他'
|
||||||
|
},
|
||||||
|
'SODT': dateFormatter,
|
||||||
|
'ESTT': dateFormatter,
|
||||||
|
'ACTT': dateFormatter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private httpCilent: HttpClientService
|
|
||||||
) { }
|
|
||||||
|
|
||||||
selectRow($event, i) {
|
selectRow($event, i) {
|
||||||
this.row_state = i;
|
this.row_state = i;
|
||||||
|
alert(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
getColor(col_CODE) {
|
getColor(col_CODE) {
|
||||||
@@ -73,14 +94,14 @@ export class MainComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.changeDetectorRef.detach();
|
||||||
/* 获取显示列 */
|
/* 获取显示列 */
|
||||||
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
|
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
|
||||||
data => {
|
data => {
|
||||||
data.sort(function (a, b) {
|
data.sort(function (a, b) {
|
||||||
return (a['COL_ORDER'] - b['COL_ORDER']);
|
return (a['COL_ORDER'] - b['COL_ORDER']);
|
||||||
})
|
})
|
||||||
this.airline_col_lists = data;
|
this.col_lists = data;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
/* 获取航班动态信息 */
|
/* 获取航班动态信息 */
|
||||||
@@ -88,34 +109,93 @@ export class MainComponent implements OnInit {
|
|||||||
data => {
|
data => {
|
||||||
//解析数据
|
//解析数据
|
||||||
data.forEach(element => {
|
data.forEach(element => {
|
||||||
let air_message = JSON.parse(element.value);
|
this.raw_data.push(JSON.parse(element.value));
|
||||||
this.airline_row_lists.push(air_message);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let combined_linked_data = this.raw_data
|
||||||
|
// this.combined_data = this.raw_data
|
||||||
|
|
||||||
//查找链接航班并将其组合成一条数据
|
//查找链接航班并将其组合成一条数据
|
||||||
for (let i = 0; i < this.airline_row_lists.length; i++) {
|
for (let i = 0; i < combined_linked_data.length; i++) {
|
||||||
if (this.airline_row_lists[i]['MVIN'] === 'D') {
|
if (combined_linked_data[i]['MVIN'] === 'D') {
|
||||||
if (this.airline_row_lists[i]['TAID']) {
|
if (combined_linked_data[i]['TAID']) {
|
||||||
let index = this.airline_row_lists.findIndex(val => { return val['FLID'] === this.airline_row_lists[i]['TAID'] });
|
let index = combined_linked_data.findIndex(val => { return val['FLID'] === combined_linked_data[i]['TAID'] });
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.airline_row_lists[i]['isLinked'] = true;
|
combined_linked_data[i]['isLinked'] = true;
|
||||||
this.airline_row_lists[i]['linkFlight'] = this.airline_row_lists[index];
|
combined_linked_data[i]['linkFlight'] = combined_linked_data[index];
|
||||||
this.airline_row_lists.splice(index, 1);
|
combined_linked_data.splice(index, 1);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//排序
|
combined_linked_data.forEach(element => {
|
||||||
this.airline_row_lists.forEach(element => {
|
let row_flights = {};
|
||||||
element['order'] = this.sequence(element)
|
let render_flight = {};
|
||||||
element['ORDER'] = '+' + element['order']
|
let render_pre_flight = {};
|
||||||
|
let render_rea_flight = {};
|
||||||
|
if (element['MVIN'] === 'A' && !element['isLinked']) {
|
||||||
|
row_flights['preFlight'] = element;
|
||||||
|
|
||||||
|
for (let i = 0; i < this.col_lists.length; i++) {
|
||||||
|
let key = this.col_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];
|
||||||
|
}
|
||||||
|
row_flights['renderFlight'] = render_flight;
|
||||||
|
|
||||||
|
} else if (element['MVIN'] === 'D' && !element['isLinked']) {
|
||||||
|
row_flights['reaFlight'] = element;
|
||||||
|
for (let i = 0; i < this.col_lists.length; i++) {
|
||||||
|
let key = this.col_lists[i]['COL_CODE']
|
||||||
|
render_flight[key] = typeof (this.formatter[key]) === 'function' ? this.formatter[key](row_flights['reaFlight'][key],1) : this.formatter[key] ? this.formatter[key][row_flights['reaFlight'][key]] : row_flights['reaFlight'][key];
|
||||||
|
}
|
||||||
|
row_flights['renderFlight'] = render_flight;
|
||||||
|
|
||||||
|
} else if (element['isLinked']) {
|
||||||
|
row_flights['preFlight'] = element['linkFlight'];
|
||||||
|
delete element['linkFlight'];
|
||||||
|
delete element['isLinked'];
|
||||||
|
row_flights['reaFlight'] = element;
|
||||||
|
|
||||||
|
for (let i = 0; i < this.col_lists.length; i++) {
|
||||||
|
let key = this.col_lists[i]['COL_CODE']
|
||||||
|
if (this.formatter.hasOwnProperty(key)) {
|
||||||
|
if (typeof (this.formatter[key]) === 'function') {
|
||||||
|
render_flight[key] = 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);
|
||||||
|
} else {
|
||||||
|
render_flight[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]];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
render_flight[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;
|
||||||
|
}
|
||||||
|
this.combined_data.push(row_flights)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.airline_row_lists.sort(function (a, b) {
|
//排序
|
||||||
return (a['order'] - b['order']);
|
this.combined_data.forEach(element => {
|
||||||
|
element['ORDER'] = this.sequence(element)
|
||||||
|
// element['ORDER'] = '+' + element['order']
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.combined_data.sort(function (a, b) {
|
||||||
|
return (a['ORDER'] - b['ORDER']);
|
||||||
|
})
|
||||||
|
|
||||||
|
this.render_data = this.combined_data
|
||||||
|
|
||||||
|
this.changeDetectorRef.detectChanges();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -159,80 +239,77 @@ export class MainComponent implements OnInit {
|
|||||||
let dateToCompare = new Date().getTime();
|
let dateToCompare = new Date().getTime();
|
||||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) {
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) {
|
||||||
if (this.isLinked(flight)) {
|
if (this.isLinked(flight)) {
|
||||||
if (this.getActualDatetime(flight['linkFlight']) && !this.getActualDatetime(flight)) {
|
if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['linkFlight']))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||||
dateTag = this.TOP_1;
|
dateTag = this.TOP_1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||||
dateTag = this.TOP_2;
|
dateTag = this.TOP_2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||||
dateTag = this.TOP_3;
|
dateTag = this.TOP_3;
|
||||||
}
|
}
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) {
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||||
dateTag = this.TOP_4;
|
dateTag = this.TOP_4;
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight)) {
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) {
|
||||||
if (this.isArriFlight(flight)) {
|
if (this.getEstimatedDatetime(flight['preFlight'])) {
|
||||||
if (this.getEstimatedDatetime(flight)) {
|
dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime();
|
||||||
dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight))).getTime();
|
} else {
|
||||||
} else {
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
|
||||||
}
|
|
||||||
} else if (this.isLinked(flight)) {
|
|
||||||
if (this.getEstimatedDatetime(flight['linkFlight'])) {
|
|
||||||
dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['linkFlight']))).getTime();
|
|
||||||
} else {
|
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['linkFlight']))).getTime();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dateTag = this.TOP_5;
|
dateTag = this.TOP_5;
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['linkFlight']) && !this.getActualDatetime(flight)) {
|
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['linkFlight']))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||||
dateTag = this.TOP_6;
|
dateTag = this.TOP_6;
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) {
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||||
dateTag = this.TOP_7;
|
dateTag = this.TOP_7;
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) {
|
if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||||
dateTag = this.TOP_8;
|
dateTag = this.TOP_8;
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) {
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||||
dateTag = this.TOP_9;
|
dateTag = this.TOP_9;
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) {
|
if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) {
|
||||||
if (this.isLinked(flight)) {
|
if (this.isLinked(flight)) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||||
dateTag = this.TOP_10;
|
dateTag = this.TOP_10;
|
||||||
} else if (this.isArriFlight(flight)) {
|
} else if (this.isArriFlight(flight)) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||||
dateTag = this.TOP_11;
|
dateTag = this.TOP_11;
|
||||||
}
|
}
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) {
|
if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight))).getTime();
|
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime();
|
||||||
dateTag = this.TOP_12;
|
dateTag = this.TOP_12;
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
if (this.isCancled(flight)) {
|
if (this.isCancled(flight)) {
|
||||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
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;
|
dateTag = this.TOP_13;
|
||||||
return dateToCompare + dateTag;
|
return dateToCompare + dateTag;
|
||||||
}
|
}
|
||||||
@@ -273,7 +350,7 @@ export class MainComponent implements OnInit {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public isLinked(flight) {
|
public isLinked(flight) {
|
||||||
if (flight.isLinked) {
|
if (flight['preFlight'] && flight['reaFlight']) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@@ -286,7 +363,7 @@ export class MainComponent implements OnInit {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public isDeptFlight(flight) {
|
public isDeptFlight(flight) {
|
||||||
if (flight.MVIN === 'D' && !flight.isLinked) {
|
if (!flight['preFlight'] && flight['reaFlight']) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@@ -300,7 +377,7 @@ export class MainComponent implements OnInit {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public isArriFlight(flight) {
|
public isArriFlight(flight) {
|
||||||
if (flight.MVIN === 'A' && !flight.isLinked) {
|
if (flight['preFlight'] && !flight['reaFlight']) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -313,17 +390,11 @@ export class MainComponent implements OnInit {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public isFlying(flight) {
|
public isFlying(flight) {
|
||||||
if (this.isArriFlight(flight)) {
|
if (this.isArriFlight(flight) || this.isLinked(flight)) {
|
||||||
if (flight['PADT']) {
|
if (flight['preFlight']['PADT']) {
|
||||||
return true
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
}
|
|
||||||
} else if (this.isLinked(flight)) {
|
|
||||||
if (flight['linkFlight']['PADT']) {
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -337,14 +408,20 @@ export class MainComponent implements OnInit {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public isCancled(flight) {
|
public isCancled(flight) {
|
||||||
if (this.isArriFlight(flight) || this.isDeptFlight(flight)) {
|
if (this.isArriFlight(flight)) {
|
||||||
if (flight['CNCL']) {
|
if (flight['preFlight']['CNCL']) {
|
||||||
return true
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
|
}
|
||||||
|
} else if (this.isDeptFlight(flight)) {
|
||||||
|
if (flight['reaFlight']['CNCL']) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +432,7 @@ export class MainComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
public isDelayed(flight) {
|
public isDelayed(flight) {
|
||||||
if (this.isDeptFlight(flight) || this.isLinked(flight)) {
|
if (this.isDeptFlight(flight) || this.isLinked(flight)) {
|
||||||
if (flight['DELY']) {
|
if (flight['reaFlight']['DELY']) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@@ -372,13 +449,13 @@ export class MainComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
public isDone(flight) {
|
public isDone(flight) {
|
||||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||||
if (!this.getActualDatetime(flight)) {
|
if (!this.getActualDatetime(flight['reaFlight'])) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (this.isArriFlight(flight)) {
|
} else if (this.isArriFlight(flight)) {
|
||||||
if (!this.getActualDatetime(flight)) {
|
if (!this.getActualDatetime(flight['preFlight'])) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@@ -395,7 +472,7 @@ export class MainComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
public startBoading(flight) {
|
public startBoading(flight) {
|
||||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||||
if (!flight['BOTM']) {
|
if (!flight['reaFlight']['BOTM']) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@@ -413,7 +490,7 @@ export class MainComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
public isBoading(flight) {
|
public isBoading(flight) {
|
||||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||||
if (flight['BOTM'] && !flight['GCTM']) {
|
if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import {PipesModule} from '../../pipes/pipes.module';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { PipesModule } from '../../pipes/pipes.module';
|
||||||
import { MainComponent } from './main.component';
|
import { MainComponent } from './main.component';
|
||||||
import { MainRoutingModule } from './main-routing.module'
|
import { MainRoutingModule } from './main-routing.module'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
PipesModule,
|
PipesModule,
|
||||||
MainRoutingModule
|
MainRoutingModule
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { DataFormatterPipe } from './data-formatter.pipe'
|
import { DataFormatterPipe } from './data-formatter.pipe';
|
||||||
|
import { ScreeningFlightPipe } from './screening-flight.pipe';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
declarations: [
|
declarations: [
|
||||||
DataFormatterPipe
|
DataFormatterPipe,
|
||||||
|
ScreeningFlightPipe
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
DataFormatterPipe
|
DataFormatterPipe,
|
||||||
|
ScreeningFlightPipe
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name:'screeningFlight'
|
||||||
|
})
|
||||||
|
|
||||||
|
export class ScreeningFlightPipe implements PipeTransform{
|
||||||
|
transform(items:Array<any>,args:any){
|
||||||
|
console.log(args)
|
||||||
|
var searchCtrl = ( data: any ) => {
|
||||||
|
var all = false;
|
||||||
|
if ( typeof data === 'object' ) {
|
||||||
|
for ( var z in data ) {
|
||||||
|
if ( all = searchCtrl( data[z] ) ) {
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if ( typeof data === 'number' ) {
|
||||||
|
all = data === args;
|
||||||
|
} else {
|
||||||
|
all = data.toString().match( new RegExp( args, 'i' ) );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return all;
|
||||||
|
};
|
||||||
|
return items.filter(searchCtrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function (dataString) {
|
export default function (dataString,type?) {
|
||||||
const monthToNumber = {
|
const monthToNumber = {
|
||||||
JAN: '01',
|
JAN: '01',
|
||||||
FEB: '02',
|
FEB: '02',
|
||||||
@@ -36,5 +36,10 @@ export default function (dataString) {
|
|||||||
let hour = dataString.substring(7, 9);
|
let hour = dataString.substring(7, 9);
|
||||||
let min = dataString.substring(9, 11);
|
let min = dataString.substring(9, 11);
|
||||||
|
|
||||||
return year + '-' + month + '-' + day + ' ' + hour + ':' + min
|
if(type){
|
||||||
|
return hour + ':' + min
|
||||||
|
}else{
|
||||||
|
return year + '-' + month + '-' + day + ' ' + hour + ':' + min
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user