数据处理格式调整 -- 单独到/离港航班对象
This commit is contained in:
@@ -7,14 +7,14 @@
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<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>
|
||||
</label>
|
||||
<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>
|
||||
</label>
|
||||
<input class="form-control" type="text">
|
||||
<input class="form-control" [(ngModel)]="filterItems.SEARCH" type="text">
|
||||
</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>
|
||||
@@ -27,20 +27,28 @@
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航空公司: </label>
|
||||
<select class="form-control" name="" id="">
|
||||
<select [(ngModel)]="filterItems.ALCD" class="form-control">
|
||||
<option value=""></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航线类别: </label>
|
||||
<select class="form-control" name="" id="">
|
||||
<select [(ngModel)]="filterItems.FLIN" class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="D">国内</option>
|
||||
<option value="I">国际</option>
|
||||
<option value="M">混合</option>
|
||||
<option value="R">地区</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航班类别: </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="">VIP</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- <div class="input-container mr-4">
|
||||
@@ -51,8 +59,10 @@
|
||||
</div> -->
|
||||
<div class="input-container mr-4">
|
||||
<label for="">到达/出发:</label>
|
||||
<select class="form-control" name="" id="">
|
||||
<select [(ngModel)]="filterItems.MVIN" class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="A">到达</option>
|
||||
<option value="D">离港</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
@@ -63,32 +73,40 @@
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航站楼: </label>
|
||||
<select class="form-control" name="" id="">
|
||||
<select [(ngModel)]="filterItems.TRML" class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="T1">T1</option>
|
||||
<option value="T2">T2</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">异常状态: </label>
|
||||
<select class="form-control" name="" id="">
|
||||
<select class="form-control">
|
||||
<option value=""></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">机坪代理: </label>
|
||||
<select class="form-control" name="" id="">
|
||||
<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="">旅客代理: </label>
|
||||
<select class="form-control" name="" id="">
|
||||
<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="">维护代理: </label>
|
||||
<select class="form-control" name="" id="">
|
||||
<select [(ngModel)]="filterItems.MHAG" class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="GH">国航代理</option>
|
||||
<option value="CH">川航代理</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -123,15 +141,15 @@
|
||||
<tr>
|
||||
<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>
|
||||
</thead>
|
||||
<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}">
|
||||
<td>{{i+1}}</td>
|
||||
<td>{{i+1}}</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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
import { HttpClientService } from '../../services/http-client.service';
|
||||
|
||||
@@ -13,11 +14,25 @@ import arriDept from '../../utils/arri-dept';
|
||||
styleUrls: ['./main.component.scss']
|
||||
})
|
||||
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 row_state: number;
|
||||
|
||||
|
||||
public TOP_1 = 1000000000000;
|
||||
public TOP_2 = 2000000000000;
|
||||
public TOP_3 = 3000000000000;
|
||||
@@ -32,36 +47,42 @@ export class MainComponent implements OnInit {
|
||||
public TOP_12 = 12000000000000;
|
||||
public TOP_13 = 13000000000000;
|
||||
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 = {
|
||||
SEARCH:'',
|
||||
ALCD:'',
|
||||
FLIN:'',
|
||||
FLTY:'',
|
||||
|
||||
public filterItems = {
|
||||
SEARCH: '', //手动输入条件
|
||||
FLT_POS:'1', //过滤还是定位
|
||||
ALCD: '', //航空公司
|
||||
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) {
|
||||
this.row_state = i;
|
||||
alert(i)
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
@@ -73,14 +94,14 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.changeDetectorRef.detach();
|
||||
/* 获取显示列 */
|
||||
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
|
||||
data => {
|
||||
data.sort(function (a, b) {
|
||||
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.forEach(element => {
|
||||
let air_message = JSON.parse(element.value);
|
||||
this.airline_row_lists.push(air_message);
|
||||
this.raw_data.push(JSON.parse(element.value));
|
||||
});
|
||||
|
||||
let combined_linked_data = this.raw_data
|
||||
// this.combined_data = this.raw_data
|
||||
|
||||
//查找链接航班并将其组合成一条数据
|
||||
for (let i = 0; i < this.airline_row_lists.length; i++) {
|
||||
if (this.airline_row_lists[i]['MVIN'] === 'D') {
|
||||
if (this.airline_row_lists[i]['TAID']) {
|
||||
let index = this.airline_row_lists.findIndex(val => { return val['FLID'] === this.airline_row_lists[i]['TAID'] });
|
||||
for (let i = 0; i < combined_linked_data.length; i++) {
|
||||
if (combined_linked_data[i]['MVIN'] === 'D') {
|
||||
if (combined_linked_data[i]['TAID']) {
|
||||
let index = combined_linked_data.findIndex(val => { return val['FLID'] === combined_linked_data[i]['TAID'] });
|
||||
if (index > -1) {
|
||||
this.airline_row_lists[i]['isLinked'] = true;
|
||||
this.airline_row_lists[i]['linkFlight'] = this.airline_row_lists[index];
|
||||
this.airline_row_lists.splice(index, 1);
|
||||
combined_linked_data[i]['isLinked'] = true;
|
||||
combined_linked_data[i]['linkFlight'] = combined_linked_data[index];
|
||||
combined_linked_data.splice(index, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//排序
|
||||
this.airline_row_lists.forEach(element => {
|
||||
element['order'] = this.sequence(element)
|
||||
element['ORDER'] = '+' + element['order']
|
||||
combined_linked_data.forEach(element => {
|
||||
let row_flights = {};
|
||||
let render_flight = {};
|
||||
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();
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) {
|
||||
if (this.isLinked(flight)) {
|
||||
if (this.getActualDatetime(flight['linkFlight']) && !this.getActualDatetime(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['linkFlight']))).getTime();
|
||||
if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_1;
|
||||
}
|
||||
else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_3;
|
||||
}
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_4;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight)) {
|
||||
if (this.isArriFlight(flight)) {
|
||||
if (this.getEstimatedDatetime(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight))).getTime();
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) {
|
||||
if (this.getEstimatedDatetime(flight['preFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime();
|
||||
} else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
}
|
||||
dateTag = this.TOP_5;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['linkFlight']) && !this.getActualDatetime(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['linkFlight']))).getTime();
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_6;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_7;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_8;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_9;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) {
|
||||
if (this.isLinked(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_10;
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_11;
|
||||
}
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight))).getTime();
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_12;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
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;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
@@ -273,7 +350,7 @@ export class MainComponent implements OnInit {
|
||||
* @return
|
||||
*/
|
||||
public isLinked(flight) {
|
||||
if (flight.isLinked) {
|
||||
if (flight['preFlight'] && flight['reaFlight']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -286,7 +363,7 @@ export class MainComponent implements OnInit {
|
||||
* @return
|
||||
*/
|
||||
public isDeptFlight(flight) {
|
||||
if (flight.MVIN === 'D' && !flight.isLinked) {
|
||||
if (!flight['preFlight'] && flight['reaFlight']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -300,7 +377,7 @@ export class MainComponent implements OnInit {
|
||||
* @return
|
||||
*/
|
||||
public isArriFlight(flight) {
|
||||
if (flight.MVIN === 'A' && !flight.isLinked) {
|
||||
if (flight['preFlight'] && !flight['reaFlight']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -313,17 +390,11 @@ export class MainComponent implements OnInit {
|
||||
* @return
|
||||
*/
|
||||
public isFlying(flight) {
|
||||
if (this.isArriFlight(flight)) {
|
||||
if (flight['PADT']) {
|
||||
return true
|
||||
if (this.isArriFlight(flight) || this.isLinked(flight)) {
|
||||
if (flight['preFlight']['PADT']) {
|
||||
return true;
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else if (this.isLinked(flight)) {
|
||||
if (flight['linkFlight']['PADT']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
@@ -337,14 +408,20 @@ export class MainComponent implements OnInit {
|
||||
* @return
|
||||
*/
|
||||
public isCancled(flight) {
|
||||
if (this.isArriFlight(flight) || this.isDeptFlight(flight)) {
|
||||
if (flight['CNCL']) {
|
||||
return true
|
||||
if (this.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['CNCL']) {
|
||||
return true;
|
||||
} else {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
} else if (this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['CNCL']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +432,7 @@ export class MainComponent implements OnInit {
|
||||
*/
|
||||
public isDelayed(flight) {
|
||||
if (this.isDeptFlight(flight) || this.isLinked(flight)) {
|
||||
if (flight['DELY']) {
|
||||
if (flight['reaFlight']['DELY']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -372,13 +449,13 @@ export class MainComponent implements OnInit {
|
||||
*/
|
||||
public isDone(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (!this.getActualDatetime(flight)) {
|
||||
if (!this.getActualDatetime(flight['reaFlight'])) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
if (!this.getActualDatetime(flight)) {
|
||||
if (!this.getActualDatetime(flight['preFlight'])) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -395,7 +472,7 @@ export class MainComponent implements OnInit {
|
||||
*/
|
||||
public startBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (!flight['BOTM']) {
|
||||
if (!flight['reaFlight']['BOTM']) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -413,7 +490,7 @@ export class MainComponent implements OnInit {
|
||||
*/
|
||||
public isBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (flight['BOTM'] && !flight['GCTM']) {
|
||||
if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
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 { MainRoutingModule } from './main-routing.module'
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
PipesModule,
|
||||
MainRoutingModule
|
||||
],
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DataFormatterPipe } from './data-formatter.pipe'
|
||||
import { DataFormatterPipe } from './data-formatter.pipe';
|
||||
import { ScreeningFlightPipe } from './screening-flight.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
declarations: [
|
||||
DataFormatterPipe
|
||||
DataFormatterPipe,
|
||||
ScreeningFlightPipe
|
||||
],
|
||||
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 = {
|
||||
JAN: '01',
|
||||
FEB: '02',
|
||||
@@ -36,5 +36,10 @@ export default function (dataString) {
|
||||
let hour = dataString.substring(7, 9);
|
||||
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