Files
airport-chengdu-web/src/app/pages/main/main.component.ts
T

870 lines
32 KiB
TypeScript
Raw Normal View History

2018-10-26 11:33:25 +08:00
import { Component, OnInit } from '@angular/core';
import { ChangeDetectorRef } from '@angular/core';
2018-10-26 11:33:25 +08:00
2018-11-26 18:53:23 +08:00
import { ToastService } from '../../components/toast/toast.service';
import { ToastConfig, ToastType } from '../../components/toast/toast-model';
2018-10-26 11:33:25 +08:00
import { HttpClientService } from '../../services/http-client.service';
2018-11-29 10:40:23 +08:00
import { BasicDataService } from '../basic-data-service';
import { OperateSpinServiceService } from '../operate-spin-service.service';
import { WebsocketService } from '../../services/websocket.service';
2018-10-26 11:33:25 +08:00
import { DynamicFlightOrder } from './utils/dynamic-flight-order';
import { FlightsDataHandle } from './utils/flights-data-handle';
2018-11-06 09:41:04 +08:00
2018-12-13 18:15:41 +08:00
import dateFormatter from '../../utils/data-formatter';
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 {
constructor(
2018-11-19 09:30:59 +08:00
private basicDataService: BasicDataService,
2018-12-03 11:28:24 +08:00
private operateSpinServiceService: OperateSpinServiceService,
private httpCilent: HttpClientService,
2018-11-26 18:53:23 +08:00
private changeDetectorRef: ChangeDetectorRef,
private toastService: ToastService,
2018-11-29 10:40:23 +08:00
private websocketService: WebsocketService
2018-11-26 18:53:23 +08:00
) {
2018-12-03 11:28:24 +08:00
this.operateSpinServiceService.showSpin();
this.changeDetectorRef.detach();
2018-11-27 18:16:25 +08:00
}
public orderHandle = new DynamicFlightOrder();
public dataHandle = new FlightsDataHandle();
2018-11-27 18:16:25 +08:00
public tabClose: boolean = true;
2018-12-13 18:15:41 +08:00
public canHandleDynamicMessage: boolean = false;
public dynamicMessageArray: Array<any> = [];
2018-11-19 09:30:59 +08:00
//各项基础数据
2018-11-27 18:16:25 +08:00
public terminals: Array<any>;
2018-11-21 18:55:57 +08:00
public flightStatus: Array<any>;
public airports: Array<any>;
public citys: Array<any>;
2018-11-21 18:55:57 +08:00
public airlines: Array<any>;
2018-12-13 18:15:41 +08:00
public airlinesSelections: Array<any> = [];
public flightTypeSelections: Array<any> = [];
public raw_data: Array<object> = []; //原始数据,未经过任何转换和组合
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
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-27 18:16:25 +08:00
public checkboxGroup = {
'related': false,
'detail': false,
'vip': false,
'special': false,
'guarantee': false
}
2018-10-26 11:33:25 +08:00
ngOnInit() {
//订阅航班更新
2018-11-29 10:40:23 +08:00
this.websocketService.dynamicsMessage().subscribe(
event => {
2018-12-12 18:27:21 +08:00
let data = JSON.parse(event as string);
if (data.topic === 'schd') {
let message = JSON.parse(data.message);
2018-12-13 18:15:41 +08:00
//是否可以开始处理动态消息
if (this.canHandleDynamicMessage) {
this.dynamicMessageHandle(message)
2018-12-12 18:27:21 +08:00
} else {
2018-12-13 18:15:41 +08:00
this.dynamicMessageArray.push(message);
2018-12-12 18:27:21 +08:00
}
} else if (data.topic === 'msg') {
let message = JSON.parse(data.message);
console.log(message);
}
2018-11-29 10:40:23 +08:00
}
)
2018-12-03 11:28:24 +08:00
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']);
})
this.col_lists = data;
2018-10-26 11:33:25 +08:00
}
)
2018-12-13 18:15:41 +08:00
//获取航班动态信息
this.httpCilent.get('/msgexchangeapi/all/flights').subscribe(
2018-10-26 11:33:25 +08:00
data => {
this.raw_data = data.body;
2018-11-06 09:41:04 +08:00
//查找链接航班并将其组合成一条数据
2018-12-12 18:27:21 +08:00
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);
});
2018-11-06 09:41:04 +08:00
2018-11-21 18:55:57 +08:00
//从基础数据服务中拿出部分基础数据
2018-11-27 18:16:25 +08:00
this.terminals = this.basicDataService.terminal;
2018-11-21 18:55:57 +08:00
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) {
2018-12-12 18:27:21 +08:00
let combined_data = []
this.combined_data.forEach(item => {
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
})
this.combined_data = combined_data;
this.doSequence(this.combined_data);
2018-11-21 18:55:57 +08:00
} else {
2018-11-27 18:16:25 +08:00
this.basicDataService.terminal_subject.subscribe(
val => this.terminals = val
)
2018-11-21 18:55:57 +08:00
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;
2018-12-12 18:27:21 +08:00
let combined_data = []
this.combined_data.forEach(item => {
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
})
this.combined_data = combined_data;
this.doSequence(this.combined_data);
2018-11-21 18:55:57 +08:00
}
);
}
2018-10-26 11:33:25 +08:00
}
)
2018-12-13 18:15:41 +08:00
//固定表头
var tableCont = document.querySelector('#table-container')
2018-11-19 09:30:59 +08:00
function scrollHandle() {
var scrollTop = this.scrollTop;
this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
}
2018-11-19 09:30:59 +08:00
tableCont.addEventListener('scroll', scrollHandle)
}
2018-11-12 14:32:28 +08:00
/**
2018-12-13 18:15:41 +08:00
* 动态消息处理方法
* @param message
*/
dynamicMessageHandle(message) {
let index = this.raw_data.findIndex(element => element['FLID'] === message.FLID);
if (index > -1) {
this.raw_data[index] = message;
} else {
this.raw_data.push(message);
}
// let testss = []
// 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);
// testss.push(flights_item);
// });
// let combined_data = [];
// testss.forEach(item => {
// combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
// })
// this.combined_data = combined_data;
// this.doSequence(this.combined_data);
let dynamicHandleData = this.dataHandle.dynamicMessageHandle(
message,
this.combined_data,
this.render_data,
this.col_lists,
this.filterItems,
this.LASTSEARCH,
this.LAST_SEL_COL,
this.airports,
this.citys,
this.airlines, this.flightStatus
)
this.combined_data = dynamicHandleData.combined_data;
this.render_data = dynamicHandleData.render_data;
this.combined_data.forEach(element => {
element['ORDER'] = this.orderHandle.sequence(element);
})
this.combined_data = this.combined_data.sort(function (a, b) {
return (a['ORDER'] - b['ORDER']);
})
this.render_data.forEach(element => {
element['ORDER'] = this.orderHandle.sequence(element);
})
this.render_data = this.render_data.sort(function (a, b) {
return (a['ORDER'] - b['ORDER']);
})
this.changeDetectorRef.detectChanges();
}
/**
* 数据组合完毕,执行排序、渲染以及动态信息处理
* @param combined_data
2018-11-12 14:32:28 +08:00
*/
2018-12-12 18:27:21 +08:00
doSequence(combined_data) {
2018-12-13 18:15:41 +08:00
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]);
}
})
2018-12-12 18:27:21 +08:00
combined_data.forEach(element => {
element['ORDER'] = this.orderHandle.sequence(element);
2018-11-15 14:57:26 +08:00
})
2018-12-12 18:27:21 +08:00
combined_data.sort(function (a, b) {
2018-11-15 14:57:26 +08:00
return (a['ORDER'] - b['ORDER']);
})
2018-12-12 18:27:21 +08:00
this.render_data = combined_data;
2018-11-15 14:57:26 +08:00
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
2018-11-26 18:53:23 +08:00
this.changeDetectorRef.detectChanges();
2018-12-03 11:28:24 +08:00
this.operateSpinServiceService.hideSpin()
2018-12-13 18:15:41 +08:00
//开始处理动态消息
this.canHandleDynamicMessage = true;
this.dynamicMessageArray.forEach(message => {
this.dynamicMessageHandle(message);
})
2018-11-26 18:53:23 +08:00
}
2018-11-27 18:16:25 +08:00
/**
* 刷新
*/
refresh() {
2018-12-12 18:27:21 +08:00
let testss = this.render_data.reverse();
let tstt = [];
testss.forEach(element => {
tstt.push(Object.assign({}, element))
})
this.render_data = testss;
2018-11-27 18:16:25 +08:00
this.changeDetectorRef.detectChanges();
}
2018-11-12 14:32:28 +08:00
2018-11-15 14:57:26 +08:00
/**
* 过滤及定位
* @param filterItems
* @return
*/
2018-11-19 09:30:59 +08:00
SEARCH = ''; //手动输入条件
2018-12-12 18:27:21 +08:00
LASTSEARCH = '';
2018-11-19 09:30:59 +08:00
FLT_POS = 1; //过滤还是定位
SEL_COL = ''; //选择列名
2018-12-12 18:27:21 +08:00
LAST_SEL_COL = '';
2018-11-19 09:30:59 +08:00
public filterItems = {
ALCD: '', //航空公司
FLIN: '', //航线类别
FLTY: '', //航班类别
MVIN: '', //到达/出发
2018-12-13 18:15:41 +08:00
FTSS: '', //运营状态
2018-11-19 09:30:59 +08:00
TRML: '', //航站楼
2018-12-13 18:15:41 +08:00
Abnormal_state: '', //异常状态
2018-11-19 09:30:59 +08:00
FHAG: '', //机坪代理
MHAG: '', //维护代理
PHAG: '', //旅客代理
}
/**
* 输入框回车事件
*/
2018-11-15 14:57:26 +08:00
inputEnter() {
if (this.FLT_POS === 1) {
this.selectChange()
} else {
this.inputPosition(this.render_data)
}
}
2018-11-12 14:32:28 +08:00
2018-11-19 09:30:59 +08:00
/**
* 下拉框选择筛选
*/
2018-11-15 14:57:26 +08:00
selectChange() {
2018-12-03 11:28:24 +08:00
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)) {
2018-12-03 11:28:24 +08:00
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
2018-12-13 18:15:41 +08:00
if (key === 'Abnormal_state') {
if (item['preFlight'][filterItems[key]]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
2018-12-03 11:28:24 +08:00
} else {
2018-12-13 18:15:41 +08:00
if (item['preFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
2018-12-03 11:28:24 +08:00
}
2018-11-15 14:57:26 +08:00
}
}
2018-12-03 11:28:24 +08:00
return is_satis;
} else if (this.orderHandle.isDeptFlight(item)) {
2018-12-03 11:28:24 +08:00
let is_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
2018-12-13 18:15:41 +08:00
if (key === 'Abnormal_state') {
if (item['reaFlight'][filterItems[key]]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
2018-12-03 11:28:24 +08:00
} else {
2018-12-13 18:15:41 +08:00
if (item['reaFlight'][key] === filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
2018-12-03 11:28:24 +08:00
}
2018-11-15 14:57:26 +08:00
}
}
2018-12-03 11:28:24 +08:00
return is_satis;
2018-11-15 14:57:26 +08:00
} else {
2018-12-03 11:28:24 +08:00
let pre_satis = true;
let rea_satis = true;
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
2018-12-13 18:15:41 +08:00
if (key === 'Abnormal_state') {
if (item['preFlight'][filterItems[key]]) {
pre_satis = true;
continue;
} else {
pre_satis = false;
break;
}
2018-12-03 11:28:24 +08:00
} else {
2018-12-13 18:15:41 +08:00
if (item['preFlight'][key] === filterItems[key]) {
pre_satis = true;
continue;
} else {
pre_satis = false;
break;
}
2018-12-03 11:28:24 +08:00
}
}
}
for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
2018-12-13 18:15:41 +08:00
if (key === 'Abnormal_state') {
if (item['reaFlight'][filterItems[key]]) {
rea_satis = true;
continue;
} else {
rea_satis = false;
break;
}
2018-12-03 11:28:24 +08:00
} else {
2018-12-13 18:15:41 +08:00
if (item['reaFlight'][key] === filterItems[key]) {
rea_satis = true;
continue;
} else {
rea_satis = false;
break;
}
2018-12-03 11:28:24 +08:00
}
}
}
if (pre_satis && !rea_satis) {
item['renderFlight'] = item['renderPreFlight'];
2018-12-12 18:27:21 +08:00
delete item['reaFlight'];
delete item['renderReaFlight'];
2018-12-03 11:28:24 +08:00
return pre_satis;
} else if (!pre_satis && rea_satis) {
item['renderFlight'] = item['renderReaFlight'];
2018-12-12 18:27:21 +08:00
delete item['preFlight'];
delete item['renderPreFlight'];
2018-12-03 11:28:24 +08:00
return rea_satis;
} else if (pre_satis && rea_satis) {
return pre_satis && rea_satis;
} else {
return false;
}
2018-11-15 14:57:26 +08:00
}
2018-12-03 11:28:24 +08:00
})
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.changeDetectorRef.detectChanges();
2018-11-15 14:57:26 +08:00
}
2018-12-03 11:28:24 +08:00
}, 10)
2018-11-15 14:57:26 +08:00
}
2018-11-19 09:30:59 +08:00
/**
* 输入框筛选
* @param filterData
*/
2018-11-15 14:57:26 +08:00
inputFilter(filterData) {
2018-12-12 18:27:21 +08:00
this.LAST_SEL_COL = this.SEL_COL;
this.LASTSEARCH = this.SEARCH;
2018-11-15 14:57:26 +08:00
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 {
2018-12-12 18:27:21 +08:00
return false;
2018-11-15 14:57:26 +08:00
}
})
} else {
filterData = filterData.filter(item => {
let is_satis = false;
2018-12-12 18:27:21 +08:00
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;
2018-11-15 14:57:26 +08:00
} else {
2018-12-12 18:27:21 +08:00
is_satis = false;
continue;
2018-11-15 14:57:26 +08:00
}
} else {
2018-12-12 18:27:21 +08:00
is_satis = false;
2018-11-15 14:57:26 +08:00
continue;
}
}
return is_satis;
})
}
}
this.render_data = filterData;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
this.changeDetectorRef.detectChanges();
2018-12-03 11:28:24 +08:00
this.operateSpinServiceService.hideSpin()
2018-11-15 14:57:26 +08:00
}
2018-11-19 09:30:59 +08:00
/**
* 输入框定位
*/
2018-11-15 14:57:26 +08:00
positionArray: Array<any> = [];
positionArrayIndex: number = 0;
2018-11-19 09:30:59 +08:00
2018-11-15 14:57:26 +08:00
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 => {
2018-12-12 18:27:21 +08:00
let cols = this.col_lists;
for (let i = 0; i < cols.length; i++) {
if (element['renderFlight'][cols[i]['COL_CODE']]) {
if (element['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
transArray.push(element)
break;
2018-11-15 14:57:26 +08:00
} else {
2018-12-12 18:27:21 +08:00
continue;
2018-11-15 14:57:26 +08:00
}
} else {
2018-12-12 18:27:21 +08:00
if (this.SEARCH) {
continue;
} else {
transArray.push(element)
break;
}
2018-11-15 14:57:26 +08:00
}
}
});
}
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];
2018-12-12 18:27:21 +08:00
if (objTr) {
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
}
2018-11-15 14:57:26 +08:00
}
2018-11-12 14:32:28 +08:00
2018-11-19 09:30:59 +08:00
/**
* 选中某行
* @param i
*/
selectRow(i) {
this.row_state = i;
this.changeDetectorRef.detectChanges();
}
/**
* 获取当前单元格颜色
* @param col_CODE
*/
2018-11-29 10:40:23 +08:00
getColor(col_CODE, flight) {
if (this.orderHandle.isArriFlight(flight)) {
2018-11-29 10:40:23 +08:00
if (col_CODE === 'SODT') {
if (flight['preFlight']['SODT']) {
if (!flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
return 'rgb(0,255,255)';
} else {
return null;
}
} else {
return null;
}
} else if (col_CODE === 'ESTT') {
if (flight['preFlight']['ESTT']) {
if (!flight['preFlight']['ACTT']) {
return 'rgb(255,207,156)';
} else {
return null;
}
} else {
return null;
}
} else if (col_CODE === 'ACTT') {
if (flight['preFlight']['ACTT']) {
return 'rgb(148,207,255)';
} else {
return null;
}
} else {
return null;
}
2018-11-19 09:30:59 +08:00
} else {
2018-11-29 10:40:23 +08:00
if (col_CODE === 'SODT') {
if (flight['reaFlight']['SODT']) {
if (!flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
return 'rgb(0,255,255)';
} else {
return null;
}
} else {
return null;
}
} else if (col_CODE === 'ESTT') {
if (flight['reaFlight']['ESTT']) {
if (!flight['reaFlight']['ACTT']) {
return 'rgb(255,207,156)';
} else {
return null;
}
} else {
return null;
}
} else if (col_CODE === 'ACTT') {
if (flight['reaFlight']['ACTT']) {
return 'rgb(148,207,255)';
} else {
return null;
}
} else {
return null;
}
2018-11-19 09:30:59 +08:00
}
}
2018-11-29 10:40:23 +08:00
/**
* 单元格内容居左居右
* @param col_CODE
* @param flight
*/
getPosition(col_CODE, flight) {
if (this.orderHandle.isDeptFlight(flight)) {
2018-11-29 10:40:23 +08:00
if (col_CODE === 'FLNO' || col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
return 'text-right';
}
} else if (this.orderHandle.isLinked(flight)) {
2018-11-29 10:40:23 +08:00
if (col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
if (!flight['renderPreFlight'][col_CODE] && flight['renderReaFlight'][col_CODE]) {
return 'text-right';
}
}
}
}
2018-12-13 18:15:41 +08:00
getVipNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['VIPP'] && flight['preFlight']['VIPP'] > 0) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['VIPP'] && flight['reaFlight']['VIPP'] > 0) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['VIPP'] && flight['preFlight']['VIPP'] > 0) || (flight['reaFlight']['VIPP'] && flight['reaFlight']['VIPP'] > 0)) {
return true;
} else {
return false;
}
}
}
getOutplanNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['UPTP'] && flight['preFlight']['UPTP'] === 'SCHD-ADFT') {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['UPTP'] && flight['reaFlight']['UPTP'] === 'SCHD-ADFT') {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['UPTP'] && flight['preFlight']['UPTP'] === 'SCHD-ADFT') || (flight['reaFlight']['UPTP'] && flight['reaFlight']['UPTP'] === 'SCHD-ADFT')) {
return true;
} else {
return false;
}
}
}
getAlternateNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['FDIV']) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['FDIV']) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['FDIV']) || (flight['reaFlight']['FDIV'])) {
return true;
} else {
return false;
}
}
}
getDelay30Notes(flight) {
// return false;
if (this.orderHandle.isArriFlight(flight)) {
return false;
} else {
if (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0) {
if (parseInt(flight['preFlight']['DELY'][0]['DURA']) - 30 > 0) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
getDelayNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['DELY'] && Array.isArray(flight['preFlight']['DELY']) && flight['preFlight']['DELY'].length > 0) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['DELY'] && Array.isArray(flight['preFlight']['DELY']) && flight['preFlight']['DELY'].length > 0) || (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0)) {
return true;
} else {
return false;
}
}
}
getReturnNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['FRET']) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['FRET']) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['FRET']) || (flight['reaFlight']['FRET'])) {
return true;
} else {
return false;
}
}
}
getCancleNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['CNCL']) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['CNCL']) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['CNCL']) || (flight['reaFlight']['CNCL'])) {
return true;
} else {
return false;
}
}
}
getStopoverNotes(flight) {
if (this.orderHandle.isLinked(flight)) {
if (flight['preFlight']['ACTT'] && flight['reaFlight']['ESTT']) {
if (new Date(dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(dateFormatter(flight['preFlight']['ACTT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['ACTT'] && flight['reaFlight']['SODT']) {
if (new Date(dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(dateFormatter(flight['preFlight']['ACTT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['ESTT'] && flight['reaFlight']['ESTT']) {
if (new Date(dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(dateFormatter(flight['preFlight']['ESTT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['ESTT'] && flight['reaFlight']['SODT']) {
if (new Date(dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(dateFormatter(flight['preFlight']['ESTT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['SODT'] && flight['reaFlight']['ESTT']) {
if (new Date(dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(dateFormatter(flight['preFlight']['SODT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['SODT'] && flight['reaFlight']['SODT']) {
if (new Date(dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(dateFormatter(flight['preFlight']['SODT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else {
return false;
}
} else {
return false;
}
}
/**
* 复选框勾选事件
*/
checkboxChange() {
for (const key in this.checkboxGroup) {
if (this.checkboxGroup.hasOwnProperty(key)) {
if (this.checkboxGroup[key]) {
this.tabClose = false;
break;
} else {
this.tabClose = true;
continue;
}
}
}
this.changeDetectorRef.detectChanges()
}
/**
* tab项切换事件
*/
nzClick() {
this.changeDetectorRef.detectChanges();
}
2018-11-06 09:41:04 +08:00
}