2018-10-26 11:33:25 +08:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2018-11-12 11:27:23 +08:00
|
|
|
import { ChangeDetectorRef } from '@angular/core';
|
2018-10-26 11:33:25 +08:00
|
|
|
|
|
|
|
|
import { HttpClientService } from '../../services/http-client.service';
|
|
|
|
|
|
2018-11-06 09:41:04 +08:00
|
|
|
import dateFormatter from '../../utils/data-formatter';
|
|
|
|
|
import routeType from '../../utils/route-type';
|
|
|
|
|
import flightType from '../../utils/flight-type';
|
|
|
|
|
import arriDept from '../../utils/arri-dept';
|
2018-11-15 14:57:26 +08:00
|
|
|
import { HttpParams } from '@angular/common/http';
|
2018-11-06 09:41:04 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
import * as $ from 'jquery';
|
2018-10-26 11:33:25 +08:00
|
|
|
@Component({
|
|
|
|
|
selector: 'app-main',
|
|
|
|
|
templateUrl: './main.component.html',
|
|
|
|
|
styleUrls: ['./main.component.scss']
|
|
|
|
|
})
|
|
|
|
|
export class MainComponent implements OnInit {
|
2018-11-12 11:27:23 +08:00
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private httpCilent: HttpClientService,
|
|
|
|
|
private changeDetectorRef: ChangeDetectorRef
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
public raw_data: Array<object> = []; //原始数据,即航班计划
|
|
|
|
|
|
|
|
|
|
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
|
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
// public filter_data:Array<object> = []; //用于过滤和定位的数据
|
|
|
|
|
|
2018-11-12 11:27:23 +08:00
|
|
|
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public col_lists: Array<object>; //列数据
|
2018-10-26 11:33:25 +08:00
|
|
|
public airline_color: Array<object> = [];
|
2018-11-15 14:57:26 +08:00
|
|
|
public row_state: any = { renderFlight: {} };
|
2018-10-26 11:33:25 +08:00
|
|
|
|
2018-11-12 11:27:23 +08:00
|
|
|
|
2018-11-07 16:32:35 +08:00
|
|
|
public TOP_1 = 1000000000000;
|
|
|
|
|
public TOP_2 = 2000000000000;
|
|
|
|
|
public TOP_3 = 3000000000000;
|
|
|
|
|
public TOP_4 = 4000000000000;
|
|
|
|
|
public TOP_5 = 5000000000000;
|
|
|
|
|
public TOP_6 = 6000000000000;
|
|
|
|
|
public TOP_7 = 7000000000000;
|
|
|
|
|
public TOP_8 = 8000000000000;
|
|
|
|
|
public TOP_9 = 9000000000000;
|
|
|
|
|
public TOP_10 = 10000000000000;
|
|
|
|
|
public TOP_11 = 11000000000000;
|
|
|
|
|
public TOP_12 = 12000000000000;
|
|
|
|
|
public TOP_13 = 13000000000000;
|
|
|
|
|
public TOP_14 = 14000000000000;
|
|
|
|
|
|
2018-11-13 20:28:53 +08:00
|
|
|
|
|
|
|
|
// 搜索条件
|
|
|
|
|
SEARCH = ''; //手动输入条件
|
|
|
|
|
FLT_POS = 1; //过滤还是定位
|
|
|
|
|
SEL_COL = ''; //选择列名
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 11:27:23 +08:00
|
|
|
public filterItems = {
|
|
|
|
|
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
|
2018-11-07 16:32:35 +08:00
|
|
|
}
|
2018-11-06 09:41:04 +08:00
|
|
|
|
2018-10-26 11:33:25 +08:00
|
|
|
|
2018-11-13 20:28:53 +08:00
|
|
|
selectRow(i) {
|
2018-11-07 16:32:35 +08:00
|
|
|
this.row_state = i;
|
2018-11-13 20:28:53 +08:00
|
|
|
this.changeDetectorRef.detectChanges();
|
2018-11-07 16:32:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getColor(col_CODE) {
|
|
|
|
|
if (col_CODE === 'SODT') {
|
|
|
|
|
return 'skyblue'
|
|
|
|
|
} else {
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-26 11:33:25 +08:00
|
|
|
ngOnInit() {
|
2018-11-15 14:57:26 +08:00
|
|
|
// console.log($)
|
2018-11-12 11:27:23 +08:00
|
|
|
this.changeDetectorRef.detach();
|
2018-10-26 11:33:25 +08:00
|
|
|
/* 获取显示列 */
|
|
|
|
|
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
|
|
|
|
|
data => {
|
|
|
|
|
data.sort(function (a, b) {
|
|
|
|
|
return (a['COL_ORDER'] - b['COL_ORDER']);
|
|
|
|
|
})
|
2018-11-12 11:27:23 +08:00
|
|
|
this.col_lists = data;
|
2018-10-26 11:33:25 +08:00
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
/* 获取航班动态信息 */
|
|
|
|
|
this.httpCilent.get('/assets/mock-data/airline-data.json').subscribe(
|
|
|
|
|
data => {
|
2018-11-06 09:41:04 +08:00
|
|
|
//解析数据
|
2018-10-26 11:33:25 +08:00
|
|
|
data.forEach(element => {
|
2018-11-12 11:27:23 +08:00
|
|
|
this.raw_data.push(JSON.parse(element.value));
|
2018-10-26 11:33:25 +08:00
|
|
|
});
|
2018-11-06 09:41:04 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
let combined_linked_data = this.raw_data;
|
2018-11-12 11:27:23 +08:00
|
|
|
// this.combined_data = this.raw_data
|
|
|
|
|
|
2018-11-06 09:41:04 +08:00
|
|
|
//查找链接航班并将其组合成一条数据
|
2018-11-12 11:27:23 +08:00
|
|
|
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'] });
|
2018-11-06 09:41:04 +08:00
|
|
|
if (index > -1) {
|
2018-11-12 11:27:23 +08:00
|
|
|
combined_linked_data[i]['isLinked'] = true;
|
|
|
|
|
combined_linked_data[i]['linkFlight'] = combined_linked_data[index];
|
|
|
|
|
combined_linked_data.splice(index, 1);
|
2018-11-06 09:41:04 +08:00
|
|
|
i--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-12 11:27:23 +08:00
|
|
|
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']
|
2018-11-12 14:32:28 +08:00
|
|
|
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];
|
2018-11-12 11:27:23 +08:00
|
|
|
}
|
|
|
|
|
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']
|
2018-11-12 14:32:28 +08:00
|
|
|
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];
|
2018-11-12 11:27:23 +08:00
|
|
|
}
|
|
|
|
|
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') {
|
2018-11-13 20:28:53 +08:00
|
|
|
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));
|
2018-11-12 14:32:28 +08:00
|
|
|
render_pre_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1);
|
|
|
|
|
render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1);
|
2018-11-12 11:27:23 +08:00
|
|
|
} else {
|
2018-11-13 20:28:53 +08:00
|
|
|
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]]);
|
2018-11-12 11:27:23 +08:00
|
|
|
render_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]];
|
|
|
|
|
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2018-11-13 20:28:53 +08:00
|
|
|
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (row_flights['preFlight'][key]) : (row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key]);
|
2018-11-12 11:27:23 +08:00
|
|
|
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)
|
2018-11-06 09:41:04 +08:00
|
|
|
})
|
|
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
this.doSequence(this.combined_data);
|
2018-10-26 11:33:25 +08:00
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-06 09:41:04 +08:00
|
|
|
|
2018-11-12 14:32:28 +08:00
|
|
|
/**
|
2018-11-15 14:57:26 +08:00
|
|
|
* 执行排序并渲染
|
2018-11-12 14:32:28 +08:00
|
|
|
*/
|
2018-11-15 14:57:26 +08:00
|
|
|
doSequence(sequenceData) {
|
|
|
|
|
sequenceData.forEach(element => {
|
|
|
|
|
element['ORDER'] = this.sequence(element);
|
|
|
|
|
})
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
sequenceData.sort(function (a, b) {
|
|
|
|
|
return (a['ORDER'] - b['ORDER']);
|
|
|
|
|
})
|
2018-11-13 20:28:53 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
this.render_data = sequenceData;
|
|
|
|
|
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
2018-11-13 20:28:53 +08:00
|
|
|
this.changeDetectorRef.detectChanges();
|
2018-11-12 14:32:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
/**
|
|
|
|
|
* 过滤及定位
|
|
|
|
|
* @param filterItems
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
//输入框回车事件
|
|
|
|
|
inputEnter() {
|
|
|
|
|
if (this.FLT_POS === 1) {
|
|
|
|
|
this.selectChange()
|
|
|
|
|
} else {
|
|
|
|
|
this.selectChange()
|
|
|
|
|
this.inputPosition(this.render_data)
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
//下拉框选择筛选
|
|
|
|
|
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 (this.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 {
|
|
|
|
|
is_satis = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return is_satis;
|
|
|
|
|
} else if (this.isDeptFlight(item)) {
|
|
|
|
|
let is_satis = true;
|
|
|
|
|
for (const key in filterItems) {
|
|
|
|
|
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
|
|
|
|
if (item['reaFlight'][key] === filterItems[key]) {
|
|
|
|
|
is_satis = true;
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
is_satis = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
}
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
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.inputPosition(this.render_data);
|
|
|
|
|
this.changeDetectorRef.detectChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//输入框筛选
|
|
|
|
|
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 {
|
|
|
|
|
if (this.SEARCH) {
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
filterData = filterData.filter(item => {
|
|
|
|
|
let is_satis = false;
|
|
|
|
|
for (const key in item['renderFlight']) {
|
|
|
|
|
if (item['renderFlight'].hasOwnProperty(key)) {
|
|
|
|
|
if (item['renderFlight'][key]) {
|
|
|
|
|
if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
|
|
|
|
is_satis = true;
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
is_satis = false;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (this.SEARCH) {
|
|
|
|
|
is_satis = false;
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
is_satis = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return is_satis;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.render_data = filterData;
|
|
|
|
|
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
|
|
|
|
this.changeDetectorRef.detectChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
positionArray: Array<any> = [];
|
|
|
|
|
positionArrayIndex: number = 0;
|
|
|
|
|
//输入框定位
|
|
|
|
|
inputPosition(filterData) {
|
|
|
|
|
let transArray = []
|
|
|
|
|
if (this.SEL_COL) {
|
|
|
|
|
let sel_col = this.SEL_COL;
|
|
|
|
|
filterData.forEach(element => {
|
|
|
|
|
if (element['renderFlight'][sel_col]) {
|
|
|
|
|
if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
|
|
|
|
transArray.push(element)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!this.SEARCH) {
|
|
|
|
|
transArray.push(element)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
filterData.forEach(element => {
|
|
|
|
|
for (const key in element['renderFlight']) {
|
|
|
|
|
if (element['renderFlight'].hasOwnProperty(key)) {
|
|
|
|
|
if (element['renderFlight'][key]) {
|
|
|
|
|
if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
|
|
|
|
transArray.push(element)
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (this.SEARCH) {
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
transArray.push(element)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (transArray.length > 0) {
|
|
|
|
|
if (transArray.toString() == this.positionArray.toString()) {
|
|
|
|
|
this.positionArrayIndex++;
|
|
|
|
|
if (this.positionArrayIndex === this.positionArray.length) {
|
|
|
|
|
this.positionArrayIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
this.row_state = this.positionArray[this.positionArrayIndex];
|
|
|
|
|
} else {
|
|
|
|
|
this.positionArray = transArray;
|
|
|
|
|
this.positionArrayIndex = 0;
|
|
|
|
|
this.row_state = this.positionArray[this.positionArrayIndex];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
alert('没有搜索到相关数据');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.changeDetectorRef.detectChanges();
|
|
|
|
|
|
|
|
|
|
let tr = $(".selected");
|
|
|
|
|
let objTr = tr[0];
|
|
|
|
|
$("#table-container").animate({ scrollTop: objTr.offsetTop }, "slow");
|
|
|
|
|
}
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-07 16:32:35 +08:00
|
|
|
/**
|
|
|
|
|
* 行排序规则方法
|
|
|
|
|
* @param flight
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2018-10-26 11:33:25 +08:00
|
|
|
|
2018-11-07 16:32:35 +08:00
|
|
|
/** (0)000000+实际时间(到达航班有实际时间,且未超过1小时)
|
|
|
|
|
(0-1)无链接航班,取实际(到达)时间
|
|
|
|
|
(0-2)有链接航班,且出发航班未有实际时间,取实际(到达)时间
|
|
|
|
|
(1)100000+商调完成时间(商调完成登机未开始)
|
|
|
|
|
(2)110000+登机开始时间(登机开始尚未登机结束)
|
|
|
|
|
(3)111000+登机结束时间(登机结束)
|
|
|
|
|
(4)111100+计划/预计时间(无商调完成时间、登机开始时间、登机结束时间、航班实际完成时间)
|
|
|
|
|
(4-1)无链接航班
|
|
|
|
|
(4-1-1)若有预计时间则取预计时间
|
|
|
|
|
(4-1-2)若无预计时间则取计划时间
|
|
|
|
|
(4-2)有链接航班
|
|
|
|
|
(4-2-1)若无实际到达时间,则
|
|
|
|
|
(4-2-1-1)若有预计到达时间则取预计到达时间
|
|
|
|
|
(4-2-1-2)若无预计到达时间则取计划到达时间
|
|
|
|
|
(4-2-2)若有实际到达时间,
|
|
|
|
|
(4-2-2-1)若有预计出发时间则取预计出发时间
|
|
|
|
|
(4-2-2-2)若无预计出发时间则取计划出发时间
|
|
|
|
|
(5)111110+计划/预计时间(航班取消)[只考虑无链接航班,因为链接航班不会有取消状态]
|
|
|
|
|
(5-1)若有预计时间则取预计时间
|
|
|
|
|
(5-2)若无预计时间则取计划时间
|
|
|
|
|
(6)111111+实际时间(航班完成)
|
|
|
|
|
(6-1)无链接航班,取实际(到达/出发)时间
|
|
|
|
|
(6-1-1)到达航班有实际时间,且超过(含)1小时
|
|
|
|
|
(6-1-2)出发航班有实际时间
|
|
|
|
|
(6-2)有链接航班,取实际(出发)时间
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public sequence(flight) {
|
|
|
|
|
let dateTag: number = 10;
|
|
|
|
|
let dateToCompare = new Date().getTime();
|
|
|
|
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) {
|
|
|
|
|
if (this.isLinked(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
|
|
|
|
|
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_3;
|
|
|
|
|
}
|
|
|
|
|
return dateToCompare + dateTag;
|
2018-10-26 11:33:25 +08:00
|
|
|
}
|
2018-11-07 16:32:35 +08:00
|
|
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_4;
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
2018-11-12 11:27:23 +08:00
|
|
|
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();
|
2018-11-07 16:32:35 +08:00
|
|
|
}
|
|
|
|
|
dateTag = this.TOP_5;
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
2018-11-12 11:27:23 +08:00
|
|
|
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();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_6;
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
|
|
|
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_7;
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
|
|
|
|
if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_8;
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
|
|
|
|
if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_9;
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
|
|
|
|
if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) {
|
|
|
|
|
if (this.isLinked(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_10;
|
|
|
|
|
} else if (this.isArriFlight(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_11;
|
|
|
|
|
}
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
|
|
|
|
if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) {
|
2018-11-12 11:27:23 +08:00
|
|
|
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime();
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_12;
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
|
|
|
|
if (this.isCancled(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (this.isDeptFlight(flight)) {
|
|
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
|
|
|
|
} else {
|
|
|
|
|
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-07 16:32:35 +08:00
|
|
|
dateTag = this.TOP_13;
|
|
|
|
|
return dateToCompare + dateTag;
|
|
|
|
|
}
|
|
|
|
|
return this.TOP_14
|
2018-10-26 11:33:25 +08:00
|
|
|
}
|
|
|
|
|
|
2018-11-07 16:32:35 +08:00
|
|
|
/**
|
|
|
|
|
* 获取航班实际时间
|
|
|
|
|
* @param flight
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public getActualDatetime(flight) {
|
|
|
|
|
return flight['ACTT'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取航班预计时间
|
|
|
|
|
* @param flight
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public getEstimatedDatetime(flight) {
|
|
|
|
|
return flight['ESTT']
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取航班计划时间
|
|
|
|
|
* @param flight
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public getScheduledDatetime(flight) {
|
|
|
|
|
return flight['SODT']
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-11-06 09:41:04 +08:00
|
|
|
/**
|
|
|
|
|
* 判断航班是否是链接航班
|
2018-11-07 16:32:35 +08:00
|
|
|
* @param flight
|
2018-11-06 09:41:04 +08:00
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public isLinked(flight) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (flight['preFlight'] && flight['reaFlight']) {
|
2018-11-06 09:41:04 +08:00
|
|
|
return true
|
|
|
|
|
} else {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断航班是否是纯离港航班
|
2018-11-07 16:32:35 +08:00
|
|
|
* @param flight
|
2018-11-06 09:41:04 +08:00
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public isDeptFlight(flight) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (!flight['preFlight'] && flight['reaFlight']) {
|
2018-11-06 09:41:04 +08:00
|
|
|
return true
|
|
|
|
|
} else {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断航班是否是纯到港航班
|
2018-11-07 16:32:35 +08:00
|
|
|
* @param flight
|
2018-11-06 09:41:04 +08:00
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public isArriFlight(flight) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (flight['preFlight'] && !flight['reaFlight']) {
|
2018-11-06 09:41:04 +08:00
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-07 16:32:35 +08:00
|
|
|
/**
|
|
|
|
|
* 判断航班是否已经前站起飞
|
|
|
|
|
* @param flight
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public isFlying(flight) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (this.isArriFlight(flight) || this.isLinked(flight)) {
|
|
|
|
|
if (flight['preFlight']['PADT']) {
|
|
|
|
|
return true;
|
2018-11-07 16:32:35 +08:00
|
|
|
} else {
|
2018-11-12 11:27:23 +08:00
|
|
|
return false;
|
2018-11-07 16:32:35 +08:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断航班是否取消
|
|
|
|
|
* @param flight
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public isCancled(flight) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (this.isArriFlight(flight)) {
|
|
|
|
|
if (flight['preFlight']['CNCL']) {
|
|
|
|
|
return true;
|
2018-11-07 16:32:35 +08:00
|
|
|
} else {
|
2018-11-12 11:27:23 +08:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else if (this.isDeptFlight(flight)) {
|
|
|
|
|
if (flight['reaFlight']['CNCL']) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
2018-11-07 16:32:35 +08:00
|
|
|
}
|
|
|
|
|
} else {
|
2018-11-12 11:27:23 +08:00
|
|
|
return false;
|
2018-11-07 16:32:35 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班)
|
|
|
|
|
* @param flight
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public isDelayed(flight) {
|
|
|
|
|
if (this.isDeptFlight(flight) || this.isLinked(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (flight['reaFlight']['DELY']) {
|
2018-11-07 16:32:35 +08:00
|
|
|
return true
|
|
|
|
|
} else {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-06 09:41:04 +08:00
|
|
|
/**
|
|
|
|
|
* 判断航班是否已经执行完成
|
2018-11-07 16:32:35 +08:00
|
|
|
* @param flight
|
2018-11-06 09:41:04 +08:00
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public isDone(flight) {
|
2018-11-07 16:32:35 +08:00
|
|
|
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (!this.getActualDatetime(flight['reaFlight'])) {
|
2018-11-07 16:32:35 +08:00
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if (this.isArriFlight(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (!this.getActualDatetime(flight['preFlight'])) {
|
2018-11-07 16:32:35 +08:00
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2018-11-06 09:41:04 +08:00
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断航班是否开始登机
|
2018-11-07 16:32:35 +08:00
|
|
|
* @param flight
|
2018-11-06 09:41:04 +08:00
|
|
|
* @return
|
|
|
|
|
*/
|
2018-11-07 16:32:35 +08:00
|
|
|
public startBoading(flight) {
|
|
|
|
|
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (!flight['reaFlight']['BOTM']) {
|
2018-11-07 16:32:35 +08:00
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-06 09:41:04 +08:00
|
|
|
}
|
2018-11-07 16:32:35 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断航班是否正在登机中
|
|
|
|
|
* @param flight
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public isBoading(flight) {
|
|
|
|
|
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
2018-11-12 11:27:23 +08:00
|
|
|
if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) {
|
2018-11-07 16:32:35 +08:00
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-11-06 09:41:04 +08:00
|
|
|
/**
|
|
|
|
|
* 判断航班是否登机结束
|
2018-11-07 16:32:35 +08:00
|
|
|
* @param flight
|
2018-11-06 09:41:04 +08:00
|
|
|
* @return
|
|
|
|
|
*/
|
2018-11-07 16:32:35 +08:00
|
|
|
public isOverBoading(flight) {
|
|
|
|
|
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
|
|
|
|
if (!flight['GCTM']) {
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2018-11-06 09:41:04 +08:00
|
|
|
} else {
|
2018-11-07 16:32:35 +08:00
|
|
|
return false;
|
2018-11-06 09:41:04 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|