工具类抽取及历史数据处理
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 登机桥显示转换
|
||||
*/
|
||||
|
||||
export default function (flight) {
|
||||
if(flight['ABTM']){
|
||||
if(Array.isArray(flight['ABTM'])&&flight['ABTM'].length>0){
|
||||
let abdg = [];
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
abdg.push(flight['ABTM'][i]['ABDG']);
|
||||
}
|
||||
let set = new Set(abdg);
|
||||
return Array.from(set).join(',');
|
||||
}else{
|
||||
return ''
|
||||
}
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* 实际到达/出发时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
export default function (flight) {
|
||||
if (flight['ACTT']) {
|
||||
return timeFormatter(flight['ACTT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
export class AlertMessageHandle{
|
||||
public alertMessage = {
|
||||
'FLOP-CNCL':'',
|
||||
'FLOP-FRET':'',
|
||||
'FLOP-FDIV':'',
|
||||
'FLOP-FDEL':'',
|
||||
'FLOP-DELY':'',
|
||||
'FLOP-ACTT':'',
|
||||
'FLOP-GTDT':'',
|
||||
'FLOP-PSDT':'',
|
||||
'FLOP-ESTT':'',
|
||||
'FLOP-PADT':'',
|
||||
'FLOP-CKDT':'',
|
||||
'FLOP-BOTM':'',
|
||||
'FLOP-CLDT':'',
|
||||
'FLOP-ROUT':'',
|
||||
'FLOP-VIPP':'',
|
||||
'FLOP-HNAG':'',
|
||||
'FLOP-FLBG':'',
|
||||
'FLOP-RENO':'',
|
||||
'FLOP-ABTM':'',
|
||||
'FLOP-CHOT':'',
|
||||
'FLOP-TRML':'',
|
||||
}
|
||||
|
||||
public flopCncl(){
|
||||
return '航班取消事件'
|
||||
}
|
||||
public flopFret(){
|
||||
return '航班返航事件'
|
||||
}
|
||||
public flopFdiv(){
|
||||
return '航班备降事件'
|
||||
}
|
||||
public flopFdel(){
|
||||
return '航班删除事件'
|
||||
}
|
||||
public flopDely(){
|
||||
return '航班延误事件'
|
||||
}
|
||||
public flopActt(){
|
||||
return '航班实际时间事件'
|
||||
}
|
||||
public flopGtdt(){
|
||||
return '航班登机门事件'
|
||||
}
|
||||
public flopPsdt(){
|
||||
return '航班机位变更事件'
|
||||
}
|
||||
public flopEstt(){
|
||||
return '航班预计时间事件'
|
||||
}
|
||||
public flopPadt(){
|
||||
return '航班站起飞时间事件'
|
||||
}
|
||||
public flopCkdt(){
|
||||
return '航班值机柜台事件'
|
||||
}
|
||||
public flopBotm(){
|
||||
return '航班登机开始事件'
|
||||
}
|
||||
public flopCldt(){
|
||||
return '航班行李转盘事件'
|
||||
}
|
||||
public flopRout(){
|
||||
return '航班航线事件'
|
||||
}
|
||||
public flopVipp(){
|
||||
return '航班VIP事件'
|
||||
}
|
||||
public flopHnag(){
|
||||
return '航班代理事件'
|
||||
}
|
||||
public flopFlbg(){
|
||||
return '航班首末件行李到达事件'
|
||||
}
|
||||
public flopReno(){
|
||||
return '航班飞机号变更事件'
|
||||
}
|
||||
public flopAbtm(){
|
||||
return '航班靠桥撤桥事件'
|
||||
}
|
||||
public flopChdt(){
|
||||
return '航班上下轮档事件'
|
||||
}
|
||||
public flopTrml(){
|
||||
return '航班航站楼事件'
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 登机桥靠桥时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
|
||||
export default function (flight) {
|
||||
if (flight['ABTM']) {
|
||||
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
if (flight['ABTM'][i]['ABOP'] === 'A') {
|
||||
return timeFormatter(flight['ABTM'][i]['AOTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 登机桥撤桥时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
|
||||
export default function (flight) {
|
||||
if (flight['ABTM']) {
|
||||
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
if (flight['ABTM'][i]['ABOP'] === 'D') {
|
||||
return timeFormatter(flight['ABTM'][i]['AOTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 转盘号显示转换
|
||||
*/
|
||||
|
||||
export default function (flight) {
|
||||
if (flight['CLDT']) {
|
||||
if (Array.isArray(flight['CLDT']) && flight['CLDT'].length > 0) {
|
||||
let belt = [];
|
||||
for (let i = 0; i < flight['CLDT'].length; i++) {
|
||||
belt.push(flight['CLDT'][i]['BELT']);
|
||||
}
|
||||
let set = new Set(belt);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 登机开始时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
|
||||
export default function (flight) {
|
||||
if (flight['BOTM']) {
|
||||
return timeFormatter(flight['BOTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 值机结束时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
export default function(flight){
|
||||
if(flight['CKDT']){
|
||||
if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){
|
||||
return timeFormatter(flight['CKDT'][0]['CCTM']);
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
|
||||
import { DynamicFlightOrder } from './dynamic-flight-order';
|
||||
|
||||
export class CellColorHandle {
|
||||
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
|
||||
|
||||
public reno(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['RENO'] && flight['preFlight']['RENO'].indexOf('(') > 0) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (this.orderHandle.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['RENO'] && flight['reaFlight']['RENO'].indexOf('(') > 0) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if ((flight['preFlight']['RENO'] && flight['preFlight']['RENO'].indexOf('(') > 0) || (flight['reaFlight']['RENO'] && flight['reaFlight']['RENO'].indexOf('(') > 0)) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public actt(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['ACTT']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (flight['reaFlight']['ACTT']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public estt(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sodt(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['SODT'] && !flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (flight['reaFlight']['SODT'] && !flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public padt(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['PADT'] && flight['preFlight']['PADT'].indexOf('(') > 0) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (this.orderHandle.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['PADT'] && flight['reaFlight']['PADT'].indexOf('(') > 0) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if ((flight['preFlight']['PADT'] && flight['preFlight']['PADT'].indexOf('(') > 0) || (flight['reaFlight']['PADT'] && flight['reaFlight']['PADT'].indexOf('(') > 0)) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public psst(flight, colorSetting) {
|
||||
|
||||
}
|
||||
|
||||
public cotm(flight, colorSetting) {
|
||||
if (flight['renderFlight']['COTM'] && !flight['renderFlight']['CCTM']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public cctm(flight, colorSetting) {
|
||||
if (flight['renderFlight']['CCTM']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public botm(flight, colorSetting) {
|
||||
if (flight['renderFlight']['BOTM'] && !flight['renderFlight']['GCTM']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public gctm(flight, colorSetting) {
|
||||
if (flight['renderFlight']['GCTM']) {
|
||||
return {
|
||||
'background-color': colorSetting.COL_BG_COLOR,
|
||||
'color': colorSetting.COL_COLOR
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* 值机柜台显示转换
|
||||
*/
|
||||
export default function(flight){
|
||||
if(flight['CKDT']){
|
||||
if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){
|
||||
let chkc = [];
|
||||
for (let i = 0; i < flight['CKDT'].length; i++) {
|
||||
chkc.push(flight['CKDT'][i]['CHKC']);
|
||||
}
|
||||
let set = new Set(chkc);
|
||||
return Array.from(set).join(',');
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 下轮档时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
|
||||
export default function (flight) {
|
||||
if (flight['CHOT']) {
|
||||
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
|
||||
for (let i = 0; i < flight['CHOT'].length; i++) {
|
||||
if (flight['CHOT'][i]['CHID'] === 'OFF') {
|
||||
return timeFormatter(flight['CHOT'][i]['CHTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 上轮档时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
|
||||
export default function (flight) {
|
||||
if (flight['CHOT']) {
|
||||
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
|
||||
for (let i = 0; i < flight['CHOT'].length; i++) {
|
||||
if (flight['CHOT'][i]['CHID'] === 'ON') {
|
||||
return timeFormatter(flight['CHOT'][i]['CHTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* 行李传送带号显示转换
|
||||
*/
|
||||
export default function (flight) {
|
||||
if(flight['CHDT']){
|
||||
if(Array.isArray(flight['CHDT'])&&flight['CHDT'].length>0){
|
||||
let chdt = [];
|
||||
for (let i = 0; i < flight['CHDT'].length; i++) {
|
||||
chdt.push(flight['CHDT'][i]['CHUT']);
|
||||
}
|
||||
let set = new Set(chdt);
|
||||
return Array.from(set).join(',');
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 值机结束时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
export default function (flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
return timeFormatter(flight['CKDT'][0]['COTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
import dateFormatter from './date-formatter';
|
||||
export class DynamicFlightOrder {
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 获取航班实际时间
|
||||
* @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']
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否是链接航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isLinked(flight) {
|
||||
if (flight['preFlight'] && flight['reaFlight']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否是纯离港航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDeptFlight(flight) {
|
||||
if (!flight['preFlight'] && flight['reaFlight']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否是纯到港航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isArriFlight(flight) {
|
||||
if (flight['preFlight'] && !flight['reaFlight']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否已经前站起飞
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isFlying(flight) {
|
||||
if (this.isArriFlight(flight) || this.isLinked(flight)) {
|
||||
if (flight['preFlight']['PADT']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否取消
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isCancled(flight) {
|
||||
if (this.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['CNCL']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['CNCL']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班)
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDelayed(flight) {
|
||||
if (this.isDeptFlight(flight) || this.isLinked(flight)) {
|
||||
if (flight['reaFlight']['DELY']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否已经执行完成
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDone(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (!this.getActualDatetime(flight['reaFlight'])) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
if (!this.getActualDatetime(flight['preFlight'])) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否开始登机
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public startBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (!flight['reaFlight']['BOTM']) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否正在登机中
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['BOTM'] && !(flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM'])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否登机结束
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isOverBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 行排序规则方法
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
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)) {
|
||||
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['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
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['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_4;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
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['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['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['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['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['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_10;
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
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['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_12;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (this.isCancled(flight)) {
|
||||
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;
|
||||
}
|
||||
return this.TOP_14
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* 航线显示转换
|
||||
*/
|
||||
export default function(flight){
|
||||
if(flight['ERUT']){
|
||||
if(Array.isArray(flight['ERUT'])&&flight['ERUT'].length>0){
|
||||
let erut = [];
|
||||
for (let i = 0; i < flight['ERUT'].length; i++) {
|
||||
erut.push(flight['ERUT'][i]['APCD']);
|
||||
}
|
||||
return erut.join(' - ');
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* 预计到达/出发时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
export default function (flight) {
|
||||
if (flight['ESTT']) {
|
||||
return timeFormatter(flight['ESTT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,722 @@
|
||||
import { TransferRenderHandle } from './transfer-render-handle';
|
||||
import { DynamicFlightOrder } from './dynamic-flight-order';
|
||||
|
||||
export class FlightsDataHandle {
|
||||
public transferHandle = new TransferRenderHandle();
|
||||
|
||||
public formatter = {
|
||||
'GCTM': this.transferHandle.gctmFormatter.bind(this.transferHandle),
|
||||
'BOTM': this.transferHandle.botmFormatter.bind(this.transferHandle),
|
||||
'ABDG': this.transferHandle.abdgFormatter.bind(this.transferHandle),
|
||||
'AOTM_A': this.transferHandle.aotm_aFormatter.bind(this.transferHandle),
|
||||
'AOTM_D': this.transferHandle.aotm_dFormatter.bind(this.transferHandle),
|
||||
'BELT': this.transferHandle.beltFormatter.bind(this.transferHandle),
|
||||
'CHKC': this.transferHandle.chkcFormatter.bind(this.transferHandle),
|
||||
'CCTM': this.transferHandle.cctmFormatter.bind(this.transferHandle),
|
||||
'COTM': this.transferHandle.cotmFormatter.bind(this.transferHandle),
|
||||
'CHTM_ON': this.transferHandle.chtmOnFormatter.bind(this.transferHandle),
|
||||
'CHTM_OFF': this.transferHandle.chtmOffFormatter.bind(this.transferHandle),
|
||||
'LACL': this.transferHandle.laclFormatter.bind(this.transferHandle),
|
||||
'CHUT': this.transferHandle.chutFormatter.bind(this.transferHandle),
|
||||
'ACTT': this.transferHandle.acttFormatter.bind(this.transferHandle),
|
||||
'PSST': this.transferHandle.psstFormatter.bind(this.transferHandle),
|
||||
'ESTT': this.transferHandle.esttFormatter.bind(this.transferHandle),
|
||||
'MVIN': this.transferHandle.mvinFormatter.bind(this.transferHandle),
|
||||
'ERUT': this.transferHandle.erutFormatter.bind(this.transferHandle),
|
||||
'FLIN': this.transferHandle.flinFormatter.bind(this.transferHandle),
|
||||
'SODT': this.transferHandle.sodtFormatter.bind(this.transferHandle),
|
||||
'GATE': this.transferHandle.gateFormatter.bind(this.transferHandle),
|
||||
'PADT': this.transferHandle.padtFormatter.bind(this.transferHandle)
|
||||
}
|
||||
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
|
||||
|
||||
public findLinkFlights(raw_flights) {
|
||||
let combined_raw_flights: Array<any> = [];
|
||||
let copy_raw_flights = [];
|
||||
raw_flights.forEach(element => {
|
||||
copy_raw_flights.push(Object.assign({}, element))
|
||||
})
|
||||
for (let i = 0; i < copy_raw_flights.length; i++) {
|
||||
if (copy_raw_flights[i]['MVIN'] === 'A') {
|
||||
if (copy_raw_flights[i]['TAID']) {
|
||||
let index = copy_raw_flights.findIndex(val => { return val['FLID'] === copy_raw_flights[i]['TAID'] });
|
||||
if (index > -1) {
|
||||
copy_raw_flights[i]['isLinked'] = true;
|
||||
copy_raw_flights[i]['linkFlight'] = copy_raw_flights[index];
|
||||
if (!copy_raw_flights[i]['linkFlight']['TAID']) {
|
||||
copy_raw_flights[i]['linkFlight']['TAID'] = copy_raw_flights[i]['FLID'];
|
||||
}
|
||||
copy_raw_flights.splice(index, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copy_raw_flights.forEach(element => {
|
||||
let flights_item = {};
|
||||
if (element['MVIN'] === 'A' && !element['isLinked']) {
|
||||
flights_item['preFlight'] = element;
|
||||
} else if (element['MVIN'] === 'D' && !element['isLinked']) {
|
||||
flights_item['reaFlight'] = element;
|
||||
} else {
|
||||
flights_item['reaFlight'] = element['linkFlight'];
|
||||
delete element['linkFlight'];
|
||||
delete element['isLinked'];
|
||||
flights_item['preFlight'] = element;
|
||||
}
|
||||
|
||||
combined_raw_flights.push(flights_item);
|
||||
});
|
||||
|
||||
return combined_raw_flights;
|
||||
}
|
||||
|
||||
public flightsRenderTransfer(item, col_lists) {
|
||||
let render_flight = {},
|
||||
render_pre_flight = {},
|
||||
render_rea_flight = {},
|
||||
flights_item = Object.assign({}, item)
|
||||
|
||||
if (flights_item['preFlight'] && !flights_item['reaFlight']) {
|
||||
for (let i = 0; i < col_lists.length; i++) {
|
||||
let key = col_lists[i]['COL_CODE'];
|
||||
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](flights_item['preFlight']) : flights_item['preFlight'][key];
|
||||
}
|
||||
flights_item['renderFlight'] = render_flight;
|
||||
} else if (!flights_item['preFlight'] && flights_item['reaFlight']) {
|
||||
for (let i = 0; i < col_lists.length; i++) {
|
||||
let key = col_lists[i]['COL_CODE']
|
||||
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](flights_item['reaFlight']) : flights_item['reaFlight'][key];
|
||||
}
|
||||
flights_item['renderFlight'] = render_flight;
|
||||
} else {
|
||||
for (let i = 0; i < col_lists.length; i++) {
|
||||
let preHasValue, reaHasValue;
|
||||
let key = col_lists[i]['COL_CODE'];
|
||||
if (this.formatter.hasOwnProperty(key)) {
|
||||
preHasValue = this.formatter[key](flights_item['preFlight']);
|
||||
reaHasValue = this.formatter[key](flights_item['reaFlight']);
|
||||
} else {
|
||||
preHasValue = flights_item['preFlight'][key];
|
||||
reaHasValue = flights_item['reaFlight'][key];
|
||||
}
|
||||
|
||||
if (preHasValue && !reaHasValue) {
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = preHasValue + ' / ';
|
||||
} else {
|
||||
render_flight[key] = preHasValue;
|
||||
}
|
||||
} else if (!preHasValue && reaHasValue) {
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = ' / ' + reaHasValue;
|
||||
} else {
|
||||
render_flight[key] = reaHasValue;
|
||||
}
|
||||
} else if (preHasValue && reaHasValue) {
|
||||
if (preHasValue === reaHasValue) {
|
||||
render_flight[key] = preHasValue;
|
||||
} else {
|
||||
if (key === 'ERUT') {
|
||||
render_flight[key] = preHasValue.split(' - ').slice(0, -1).join(' - ') + ' - ' + reaHasValue;
|
||||
} else {
|
||||
render_flight[key] = preHasValue + ' / ' + reaHasValue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
render_flight[key] = '';
|
||||
}
|
||||
render_pre_flight[key] = preHasValue;
|
||||
render_rea_flight[key] = reaHasValue;
|
||||
}
|
||||
flights_item['renderPreFlight'] = render_pre_flight;
|
||||
flights_item['renderReaFlight'] = render_rea_flight;
|
||||
flights_item['renderFlight'] = Object.assign({}, render_flight);
|
||||
}
|
||||
|
||||
return flights_item;
|
||||
}
|
||||
|
||||
public basicDataTransHandle(item, airports, citys, airlines, flightStatus, flightTypes) {
|
||||
if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) {
|
||||
//航线处理
|
||||
let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
let erutChnArray = []
|
||||
for (let i = 0; i < erutCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutChnArray.push(citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutChnArray.push(erutCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderFlight']['ERUT'] = erutChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
||||
item['renderFlight']['ALCD'] = airlines[airlineIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc;
|
||||
//航班类型处理
|
||||
item['renderFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderFlight']['FLTY']).flightTypeNameCn;
|
||||
} else {
|
||||
//航线处理
|
||||
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
let erutLinkChnArray = []
|
||||
for (let i = 0; i < erutLinkCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutLinkChnArray.push(citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutLinkChnArray.push(erutLinkCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderFlight']['ERUT'] = erutLinkChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineLinkIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
||||
item['renderFlight']['ALCD'] = airlines[airlineLinkIndex].airlineName;
|
||||
//运营状态处理
|
||||
let ftssLinkCodeArray = item['renderFlight']['FTSS'].split(' / ');
|
||||
let ftssLinkChnArray = [];
|
||||
for (let i = 0; i < ftssLinkCodeArray.length; i++) {
|
||||
ftssLinkChnArray.push(flightStatus.find(val => val.sttc === ftssLinkCodeArray[i]).stdc)
|
||||
}
|
||||
item['renderFlight']['FTSS'] = ftssLinkChnArray.join(' / ');
|
||||
|
||||
//航班类型处理
|
||||
let fltyLinkCodeArray = item['renderFlight']['FLTY'].split(' / ');
|
||||
let fltyLinkChnArray = [];
|
||||
for (let i = 0; i < fltyLinkCodeArray.length; i++) {
|
||||
fltyLinkChnArray.push(flightTypes.find(val => val.flightTypeCode === fltyLinkCodeArray[i]).flightTypeNameCn)
|
||||
}
|
||||
item['renderFlight']['FLTY'] = fltyLinkChnArray.join(' / ');
|
||||
|
||||
//航线处理
|
||||
let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - ');
|
||||
let erutPreChnArray = []
|
||||
for (let i = 0; i < erutPreCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutPreChnArray.push(citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutPreChnArray.push(erutPreCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderPreFlight']['ERUT'] = erutPreChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlinePreIndex = airlines.findIndex(val => val.airlineCode === item['renderPreFlight']['ALCD']);
|
||||
item['renderPreFlight']['ALCD'] = airlines[airlinePreIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderPreFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc
|
||||
//航班类型处理
|
||||
item['renderPreFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderPreFlight']['FLTY']).flightTypeNameCn;
|
||||
|
||||
|
||||
//航线处理
|
||||
let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - ');
|
||||
let erutReaChnArray = []
|
||||
for (let i = 0; i < erutReaCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutReaChnArray.push(citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutReaChnArray.push(erutReaCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderReaFlight']['ERUT'] = erutReaChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineReaIndex = airlines.findIndex(val => val.airlineCode === item['renderReaFlight']['ALCD']);
|
||||
item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc
|
||||
//航班类型处理
|
||||
item['renderReaFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderReaFlight']['FLTY']).flightTypeNameCn;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public dynamicMessageHandle(message, combined_data, render_data, col_lists, filterItems, LASTSEARCH, LAST_SEL_COL, airports, citys, airlines, flightStatus, flightTypes) {
|
||||
if (message.MVIN === 'A') {
|
||||
//针对combined_data的处理
|
||||
let index = combined_data.findIndex(element => {
|
||||
if (this.orderHandle.isArriFlight(element) || this.orderHandle.isLinked(element)) {
|
||||
if (element['preFlight']['FLID'] === message.FLID) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (index > -1) {
|
||||
combined_data[index]['preFlight'] = message;
|
||||
combined_data[index] = this.flightsRenderTransfer(combined_data[index], col_lists);
|
||||
combined_data[index] = this.basicDataTransHandle(combined_data[index], airports, citys, airlines, flightStatus, flightTypes);
|
||||
|
||||
if (message.UPTP === 'FLOP-AOTP') {
|
||||
if (this.orderHandle.isArriFlight(combined_data[index])) {
|
||||
if (message.TAID) {
|
||||
combined_data.splice(index, 1);
|
||||
|
||||
let i = combined_data.findIndex(element => {
|
||||
if (this.orderHandle.isDeptFlight(element)) {
|
||||
if (message.TAID === element['reaFlight']['FLID']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
combined_data[i]['reaFlight']['TAID'] = message.FLID;
|
||||
let newFlight = {};
|
||||
newFlight['preFlight'] = message;
|
||||
newFlight['reaFlight'] = combined_data[i]['reaFlight'];
|
||||
|
||||
combined_data.splice(i, 1);
|
||||
|
||||
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
|
||||
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
|
||||
combined_data.push(newFlight)
|
||||
}
|
||||
} else if (this.orderHandle.isLinked(combined_data[index])) {
|
||||
if (!message.TAID) {
|
||||
let newPreFlight = {},
|
||||
newReaFlight = {};
|
||||
|
||||
newPreFlight['preFlight'] = combined_data[index]['preFlight'];
|
||||
newPreFlight['renderFlight'] = combined_data[index]['renderPreFlight'];
|
||||
combined_data.push(newPreFlight);
|
||||
|
||||
delete combined_data[index]['reaFlight']['TAID'];
|
||||
newPreFlight['reaFlight'] = combined_data[index]['reaFlight'];
|
||||
newPreFlight['renderFlight'] = combined_data[index]['renderReaFlight'];
|
||||
combined_data.push(newReaFlight);
|
||||
|
||||
combined_data.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let newFlight = {};
|
||||
newFlight['preFlight'] = message;
|
||||
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
|
||||
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
|
||||
combined_data.push(newFlight);
|
||||
}
|
||||
|
||||
//针对render_data的处理
|
||||
let index1 = render_data.findIndex(element => {
|
||||
if (this.orderHandle.isArriFlight(element) || this.orderHandle.isLinked(element)) {
|
||||
if (element['preFlight']['FLID'] === message.FLID) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
if (index1 > -1) {
|
||||
render_data[index1]['preFlight'] = message;
|
||||
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
|
||||
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
|
||||
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (key === 'Abnormal_state') {
|
||||
if (render_data[index1]['preFlight'][filterItems[key]]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (render_data[index1]['preFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let search_satis = true;
|
||||
if (LASTSEARCH) {
|
||||
if (LAST_SEL_COL) {
|
||||
if (render_data[index1]['preFlight'][LAST_SEL_COL]) {
|
||||
if (render_data[index1]['preFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) {
|
||||
search_satis = true;
|
||||
} else {
|
||||
search_satis = false;
|
||||
}
|
||||
} else {
|
||||
search_satis = false;
|
||||
}
|
||||
} else {
|
||||
let cols = col_lists;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) {
|
||||
if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(LASTSEARCH, 'i'))) {
|
||||
search_satis = true;
|
||||
break;
|
||||
} else {
|
||||
search_satis = false;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
search_satis = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_satis && search_satis) {
|
||||
if (message.UPTP === 'FLOP-TAOP') {
|
||||
if (this.orderHandle.isArriFlight(render_data[index1])) {
|
||||
if (message.TAID) {
|
||||
let i = render_data.findIndex(element => {
|
||||
if (this.orderHandle.isDeptFlight(element)) {
|
||||
if (message.TAID === element['reaFlight']['FLID']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if (i > -1) {
|
||||
render_data.splice(index1, 1);
|
||||
render_data[i]['reaFlight']['TAID'] = message.FLID;
|
||||
let newFlight = {};
|
||||
newFlight['preFlight'] = message;
|
||||
newFlight['reaFlight'] = render_data[i]['reaFlight'];
|
||||
render_data.splice(i, 1);
|
||||
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
|
||||
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
|
||||
render_data.push(newFlight)
|
||||
}
|
||||
}
|
||||
} else if (this.orderHandle.isLinked(render_data[index1])) {
|
||||
if (!message.TAID) {
|
||||
let newPreFlight = {},
|
||||
newReaFlight = {};
|
||||
delete render_data[index1]['preFlight']['TAID'];
|
||||
newPreFlight['preFlight'] = render_data[index1]['preFlight'];
|
||||
newPreFlight['renderFlight'] = render_data[index1]['renderPreFlight'];
|
||||
delete render_data[index1]['reaFlight']['TAID'];
|
||||
newPreFlight['reaFlight'] = render_data[index1]['reaFlight'];
|
||||
newPreFlight['renderFlight'] = render_data[index1]['renderReaFlight'];
|
||||
render_data.splice(index1, 1);
|
||||
render_data.push(newPreFlight);
|
||||
render_data.push(newReaFlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.orderHandle.isArriFlight(render_data[index1])) {
|
||||
render_data.splice(index1, 1);
|
||||
} else if (this.orderHandle.isLinked(render_data[index1])) {
|
||||
delete render_data[index1]['preFlight'];
|
||||
delete render_data[index1]['renderPreFlight'];
|
||||
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
|
||||
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let newFlight = {};
|
||||
newFlight['preFlight'] = message;
|
||||
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
|
||||
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
|
||||
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (key === 'Abnormal_state') {
|
||||
if (newFlight['preFlight'][filterItems[key]]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (newFlight['preFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let search_satis = true;
|
||||
if (LASTSEARCH) {
|
||||
if (LAST_SEL_COL) {
|
||||
if (newFlight['preFlight'][LAST_SEL_COL]) {
|
||||
if (newFlight['preFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) {
|
||||
search_satis = true;
|
||||
} else {
|
||||
search_satis = false;
|
||||
}
|
||||
} else {
|
||||
search_satis = false;
|
||||
}
|
||||
} else {
|
||||
let cols = col_lists;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
if (newFlight['renderFlight'][cols[i]['COL_CODE']]) {
|
||||
if (newFlight['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(LASTSEARCH, 'i'))) {
|
||||
search_satis = true;
|
||||
break;
|
||||
} else {
|
||||
search_satis = false;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
search_satis = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_satis && search_satis) {
|
||||
let i = render_data.findIndex(element => {
|
||||
if (this.orderHandle.isDeptFlight(element)) {
|
||||
if (message.TAID === element['reaFlight']['FLID']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if (i > -1) {
|
||||
let newFlight = {};
|
||||
newFlight['preFlight'] = message;
|
||||
newFlight['reaFlight'] = Object.assign({}, render_data[i]['reaFlight']);
|
||||
render_data.splice(i, 1);
|
||||
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
|
||||
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
|
||||
render_data.push(newFlight);
|
||||
} else {
|
||||
render_data.push(newFlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//针对combined_data的处理
|
||||
let index = combined_data.findIndex(element => {
|
||||
if (this.orderHandle.isDeptFlight(element) || this.orderHandle.isLinked(element)) {
|
||||
if (element['reaFlight']['FLID'] === message.FLID) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (index > -1) {
|
||||
combined_data[index]['reaFlight'] = message;
|
||||
combined_data[index] = this.flightsRenderTransfer(combined_data[index], col_lists);
|
||||
combined_data[index] = this.basicDataTransHandle(combined_data[index], airports, citys, airlines, flightStatus, flightTypes);
|
||||
} else {
|
||||
let newFlight = {};
|
||||
newFlight['reaFlight'] = message;
|
||||
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
|
||||
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
|
||||
combined_data.push(newFlight);
|
||||
}
|
||||
|
||||
//针对render_data的处理
|
||||
let index1 = render_data.findIndex(element => {
|
||||
if (this.orderHandle.isDeptFlight(element) || this.orderHandle.isLinked(element)) {
|
||||
if (element['reaFlight']['FLID'] === message.FLID) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (index1 > -1) {
|
||||
render_data[index1]['reaFlight'] = message;
|
||||
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
|
||||
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
|
||||
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (key === 'Abnormal_state') {
|
||||
if (render_data[index1]['reaFlight'][filterItems[key]]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (render_data[index1]['reaFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let search_satis = true;
|
||||
if (LASTSEARCH) {
|
||||
if (LAST_SEL_COL) {
|
||||
if (render_data[index1]['reaFlight'][LAST_SEL_COL]) {
|
||||
if (render_data[index1]['reaFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) {
|
||||
search_satis = true;
|
||||
} else {
|
||||
search_satis = false;
|
||||
}
|
||||
} else {
|
||||
search_satis = false;
|
||||
}
|
||||
} else {
|
||||
let cols = col_lists;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) {
|
||||
if (render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(LASTSEARCH, 'i'))) {
|
||||
search_satis = true;
|
||||
break;
|
||||
} else {
|
||||
search_satis = false;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
search_satis = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_satis || !search_satis) {
|
||||
if (this.orderHandle.isDeptFlight(render_data[index1])) {
|
||||
render_data.splice(index1, 1);
|
||||
} else if (this.orderHandle.isLinked(render_data[index1])) {
|
||||
delete render_data[index1]['reaFlight'];
|
||||
delete render_data[index1]['renderReaFlight'];
|
||||
|
||||
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
|
||||
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let newFlight = {};
|
||||
newFlight['reaFlight'] = message;
|
||||
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
|
||||
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
|
||||
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (key === 'Abnormal_state') {
|
||||
if (newFlight['reaFlight'][filterItems[key]]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (newFlight['reaFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let search_satis = true;
|
||||
if (LASTSEARCH) {
|
||||
if (LAST_SEL_COL) {
|
||||
if (newFlight['reaFlight'][LAST_SEL_COL]) {
|
||||
if (newFlight['reaFlight'][LAST_SEL_COL].toString().match(new RegExp(LASTSEARCH, 'i'))) {
|
||||
search_satis = true;
|
||||
} else {
|
||||
search_satis = false;
|
||||
}
|
||||
} else {
|
||||
search_satis = false;
|
||||
}
|
||||
} else {
|
||||
let cols = col_lists;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
if (newFlight['renderFlight'][cols[i]['COL_CODE']]) {
|
||||
if (newFlight['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(LASTSEARCH, 'i'))) {
|
||||
search_satis = true;
|
||||
break;
|
||||
} else {
|
||||
search_satis = false;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
search_satis = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_satis && search_satis) {
|
||||
let i = render_data.findIndex(element => {
|
||||
if (this.orderHandle.isArriFlight(element)) {
|
||||
if (message.TAID === element['preFlight']['FLID']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if (i > -1) {
|
||||
let newFlight = {};
|
||||
newFlight['reaFlight'] = message;
|
||||
newFlight['preFlight'] = Object.assign({}, render_data[i]['preFlight']);
|
||||
render_data.splice(i, 1);
|
||||
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
|
||||
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
|
||||
render_data.push(newFlight);
|
||||
} else {
|
||||
render_data.push(newFlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'combined_data': combined_data,
|
||||
'render_data': render_data
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* 航线类别显示转换
|
||||
*/
|
||||
const flinChn = {
|
||||
'D': '国内',
|
||||
'I': '国际',
|
||||
'M': '混合',
|
||||
'R': '地区'
|
||||
}
|
||||
export default function (flight) {
|
||||
if (flight['FLIN']) {
|
||||
return flinChn[flight['FLIN']];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 登机门显示转换
|
||||
*/
|
||||
|
||||
export default function (flight) {
|
||||
if (flight['GTDT']) {
|
||||
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
|
||||
let gate = [];
|
||||
for (let i = 0; i < flight['GTDT'].length; i++) {
|
||||
gate.push(flight['GTDT'][i]['GATE']);
|
||||
}
|
||||
let set = new Set(gate);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* 登机结束时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
|
||||
export default function (flight) {
|
||||
if (flight['GTDT']) {
|
||||
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
|
||||
return timeFormatter(flight['GTDT'][0]['GCTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* 最后通知时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
export default function (flight) {
|
||||
if (flight['LACL']) {
|
||||
return timeFormatter(flight['LACL']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* 到达/出发显示转换
|
||||
*/
|
||||
export default function (flight) {
|
||||
if (flight['MVIN']) {
|
||||
if (flight['MVIN'] === 'A') {
|
||||
return '到达';
|
||||
} else if (flight['MVIN'] === 'D') {
|
||||
return '出发';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* 前站起飞时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
export default function (flight) {
|
||||
if (flight['PADT']) {
|
||||
return timeFormatter(flight['PADT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* 计划停机位显示转换
|
||||
*/
|
||||
export default function(flight){
|
||||
if(flight['PSDT']){
|
||||
if(Array.isArray(flight['PSDT'])&&flight['PSDT'].length>0){
|
||||
let chkc = [];
|
||||
for (let i = 0; i < flight['PSDT'].length; i++) {
|
||||
chkc.push(flight['PSDT'][i]['PSST']);
|
||||
}
|
||||
let set = new Set(chkc);
|
||||
return Array.from(set).join(',');
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* 计划到达/出发时间显示转换
|
||||
*/
|
||||
import timeFormatter from './time-formatter';
|
||||
export default function (flight) {
|
||||
if (flight['SODT']) {
|
||||
return timeFormatter(flight['SODT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
import timeFormatter from './time-formatter';
|
||||
export class TransferRenderHandle {
|
||||
|
||||
public gctmFormatter(flight) {
|
||||
if (flight['GTDT']) {
|
||||
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
|
||||
return timeFormatter(flight['GTDT'][0]['GCTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public botmFormatter(flight) {
|
||||
if (flight['BOTM']) {
|
||||
return timeFormatter(flight['BOTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public abdgFormatter(flight) {
|
||||
if (flight['ABTM']) {
|
||||
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
|
||||
let abdg = [];
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
abdg.push(flight['ABTM'][i]['ABDG']);
|
||||
}
|
||||
let set = new Set(abdg);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public aotm_aFormatter(flight) {
|
||||
if (flight['ABTM']) {
|
||||
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
if (flight['ABTM'][i]['ABOP'] === 'A') {
|
||||
return timeFormatter(flight['ABTM'][i]['AOTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public aotm_dFormatter(flight) {
|
||||
if (flight['ABTM']) {
|
||||
if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) {
|
||||
for (let i = 0; i < flight['ABTM'].length; i++) {
|
||||
if (flight['ABTM'][i]['ABOP'] === 'D') {
|
||||
return timeFormatter(flight['ABTM'][i]['AOTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public beltFormatter(flight) {
|
||||
if (flight['CLDT']) {
|
||||
if (Array.isArray(flight['CLDT']) && flight['CLDT'].length > 0) {
|
||||
let belt = [];
|
||||
for (let i = 0; i < flight['CLDT'].length; i++) {
|
||||
belt.push(flight['CLDT'][i]['BELT']);
|
||||
}
|
||||
let set = new Set(belt);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public chkcFormatter(flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
let chkc = [];
|
||||
for (let i = 0; i < flight['CKDT'].length; i++) {
|
||||
chkc.push(flight['CKDT'][i]['CHKC']);
|
||||
}
|
||||
let set = new Set(chkc);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public cctmFormatter(flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
return timeFormatter(flight['CKDT'][0]['CCTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public cotmFormatter(flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
return timeFormatter(flight['CKDT'][0]['COTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public chtmOnFormatter(flight) {
|
||||
if (flight['CHOT']) {
|
||||
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
|
||||
for (let i = 0; i < flight['CHOT'].length; i++) {
|
||||
if (flight['CHOT'][i]['CHID'] === 'ON') {
|
||||
return timeFormatter(flight['CHOT'][i]['CHTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public chtmOffFormatter(flight) {
|
||||
if (flight['CHOT']) {
|
||||
if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) {
|
||||
for (let i = 0; i < flight['CHOT'].length; i++) {
|
||||
if (flight['CHOT'][i]['CHID'] === 'OFF') {
|
||||
return timeFormatter(flight['CHOT'][i]['CHTM']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public laclFormatter(flight) {
|
||||
if (flight['LACL']) {
|
||||
return timeFormatter(flight['LACL']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public chutFormatter(flight) {
|
||||
if (flight['CHDT']) {
|
||||
if (Array.isArray(flight['CHDT']) && flight['CHDT'].length > 0) {
|
||||
let chdt = [];
|
||||
for (let i = 0; i < flight['CHDT'].length; i++) {
|
||||
chdt.push(flight['CHDT'][i]['CHUT']);
|
||||
}
|
||||
let set = new Set(chdt);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public acttFormatter(flight) {
|
||||
if (flight['ACTT']) {
|
||||
return timeFormatter(flight['ACTT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public psstFormatter(flight) {
|
||||
if (flight['PSDT']) {
|
||||
if (Array.isArray(flight['PSDT']) && flight['PSDT'].length > 0) {
|
||||
let chkc = [];
|
||||
for (let i = 0; i < flight['PSDT'].length; i++) {
|
||||
chkc.push(flight['PSDT'][i]['PSST']);
|
||||
}
|
||||
let set = new Set(chkc);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public esttFormatter(flight) {
|
||||
if (flight['ESTT']) {
|
||||
return timeFormatter(flight['ESTT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public mvinFormatter(flight) {
|
||||
if (flight['MVIN']) {
|
||||
if (flight['MVIN'] === 'A') {
|
||||
return '到达';
|
||||
} else if (flight['MVIN'] === 'D') {
|
||||
return '出发';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public erutFormatter(flight) {
|
||||
if (flight['ERUT']) {
|
||||
if (Array.isArray(flight['ERUT']) && flight['ERUT'].length > 0) {
|
||||
let erut = [];
|
||||
for (let i = 0; i < flight['ERUT'].length; i++) {
|
||||
erut.push(flight['ERUT'][i]['APCD']);
|
||||
}
|
||||
return erut.join(' - ');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public flinFormatter(flight) {
|
||||
const flinChn = {
|
||||
'D': '国内',
|
||||
'I': '国际',
|
||||
'M': '混合',
|
||||
'R': '地区'
|
||||
}
|
||||
if (flight['FLIN']) {
|
||||
return flinChn[flight['FLIN']];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public sodtFormatter(flight) {
|
||||
if (flight['SODT']) {
|
||||
return timeFormatter(flight['SODT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public gateFormatter(flight) {
|
||||
if (flight['GTDT']) {
|
||||
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
|
||||
let gate = [];
|
||||
for (let i = 0; i < flight['GTDT'].length; i++) {
|
||||
gate.push(flight['GTDT'][i]['GATE']);
|
||||
}
|
||||
let set = new Set(gate);
|
||||
return Array.from(set).join(',');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public padtFormatter(flight) {
|
||||
if (flight['PADT']) {
|
||||
return timeFormatter(flight['PADT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user