航班定位实现
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
"layui-laydate": "^5.0.9",
|
||||
"ng-zorro-antd": "^1.8.0",
|
||||
"ngx-color-picker": "^7.0.1",
|
||||
"ngx-web-worker": "^7.0.0",
|
||||
"rxjs": "^6.0.0",
|
||||
"zone.js": "^0.8.26",
|
||||
"ztree": "^3.5.24"
|
||||
|
||||
@@ -5,7 +5,7 @@ import { HttpClientService } from '../../services/http-client.service';
|
||||
import { BasicDataService } from '../../services/basic-data-service';
|
||||
import { OperateSpinServiceService } from '../../services/operate-spin-service.service';
|
||||
|
||||
import { DynamicFlightOrder } from '../../utils/dynamic-flight-order';
|
||||
import { FlightOrder } from '../../utils/flight-order';
|
||||
import { FlightsDataHandle } from '../../utils/flights-data-handle';
|
||||
|
||||
import * as $ from 'jquery';
|
||||
@@ -28,7 +28,7 @@ export class HistoricalDataComponent implements OnInit {
|
||||
this.operateSpinServiceService.showSpin();
|
||||
this.changeDetectorRef.detach();
|
||||
}
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
public orderHandle = new FlightOrder();
|
||||
public dataHandle = new FlightsDataHandle();
|
||||
|
||||
public tabClose: boolean = true;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="search-filter mb-3" #searchFilter>
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select [(ngModel)]="SEL_COL" class="mr-4 form-control" name="" id="">
|
||||
<select [(ngModel)]="SEL_COL" class="mr-4 form-control" (ngModelChange)="resetPositionArray()" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
<option *ngFor="let airline_col of render_col_lists" [value]="airline_col.COL_CODE">{{airline_col.COL_CN}}</option>
|
||||
</select>
|
||||
@@ -15,7 +15,7 @@
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter)="inputEnter()">
|
||||
<input class="form-control" [(ngModel)]="SEARCH" (ngModelChange)="resetPositionArray()" type="text" (keyup.enter)="inputEnter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-2">
|
||||
<button type="button" class="btn btn-info mr-2" (click)="toggleFilter()">{{filterClose?'展开':'关闭'}}</button>
|
||||
@@ -101,42 +101,6 @@
|
||||
<option *ngFor="let anget of flightAgents" [value]="anget.oGId">{{anget.flightAgentName}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- <div class="input-container mr-4">
|
||||
<label for="">前时间段: </label>
|
||||
<select [(ngModel)]="filterItems.Start_time" (ngModelChange)="selectChange('filter')" class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="1">前1小时</option>
|
||||
<option value="2">前2小时</option>
|
||||
<option value="3">前3小时</option>
|
||||
<option value="4">前4小时</option>
|
||||
<option value="5">前5小时</option>
|
||||
<option value="6">前6小时</option>
|
||||
<option value="7">前7小时</option>
|
||||
<option value="8">前8小时</option>
|
||||
<option value="9">前9小时</option>
|
||||
<option value="10">前10小时</option>
|
||||
<option value="11">前11小时</option>
|
||||
<option value="12">前12小时</option>
|
||||
</select>
|
||||
</div> -->
|
||||
<!-- <div class="input-container mr-4">
|
||||
<label for="">后时间段: </label>
|
||||
<select [(ngModel)]="filterItems.End_time" (ngModelChange)="selectChange('filter')" class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="1">后1小时</option>
|
||||
<option value="2">后2小时</option>
|
||||
<option value="3">后3小时</option>
|
||||
<option value="4">后4小时</option>
|
||||
<option value="5">后5小时</option>
|
||||
<option value="6">后6小时</option>
|
||||
<option value="7">后7小时</option>
|
||||
<option value="8">后8小时</option>
|
||||
<option value="9">后9小时</option>
|
||||
<option value="10">后10小时</option>
|
||||
<option value="11">后11小时</option>
|
||||
<option value="12">后12小时</option>
|
||||
</select>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div [ngClass]="{'filterClose-c':filterClose,'filterClose-o':!filterClose}" class="third-condition row">
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { Component, OnInit, ViewChild, Renderer2 } from '@angular/core';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
import { WebWorkerService } from 'ngx-web-worker';
|
||||
|
||||
import { ToastService } from '../../components/toast/toast.service';
|
||||
import { ToastConfig, ToastType } from '../../components/toast/toast-model';
|
||||
|
||||
@@ -10,28 +8,23 @@ import { BasicDataService } from '../../services/basic-data-service';
|
||||
import { OperateSpinServiceService } from '../../services/operate-spin-service.service';
|
||||
import { WebsocketService } from '../../services/websocket.service';
|
||||
|
||||
import { DynamicFlightOrder } from '../../utils/dynamic-flight-order';
|
||||
import { FlightOrder } from '../../utils/flight-order';
|
||||
import { FlightsDataHandle } from '../../utils/flights-data-handle';
|
||||
import { CellColorHandle } from '../../utils/cell-color-handle';
|
||||
import { AlertMessageHandle } from '../../utils/alert-message-handle';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
import dateFormatter from '../../utils/date-formatter';
|
||||
import webWorkerHandle from '../../utils/web-worker-handle';
|
||||
|
||||
import { filter } from 'rxjs/operators';
|
||||
import * as $ from 'jquery';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main',
|
||||
templateUrl: './main.component.html',
|
||||
styleUrls: ['./main.component.scss'],
|
||||
providers: [WebWorkerService]
|
||||
styleUrls: ['./main.component.scss']
|
||||
})
|
||||
export class MainComponent implements OnInit {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private renderer2: Renderer2,
|
||||
private webWorkerService: WebWorkerService,
|
||||
private basicDataService: BasicDataService,
|
||||
private operateSpinServiceService: OperateSpinServiceService,
|
||||
private httpCilent: HttpClientService,
|
||||
@@ -64,10 +57,11 @@ export class MainComponent implements OnInit {
|
||||
// }
|
||||
// )
|
||||
}
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
public orderHandle = new FlightOrder();
|
||||
public dataHandle = new FlightsDataHandle();
|
||||
public cellColorHandle = new CellColorHandle();
|
||||
public alertMessageHandle = new AlertMessageHandle();
|
||||
public utils = new Utils();
|
||||
|
||||
public tabClose: boolean = true;
|
||||
|
||||
@@ -268,10 +262,9 @@ export class MainComponent implements OnInit {
|
||||
})
|
||||
|
||||
//计算可视区域高度,渲染数据
|
||||
this.calcVisibleCount()
|
||||
this.wait_render_data = combined_data;
|
||||
this.selectedFilterData = combined_data;
|
||||
this.render_data = this.wait_render_data.slice(this.start, this.end);
|
||||
this.calcVisibleCount()
|
||||
|
||||
//默认选中第一条
|
||||
if (this.render_data.length > 0) {
|
||||
@@ -354,6 +347,8 @@ export class MainComponent implements OnInit {
|
||||
*/
|
||||
refresh() {
|
||||
this.operateSpinServiceService.showSpin();
|
||||
this.positionedArray = []; //定位数组为清空
|
||||
this.positionArrayIndex = 0; //定位元素Index归零
|
||||
this.canHandleDynamicMessage = false;
|
||||
this.canHandleDynamicAlert = false;
|
||||
this.SEARCH = ''; //手动输入条件
|
||||
@@ -369,8 +364,6 @@ export class MainComponent implements OnInit {
|
||||
FTSS: '', //运营状态
|
||||
TRML: '', //航站楼
|
||||
Abnormal_state: '', //异常状态
|
||||
// Start_time: '9',
|
||||
// End_time: '9',
|
||||
FHAG: '', //机坪代理
|
||||
MHAG: '', //维护代理
|
||||
PHAG: '', //旅客代理
|
||||
@@ -541,11 +534,11 @@ export class MainComponent implements OnInit {
|
||||
if (this.FLT_POS === 1) {
|
||||
this.LAST_SEL_COL = this.SEL_COL;
|
||||
this.LASTSEARCH = this.SEARCH;
|
||||
// this.selectChange('filter')
|
||||
// this.selectChange('filter');
|
||||
this.operateSpinServiceService.showSpin();
|
||||
this.inputFilter(this.selectedFilterData);
|
||||
} else {
|
||||
this.inputPosition(this.render_data)
|
||||
this.inputPosition(this.wait_render_data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,6 +547,8 @@ export class MainComponent implements OnInit {
|
||||
*/
|
||||
selectChange(type) {
|
||||
if (type === 'filter') {
|
||||
this.positionedArray = [];
|
||||
this.positionArrayIndex = 0;
|
||||
this.operateSpinServiceService.showSpin();
|
||||
}
|
||||
|
||||
@@ -814,65 +809,151 @@ export class MainComponent implements OnInit {
|
||||
positionArrayIndex: number = 0;
|
||||
|
||||
inputPosition(filterData) {
|
||||
let transArray = []
|
||||
let hasSearchData: boolean = false;
|
||||
let hasPositionedEle: boolean = false;
|
||||
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);
|
||||
for (let i = 0; i < filterData.length; i++) {
|
||||
if (i === filterData.length - 1) {
|
||||
this.positionedArray = [];
|
||||
this.positionArrayIndex = 0;
|
||||
}
|
||||
let fliterElement = filterData[i];
|
||||
if (fliterElement['renderFlight'][sel_col]) {
|
||||
if (fliterElement['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||
let hasThisEle: boolean = false;
|
||||
hasSearchData = true;
|
||||
for (let k = 0; k < this.positionedArray.length; k++) {
|
||||
let positionedElement = this.positionedArray[k];
|
||||
let diffResult = this.utils.diff(positionedElement, fliterElement);
|
||||
if (diffResult) {
|
||||
hasThisEle = true;
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if (!hasThisEle) {
|
||||
hasPositionedEle = true;
|
||||
this.row_state = fliterElement;
|
||||
this.positionArrayIndex = i;
|
||||
this.positionedArray.push(fliterElement);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (!this.SEARCH) {
|
||||
transArray.push(element);
|
||||
}
|
||||
}
|
||||
});
|
||||
let hasThisEle: boolean = false;
|
||||
hasSearchData = true;
|
||||
for (let k = 0; k < this.positionedArray.length; k++) {
|
||||
let positionedElement = this.positionedArray[k];
|
||||
let diffResult = this.utils.diff(positionedElement, fliterElement);
|
||||
if (diffResult) {
|
||||
hasThisEle = true;
|
||||
break;
|
||||
} else {
|
||||
filterData.forEach(element => {
|
||||
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)
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if (!hasThisEle) {
|
||||
hasPositionedEle = true;
|
||||
this.row_state = fliterElement;
|
||||
this.positionArrayIndex = i;
|
||||
this.positionedArray.push(fliterElement);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let cols = this.render_col_lists;
|
||||
for (let i = 0; i < filterData.length; i++) {
|
||||
if (i === filterData.length - 1) {
|
||||
this.positionedArray = [];
|
||||
this.positionArrayIndex = 0;
|
||||
}
|
||||
let positionIsOk: boolean = false;
|
||||
let filterElement = filterData[i];
|
||||
for (let j = 0; j < cols.length; j++) {
|
||||
let elementCol = cols[j];
|
||||
if (filterElement['renderFlight'][elementCol['COL_CODE']]) {
|
||||
if (filterElement['renderFlight'][elementCol['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||
let hasThisEle: boolean = false;
|
||||
hasSearchData = true;
|
||||
for (let k = 0; k < this.positionedArray.length; k++) {
|
||||
let positionedElement = this.positionedArray[k];
|
||||
let diffResult = this.utils.diff(positionedElement, filterElement);
|
||||
if (diffResult) {
|
||||
hasThisEle = true;
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if (!hasThisEle) {
|
||||
hasPositionedEle = true;
|
||||
positionIsOk = true;
|
||||
this.row_state = filterElement;
|
||||
this.positionArrayIndex = i;
|
||||
this.positionedArray.push(filterElement);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (this.SEARCH) {
|
||||
continue;
|
||||
if (!this.SEARCH) {
|
||||
let hasThisEle: boolean = false;
|
||||
hasSearchData = true;
|
||||
for (let k = 0; k < this.positionedArray.length; k++) {
|
||||
let positionedElement = this.positionedArray[k];
|
||||
let diffResult = this.utils.diff(positionedElement, filterElement);
|
||||
if (diffResult) {
|
||||
hasThisEle = true;
|
||||
break;
|
||||
} else {
|
||||
transArray.push(element)
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if (!hasThisEle) {
|
||||
hasPositionedEle = true;
|
||||
positionIsOk = true;
|
||||
this.row_state = filterElement;
|
||||
this.positionArrayIndex = i;
|
||||
this.positionedArray.push(filterElement);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (positionIsOk) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!hasSearchData) {
|
||||
alert("没有搜索到相关数据");
|
||||
}
|
||||
if (hasPositionedEle) {
|
||||
const scrollTop = this.positionArrayIndex * this.trItemHeight
|
||||
this.tableBody.nativeElement.scrollTop = scrollTop;
|
||||
}
|
||||
}
|
||||
|
||||
if (transArray.length > 0) {
|
||||
if (transArray.toString() == this.positionedArray.toString()) {
|
||||
this.positionArrayIndex++;
|
||||
if (this.positionArrayIndex === this.positionedArray.length) {
|
||||
/**
|
||||
* 重置定位数组
|
||||
*/
|
||||
resetPositionArray() {
|
||||
this.positionedArray = [];
|
||||
this.positionArrayIndex = 0;
|
||||
}
|
||||
this.row_state = this.positionedArray[this.positionArrayIndex];
|
||||
} else {
|
||||
this.positionedArray = transArray;
|
||||
this.positionArrayIndex = 0;
|
||||
this.row_state = this.positionedArray[this.positionArrayIndex];
|
||||
}
|
||||
} else {
|
||||
alert('没有搜索到相关数据');
|
||||
}
|
||||
|
||||
let tr = $(".selected");
|
||||
let objTr = tr[0];
|
||||
if (objTr) {
|
||||
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 选中某行
|
||||
@@ -1134,37 +1215,37 @@ export class MainComponent implements OnInit {
|
||||
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) {
|
||||
if (new Date(this.utils.dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(this.utils.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) {
|
||||
if (new Date(this.utils.dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(this.utils.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) {
|
||||
if (new Date(this.utils.dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(this.utils.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) {
|
||||
if (new Date(this.utils.dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(this.utils.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) {
|
||||
if (new Date(this.utils.dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(this.utils.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) {
|
||||
if (new Date(this.utils.dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(this.utils.dateFormatter(flight['preFlight']['SODT'])).getTime() > 3600000) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -1201,49 +1282,3 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// if (this.SEL_COL) {
|
||||
// let sel_col = this.SEL_COL;
|
||||
// for (let i = 0; i < filterData.length; i++) {
|
||||
// let fliterElement = filterData[i];
|
||||
// if (fliterElement['renderFlight'][sel_col]) {
|
||||
// if (fliterElement['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
||||
// let positionedIsMarry = false;
|
||||
// for (let k = 0; k < this.positionedArray.length; k++) {
|
||||
// let positionedElement = this.positionedArray[k];
|
||||
// if (positionedElement['preFlight'] && !positionedElement['reaFlight']) {
|
||||
// if (fliterElement['preFlight'] && !fliterElement['reaFlight']) {
|
||||
// if (positionedElement['preFlight']['FLID'] === fliterElement['preFlight']['FLID']) {
|
||||
// positionedIsMarry = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// } else if (!positionedElement['preFlight'] && positionedElement['reaFlight']) {
|
||||
// if (!fliterElement['preFlight'] && fliterElement['reaFlight']) {
|
||||
// if (positionedElement['reaFlight']['FLID'] === fliterElement['reaFlight']['FLID']) {
|
||||
// positionedIsMarry = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (fliterElement['preFlight'] && fliterElement['reaFlight']) {
|
||||
// if ((positionedElement['preFlight']['FLID'] === fliterElement['preFlight']['FLID']) && (positionedElement['reaFlight']['FLID'] === fliterElement['reaFlight']['FLID'])) {
|
||||
// positionedIsMarry = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
// if(!positionedIsMarry){
|
||||
// this.row_state = fliterElement;
|
||||
// this.positionedArray.push(fliterElement);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import timeFormatter from '../../../utils/time-formatter';
|
||||
import dateFormatter from '../../../utils/date-formatter';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
|
||||
@Component({
|
||||
selector: 'app-related-tab',
|
||||
@@ -8,6 +7,8 @@ import dateFormatter from '../../../utils/date-formatter';
|
||||
styleUrls: ['./related-tab.component.scss']
|
||||
})
|
||||
export class RelatedTabComponent implements OnInit {
|
||||
private utils = new Utils();
|
||||
|
||||
public lines;
|
||||
public airports;
|
||||
public predelay;
|
||||
@@ -37,12 +38,12 @@ export class RelatedTabComponent implements OnInit {
|
||||
if (this.lines.preFlight && !this.lines.reaFlight) {
|
||||
this.airports = this.lines.renderFlight.ERUT.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(this.lines.preFlight.ERUT[i].SCDT), scat: timeFormatter(this.lines.preFlight.ERUT[i].SCAT) }
|
||||
this.airports[i] = { airport: this.airports[i], scdt: this.utils.timeFormatter(this.lines.preFlight.ERUT[i].SCDT), scat: this.utils.timeFormatter(this.lines.preFlight.ERUT[i].SCAT) }
|
||||
}
|
||||
} else if (!this.lines.preFlight && this.lines.reaFlight) {
|
||||
this.airports = this.lines.renderFlight.ERUT.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(this.lines.reaFlight.ERUT[i].SCDT), scat: timeFormatter(this.lines.reaFlight.ERUT[i].SCAT) }
|
||||
this.airports[i] = { airport: this.airports[i], scdt: this.utils.timeFormatter(this.lines.reaFlight.ERUT[i].SCDT), scat: this.utils.timeFormatter(this.lines.reaFlight.ERUT[i].SCAT) }
|
||||
}
|
||||
} else {
|
||||
this.lines.preFlight.ERUT[this.lines.preFlight.ERUT.length - 1]['SCDT'] = this.lines.reaFlight.ERUT[0]['SCDT'];
|
||||
@@ -50,7 +51,7 @@ export class RelatedTabComponent implements OnInit {
|
||||
let linkAirport = this.lines.preFlight.ERUT.concat(concatArray)
|
||||
this.airports = this.lines.renderFlight.ERUT.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(linkAirport[i].SCDT), scat: timeFormatter(linkAirport[i].SCAT) }
|
||||
this.airports[i] = { airport: this.airports[i], scdt: this.utils.timeFormatter(linkAirport[i].SCDT), scat: this.utils.timeFormatter(linkAirport[i].SCAT) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,12 +78,12 @@ export class RelatedTabComponent implements OnInit {
|
||||
if (fimsFlightstatusDefinition) {
|
||||
this.predelay['TYPE'] = fimsFlightstatusDefinition.ddsc;
|
||||
}
|
||||
this.predelay['STRT'] = new Date(dateFormatter(this.predelay['STRT'])).getTime();
|
||||
this.predelay['STRT'] = new Date(this.utils.dateFormatter(this.predelay['STRT'])).getTime();
|
||||
this.predelay['DURA'] = parseInt(this.predelay['DURA'].substr(0, 2)) * 3600000 + parseInt(this.predelay['DURA'].substr(2, 3)) * 60000 + this.predelay['STRT']
|
||||
}
|
||||
if (cancleIndex > -1) {
|
||||
let cancle = this.lines.preFlight['ABN'][cancleIndex].BODY;
|
||||
this.precancle = new Date(dateFormatter(cancle)).getTime();
|
||||
this.precancle = new Date(this.utils.dateFormatter(cancle)).getTime();
|
||||
}
|
||||
if (fdivIndex > -1) {
|
||||
let fdiv = this.lines.preFlight['ABN'][fdivIndex].BODY;
|
||||
@@ -125,12 +126,12 @@ export class RelatedTabComponent implements OnInit {
|
||||
this.readelay['TYPE'] = fimsFlightstatusDefinition.ddsc;
|
||||
}
|
||||
|
||||
this.readelay['STRT'] = new Date(dateFormatter(this.readelay['STRT'])).getTime();
|
||||
this.readelay['STRT'] = new Date(this.utils.dateFormatter(this.readelay['STRT'])).getTime();
|
||||
this.readelay['DURA'] = parseInt(this.readelay['DURA'].substr(0, 2)) * 3600000 + parseInt(this.readelay['DURA'].substr(2, 3)) * 60000 + this.readelay['STRT'];
|
||||
}
|
||||
if (cancleIndex > -1) {
|
||||
let cancle = this.lines.reaFlight['ABN'][cancleIndex].BODY;
|
||||
this.reacancle = new Date(dateFormatter(cancle)).getTime();
|
||||
this.reacancle = new Date(this.utils.dateFormatter(cancle)).getTime();
|
||||
}
|
||||
if (fdivIndex > -1) {
|
||||
let fdiv = this.lines.reaFlight['ABN'][fdivIndex].BODY;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import timeFormatter from '../../../utils/time-formatter';
|
||||
import { Utils } from '../../../utils/utils'
|
||||
|
||||
@Component({
|
||||
selector: 'app-related-tab',
|
||||
@@ -7,6 +7,8 @@ import timeFormatter from '../../../utils/time-formatter';
|
||||
styleUrls: ['./related-tab.component.scss']
|
||||
})
|
||||
export class RelatedTabComponent implements OnInit {
|
||||
private utils = new Utils();
|
||||
|
||||
public lines;
|
||||
public airports;
|
||||
@Input() set flight(flight) {
|
||||
@@ -14,21 +16,21 @@ export class RelatedTabComponent implements OnInit {
|
||||
if (this.lines && !this.lines) {
|
||||
this.airports = this.lines.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(this.lines[i].departureTime), scat: timeFormatter(this.lines[i].arrivalTime) }
|
||||
this.airports[i] = { airport: this.airports[i], scdt: this.utils.timeFormatter(this.lines[i].departureTime), scat: this.utils.timeFormatter(this.lines[i].arrivalTime) }
|
||||
}
|
||||
} else if (!this.lines && this.lines) {
|
||||
this.airports = this.lines.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(this.lines[i].departureTime), scat: timeFormatter(this.lines[i].arrivalTime) }
|
||||
this.airports[i] = { airport: this.airports[i], scdt: this.utils.timeFormatter(this.lines[i].departureTime), scat: this.utils.timeFormatter(this.lines[i].arrivalTime) }
|
||||
}
|
||||
} else {
|
||||
// this.lines[this.lines.length - 1] = this.lines[0];
|
||||
// let concatArray = this.lines.arrivalTime.slice(1);
|
||||
// let linkAirport = this.lines.arrivalTime.concat(concatArray)
|
||||
if(this.lines.startAirport){
|
||||
if (this.lines.startAirport) {
|
||||
this.airports = this.lines.startAirport.split(' - ');
|
||||
for (let i = 0; i < this.airports.length; i++) {
|
||||
this.airports[i] = { airport: this.airports[i], scdt: timeFormatter(this.lines.departureTime), scat: timeFormatter(this.lines.arrivalTime) }
|
||||
this.airports[i] = { airport: this.airports[i], scdt: this.utils.timeFormatter(this.lines.departureTime), scat: this.utils.timeFormatter(this.lines.arrivalTime) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CanActivate, Router, ActivatedRouteSnapshot } from '@angular/router';
|
||||
import getCookie from '../utils/get-cookie';
|
||||
import { Utils } from '../utils/utils';
|
||||
|
||||
@Injectable()
|
||||
export class LoginAuthService implements CanActivate {
|
||||
private utils = new Utils();
|
||||
constructor(
|
||||
private router: Router,
|
||||
) { }
|
||||
@@ -34,6 +35,6 @@ export class LoginAuthService implements CanActivate {
|
||||
}
|
||||
|
||||
getToken(): string {
|
||||
return getCookie('token');
|
||||
return this.utils.getCookie('token');
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import dateFormatter from "./date-formatter";
|
||||
import { Utils } from './utils';
|
||||
export class AlertMessageHandle {
|
||||
private utils = new Utils();
|
||||
//ok
|
||||
public flopCncl(message) {
|
||||
if (message.FLOP.CNCL) {
|
||||
@@ -100,7 +101,7 @@ export class AlertMessageHandle {
|
||||
}
|
||||
//ok
|
||||
public flopActt(message) {
|
||||
return message.FLOP.FFID + " 航班实际时间:" + dateFormatter(message.FLOP.ACTT);
|
||||
return message.FLOP.FFID + " 航班实际时间:" + this.utils.dateFormatter(message.FLOP.ACTT);
|
||||
}
|
||||
//ok
|
||||
public flopGtdt(message) {
|
||||
@@ -112,7 +113,7 @@ export class AlertMessageHandle {
|
||||
gotm = gtdts[i]["GOTM"],
|
||||
gctm = gtdts[i]["GCTM"];
|
||||
if (gate) {
|
||||
gateCode += gate + ":【登机门打开:" + (!gotm ? "待定" : dateFormatter(gotm)) + ";登机门关闭:" + (!gctm ? "待定" : dateFormatter(gctm)) + "】\n";
|
||||
gateCode += gate + ":【登机门打开:" + (!gotm ? "待定" : this.utils.dateFormatter(gotm)) + ";登机门关闭:" + (!gctm ? "待定" : this.utils.dateFormatter(gctm)) + "】\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,12 +136,12 @@ export class AlertMessageHandle {
|
||||
}
|
||||
//ok
|
||||
public flopEstt(message) {
|
||||
return message.FLOP.FFID + " 预计时间变更为" + dateFormatter(message.FLOP.ESTT);
|
||||
return message.FLOP.FFID + " 预计时间变更为" + this.utils.dateFormatter(message.FLOP.ESTT);
|
||||
}
|
||||
//ok
|
||||
public flopPadt(message) {
|
||||
if (message.FLOP.PADT) {
|
||||
return message.FLOP.FFID + " 前站实际起飞时间:" + dateFormatter(message.FLOP.PADT);
|
||||
return message.FLOP.FFID + " 前站实际起飞时间:" + this.utils.dateFormatter(message.FLOP.PADT);
|
||||
} else {
|
||||
return message.FLOP.FFID + " 前站实际起飞时间撤销";
|
||||
}
|
||||
@@ -155,7 +156,7 @@ export class AlertMessageHandle {
|
||||
cotm = ckdts[i]["GOTM"],
|
||||
cctm = ckdts[i]["GCTM"];
|
||||
if (chkc) {
|
||||
ckdtCode += chkc + ":【值机打开:" + (!cotm ? "待定" : dateFormatter(cotm)) + ";值机关闭:" + (!cctm ? "待定" : dateFormatter(cctm)) + "】\n";
|
||||
ckdtCode += chkc + ":【值机打开:" + (!cotm ? "待定" : this.utils.dateFormatter(cotm)) + ";值机关闭:" + (!cctm ? "待定" : this.utils.dateFormatter(cctm)) + "】\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +165,7 @@ export class AlertMessageHandle {
|
||||
//ok
|
||||
public flopBotm(message) {
|
||||
if (message.FLOP.BOTM) {
|
||||
return message.FLOP.FFID + " 登机开始时间:" + dateFormatter(message.FLOP.BOTM);
|
||||
return message.FLOP.FFID + " 登机开始时间:" + this.utils.dateFormatter(message.FLOP.BOTM);
|
||||
} else {
|
||||
return message.FLOP.FFID + " 撤销登机开始时间";
|
||||
}
|
||||
@@ -288,7 +289,7 @@ export class AlertMessageHandle {
|
||||
} else {
|
||||
flbttype = "末件行李到达时间:";
|
||||
}
|
||||
bridgestr += "\n转盘号:" + blst + "转盘等级:" + bcls + " " + flbttype + dateFormatter(flbt);
|
||||
bridgestr += "\n转盘号:" + blst + "转盘等级:" + bcls + " " + flbttype + this.utils.dateFormatter(flbt);
|
||||
}
|
||||
}
|
||||
return message.FLOP.FFID + " " + bridgestr;
|
||||
@@ -311,7 +312,7 @@ export class AlertMessageHandle {
|
||||
let abdg = optbridgedata.ABDG;
|
||||
let abop = optbridgedata.ABOP;
|
||||
let aotm = optbridgedata.AOTM;
|
||||
bridgestr += "【登机桥 " + abdg + " " + ((abop === "A") ? "靠桥" : "撤桥") + " " + dateFormatter(aotm) + "】\n";
|
||||
bridgestr += "【登机桥 " + abdg + " " + ((abop === "A") ? "靠桥" : "撤桥") + " " + this.utils.dateFormatter(aotm) + "】\n";
|
||||
}
|
||||
return message.FLOP.FFID + "\n" + bridgestr;
|
||||
} else {
|
||||
@@ -328,7 +329,7 @@ export class AlertMessageHandle {
|
||||
let chid = optchocksdata.CHID;
|
||||
let chst = optchocksdata.CHST;
|
||||
let chtm = optchocksdata.CHTM;
|
||||
bridgestr += "【机位:" + chst + ((chid === "ON") ? " 上轮挡:" : " 下轮挡:") + dateFormatter(chtm) + "】\n";
|
||||
bridgestr += "【机位:" + chst + ((chid === "ON") ? " 上轮挡:" : " 下轮挡:") + this.utils.dateFormatter(chtm) + "】\n";
|
||||
}
|
||||
return message.FLOP.FFID + "\n" + bridgestr;
|
||||
} else {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
import { DynamicFlightOrder } from './dynamic-flight-order';
|
||||
import { FlightOrder } from './flight-order';
|
||||
|
||||
export class CellColorHandle {
|
||||
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
|
||||
public orderHandle = new FlightOrder();
|
||||
|
||||
public reno(flight, colorSetting) {
|
||||
if (flight['renderFlight']['RENO'] && flight['renderFlight']['RENO'].indexOf('(') > 0) {
|
||||
@@ -16,7 +14,6 @@ export class CellColorHandle {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
public actt(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['ACTT']) {
|
||||
@@ -38,7 +35,6 @@ export class CellColorHandle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public estt(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
|
||||
@@ -61,7 +57,6 @@ export class CellColorHandle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sodt(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['SODT'] && !flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
|
||||
@@ -83,7 +78,6 @@ export class CellColorHandle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public padt(flight, colorSetting) {
|
||||
if (this.orderHandle.isArriFlight(flight) || this.orderHandle.isLinked(flight)) {
|
||||
if (flight['preFlight']['PADT']) {
|
||||
@@ -98,7 +92,6 @@ export class CellColorHandle {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
public psst(flight, colorSetting) {
|
||||
if (flight['renderFlight']['PSST'] && flight['renderFlight']['PSST'].indexOf('(') > 0) {
|
||||
return {
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* 日期时间转换
|
||||
* @param dataString 需要转换成日期时间的字符串
|
||||
*/
|
||||
export default function (dataString) {
|
||||
const monthToNumber = {
|
||||
JAN: '01',
|
||||
FEB: '02',
|
||||
MAR: '03',
|
||||
APR: '04',
|
||||
MAY: '05',
|
||||
JUN: '06',
|
||||
JUL: '07',
|
||||
AUG: '08',
|
||||
SEP: '09',
|
||||
OCT: '10',
|
||||
NOV: '11',
|
||||
DEC: '12',
|
||||
}
|
||||
if (!dataString || dataString.length < 11) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
if (!dataString.substring(7)) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
if (!monthToNumber.hasOwnProperty(dataString.substring(2, 5).toUpperCase())) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
|
||||
let year = "20" + dataString.substring(5, 7);
|
||||
let month = monthToNumber[dataString.substring(2, 5).toUpperCase()];
|
||||
let day = dataString.substring(0, 2);
|
||||
let hour = dataString.substring(7, 9);
|
||||
let min = dataString.substring(9, 11);
|
||||
return year + '-' + month + '-' + day + ' ' + hour + ':' + min
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* 日期转换
|
||||
* @param dataString 需要转换成日期的字符串
|
||||
*/
|
||||
export default function (dataString) {
|
||||
const monthToNumber = {
|
||||
JAN: '01',
|
||||
FEB: '02',
|
||||
MAR: '03',
|
||||
APR: '04',
|
||||
MAY: '05',
|
||||
JUN: '06',
|
||||
JUL: '07',
|
||||
AUG: '08',
|
||||
SEP: '09',
|
||||
OCT: '10',
|
||||
NOV: '11',
|
||||
DEC: '12',
|
||||
}
|
||||
if (!dataString || dataString.length < 11) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
if (!dataString.substring(7)) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
if (!monthToNumber.hasOwnProperty(dataString.substring(2, 5).toUpperCase())) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
|
||||
let year = "20" + dataString.substring(5, 7);
|
||||
let month = monthToNumber[dataString.substring(2, 5).toUpperCase()];
|
||||
let day = dataString.substring(0, 2);
|
||||
let hour = dataString.substring(7, 9);
|
||||
let min = dataString.substring(9, 11);
|
||||
return year + '-' + month + '-' + day
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import dateFormatter from './date-formatter';
|
||||
export class DynamicFlightOrder {
|
||||
import {Utils} from './utils';
|
||||
export class FlightOrder {
|
||||
private utils = new Utils();
|
||||
|
||||
public TOP_1 = 1000000000000;
|
||||
public TOP_2 = 2000000000000;
|
||||
@@ -229,74 +230,74 @@ export class DynamicFlightOrder {
|
||||
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();
|
||||
dateToCompare = new Date(this.utils.dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_1;
|
||||
}
|
||||
else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateToCompare = new Date(this.utils.dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime();
|
||||
} else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_10;
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.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();
|
||||
dateToCompare = new Date(this.utils.dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
} else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
dateToCompare = new Date(this.utils.dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
}
|
||||
|
||||
dateTag = this.TOP_13;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TransferRenderHandle } from './transfer-render-handle';
|
||||
import { DynamicFlightOrder } from './dynamic-flight-order';
|
||||
import { FlightOrder } from './flight-order';
|
||||
|
||||
export class FlightsDataHandle {
|
||||
public transferHandle = new TransferRenderHandle();
|
||||
@@ -33,7 +33,7 @@ export class FlightsDataHandle {
|
||||
'FLDT': this.transferHandle.fldtFormatter.bind(this.transferHandle)
|
||||
}
|
||||
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
public orderHandle = new FlightOrder();
|
||||
|
||||
|
||||
public findLinkFlights(raw_flights) {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* 菜单点击事件
|
||||
* @param name 需要获取的cookie属性名
|
||||
*/
|
||||
export default function (name) {
|
||||
name = name + "="
|
||||
var start = document.cookie.indexOf(name),
|
||||
value = null;
|
||||
if (start > -1) {
|
||||
var end = document.cookie.indexOf(";", start);
|
||||
if (end == -1) {
|
||||
end = document.cookie.length;
|
||||
}
|
||||
value = document.cookie.substring(start + name.length, end);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* 时间转换显示
|
||||
* @param dataString 需要转换成时间的字符串
|
||||
*/
|
||||
export default function (dataString) {
|
||||
const monthToNumber = {
|
||||
JAN: '01',
|
||||
FEB: '02',
|
||||
MAR: '03',
|
||||
APR: '04',
|
||||
MAY: '05',
|
||||
JUN: '06',
|
||||
JUL: '07',
|
||||
AUG: '08',
|
||||
SEP: '09',
|
||||
OCT: '10',
|
||||
NOV: '11',
|
||||
DEC: '12',
|
||||
}
|
||||
if (!dataString || dataString.length < 11) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
if (!dataString.substring(7)) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
if (!monthToNumber.hasOwnProperty(dataString.substring(2, 5).toUpperCase())) {
|
||||
return dataString ? dataString : '';
|
||||
}
|
||||
|
||||
let year = "20" + dataString.substring(5, 7);
|
||||
let month = monthToNumber[dataString.substring(2, 5).toUpperCase()];
|
||||
let day = dataString.substring(0, 2);
|
||||
let hour = dataString.substring(7, 9);
|
||||
let min = dataString.substring(9, 11);
|
||||
return hour + ':' + min
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import timeFormatter from './time-formatter';
|
||||
import dateWithNotimeFormatter from './date-with-notime-formatter';
|
||||
import { Utils } from './utils'
|
||||
export class TransferRenderHandle {
|
||||
private utils = new Utils();
|
||||
|
||||
public arsfFormatter(flight) {
|
||||
if (flight['MVIN'] === 'A') {
|
||||
if (Array.isArray(flight['MAFL']) && flight['MAFL'].length > 0) {
|
||||
@@ -59,9 +60,16 @@ export class TransferRenderHandle {
|
||||
public gctmFormatter(flight) {
|
||||
if (flight['GTDT']) {
|
||||
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
|
||||
return timeFormatter(flight['GTDT'][0]['GCTM']);
|
||||
let gtdt = flight['GTDT'];
|
||||
gtdt.forEach(element => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
return this.utils.timeFormatter(flight['GTDT'][0]['GCTM']);
|
||||
} else if (Object.prototype.toString.call(flight['GTDT']) === '[object Object]') {
|
||||
return timeFormatter(flight['GTDT']['GCTM']);
|
||||
return this.utils.timeFormatter(flight['GTDT']['GCTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -71,7 +79,7 @@ export class TransferRenderHandle {
|
||||
}
|
||||
public botmFormatter(flight) {
|
||||
if (flight['BOTM']) {
|
||||
return timeFormatter(flight['BOTM']);
|
||||
return this.utils.timeFormatter(flight['BOTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -99,12 +107,12 @@ export class TransferRenderHandle {
|
||||
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']);
|
||||
return this.utils.timeFormatter(flight['ABTM'][i]['AOTM']);
|
||||
}
|
||||
}
|
||||
} else if (Object.prototype.toString.call(flight['ABTM']) === '[object Object]') {
|
||||
if (flight['ABTM']['ABOP'] === 'A') {
|
||||
return timeFormatter(flight['ABTM']['AOTM']);
|
||||
return this.utils.timeFormatter(flight['ABTM']['AOTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -121,12 +129,12 @@ export class TransferRenderHandle {
|
||||
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']);
|
||||
return this.utils.timeFormatter(flight['ABTM'][i]['AOTM']);
|
||||
}
|
||||
}
|
||||
} else if (Object.prototype.toString.call(flight['ABTM']) === '[object Object]') {
|
||||
if (flight['ABTM']['ABOP'] === 'D') {
|
||||
return timeFormatter(flight['ABTM']['AOTM']);
|
||||
return this.utils.timeFormatter(flight['ABTM']['AOTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -177,9 +185,9 @@ export class TransferRenderHandle {
|
||||
public cctmFormatter(flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
return timeFormatter(flight['CKDT'][0]['CCTM']);
|
||||
return this.utils.timeFormatter(flight['CKDT'][0]['CCTM']);
|
||||
} else if (Object.prototype.toString.call(flight['CKDT']) === '[object Object]') {
|
||||
return timeFormatter(flight['CKDT']['CCTM']);
|
||||
return this.utils.timeFormatter(flight['CKDT']['CCTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -190,9 +198,9 @@ export class TransferRenderHandle {
|
||||
public cotmFormatter(flight) {
|
||||
if (flight['CKDT']) {
|
||||
if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
|
||||
return timeFormatter(flight['CKDT'][0]['COTM']);
|
||||
return this.utils.timeFormatter(flight['CKDT'][0]['COTM']);
|
||||
} else if (Object.prototype.toString.call(flight['CKDT']) === '[object Object]') {
|
||||
return timeFormatter(flight['CKDT']['COTM']);
|
||||
return this.utils.timeFormatter(flight['CKDT']['COTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -205,12 +213,12 @@ export class TransferRenderHandle {
|
||||
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']);
|
||||
return this.utils.timeFormatter(flight['CHOT'][i]['CHTM']);
|
||||
}
|
||||
}
|
||||
} else if (Object.prototype.toString.call(flight['CHOT']) === '[object Object]') {
|
||||
if (flight['CHOT']['CHID'] === 'ON') {
|
||||
return timeFormatter(flight['CHOT']['CHTM']);
|
||||
return this.utils.timeFormatter(flight['CHOT']['CHTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -226,12 +234,12 @@ export class TransferRenderHandle {
|
||||
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']);
|
||||
return this.utils.timeFormatter(flight['CHOT'][i]['CHTM']);
|
||||
}
|
||||
}
|
||||
} else if (Object.prototype.toString.call(flight['CHOT']) === '[object Object]') {
|
||||
if (flight['CHOT']['CHID'] === 'OFF') {
|
||||
return timeFormatter(flight['CHOT']['CHTM']);
|
||||
return this.utils.timeFormatter(flight['CHOT']['CHTM']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -244,7 +252,7 @@ export class TransferRenderHandle {
|
||||
}
|
||||
public laclFormatter(flight) {
|
||||
if (flight['LACL']) {
|
||||
return timeFormatter(flight['LACL']);
|
||||
return this.utils.timeFormatter(flight['LACL']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -269,7 +277,7 @@ export class TransferRenderHandle {
|
||||
}
|
||||
public acttFormatter(flight) {
|
||||
if (flight['ACTT']) {
|
||||
return timeFormatter(flight['ACTT']);
|
||||
return this.utils.timeFormatter(flight['ACTT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -320,7 +328,7 @@ export class TransferRenderHandle {
|
||||
}
|
||||
public esttFormatter(flight) {
|
||||
if (flight['ESTT']) {
|
||||
return timeFormatter(flight['ESTT']);
|
||||
return this.utils.timeFormatter(flight['ESTT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -368,7 +376,7 @@ export class TransferRenderHandle {
|
||||
}
|
||||
public sodtFormatter(flight) {
|
||||
if (flight['SODT']) {
|
||||
return timeFormatter(flight['SODT']);
|
||||
return this.utils.timeFormatter(flight['SODT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -396,45 +404,45 @@ export class TransferRenderHandle {
|
||||
if (flight['PADT']) {
|
||||
if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) {
|
||||
let lastRout = flight['ROUT'][flight['ROUT'].length - 1];
|
||||
if (lastRout['SCDT']){
|
||||
return timeFormatter(flight['PADT']) + '(' + timeFormatter(lastRout['SCDT']) + ')';
|
||||
}else{
|
||||
return timeFormatter(flight['PADT']);
|
||||
if (lastRout['SCDT']) {
|
||||
return this.utils.timeFormatter(flight['PADT']) + '(' + this.utils.timeFormatter(lastRout['SCDT']) + ')';
|
||||
} else {
|
||||
return this.utils.timeFormatter(flight['PADT']);
|
||||
}
|
||||
} else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') {
|
||||
if (flight['ROUT']['SCDT']){
|
||||
return timeFormatter(flight['PADT']) + '(' + timeFormatter(flight['ROUT']['SCDT']) + ')';
|
||||
}else{
|
||||
return timeFormatter(flight['PADT']);
|
||||
if (flight['ROUT']['SCDT']) {
|
||||
return this.utils.timeFormatter(flight['PADT']) + '(' + this.utils.timeFormatter(flight['ROUT']['SCDT']) + ')';
|
||||
} else {
|
||||
return this.utils.timeFormatter(flight['PADT']);
|
||||
}
|
||||
}else{
|
||||
return timeFormatter(flight['PADT']);
|
||||
} else {
|
||||
return this.utils.timeFormatter(flight['PADT']);
|
||||
}
|
||||
} else {
|
||||
if (Array.isArray(flight['ROUT']) && flight['ROUT'].length > 0) {
|
||||
let lastRout = flight['ROUT'][flight['ROUT'].length - 1];
|
||||
if (lastRout['SCDT']){
|
||||
return '(' + timeFormatter(lastRout['SCDT']) + ')';
|
||||
}else{
|
||||
if (lastRout['SCDT']) {
|
||||
return '(' + this.utils.timeFormatter(lastRout['SCDT']) + ')';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else if (Object.prototype.toString.call(flight['ROUT']) === '[object Object]') {
|
||||
if (flight['ROUT']['SCDT']){
|
||||
return '(' + timeFormatter(flight['ROUT']['SCDT']) + ')';
|
||||
}else{
|
||||
if (flight['ROUT']['SCDT']) {
|
||||
return '(' + this.utils.timeFormatter(flight['ROUT']['SCDT']) + ')';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
public fldtFormatter(flight) {
|
||||
if (flight['SODT']) {
|
||||
return dateWithNotimeFormatter(flight['SODT']);
|
||||
return this.utils.dateWithoutTime(flight['SODT']);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* 工具类
|
||||
*/
|
||||
export class Utils {
|
||||
public diff(obj1, obj2) {
|
||||
if (obj1['preFlight'] && !obj1['reaFlight']) {
|
||||
if (obj2['preFlight'] && !obj2['reaFlight']) {
|
||||
if (obj1['preFlight']['FLID'] === obj2['preFlight']['FLID']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (!obj1['preFlight'] && obj1['reaFlight']) {
|
||||
if (!obj2['preFlight'] && obj2['reaFlight']) {
|
||||
if (obj1['reaFlight']['FLID'] === obj2['reaFlight']['FLID']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (obj2['preFlight'] && obj2['reaFlight']) {
|
||||
if ((obj1['preFlight']['FLID'] === obj2['preFlight']['FLID']) && (obj1['reaFlight']['FLID'] === obj2['reaFlight']['FLID'])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// var o1 = obj1 instanceof Object;
|
||||
// var o2 = obj2 instanceof Object;
|
||||
// if (!o1 || !o2) {
|
||||
// return false;
|
||||
// }
|
||||
// if (Object.keys(obj1).length !== Object.keys(obj2).length) {
|
||||
// return false;
|
||||
// }
|
||||
// for (var attr in obj1) {
|
||||
// var t1 = obj1[attr] instanceof Object;
|
||||
// var t2 = obj2[attr] instanceof Object;
|
||||
// if (t1 && t2) {
|
||||
// return this.diff(obj1[attr], obj2[attr]);
|
||||
// } else if (obj1[attr] !== obj2[attr]) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
}
|
||||
|
||||
public getCookie(name) {
|
||||
name = name + "="
|
||||
var start = document.cookie.indexOf(name),
|
||||
value = null;
|
||||
if (start > -1) {
|
||||
var end = document.cookie.indexOf(";", start);
|
||||
if (end == -1) {
|
||||
end = document.cookie.length;
|
||||
}
|
||||
value = document.cookie.substring(start + name.length, end);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public dateFormatter(dateString) {
|
||||
const monthToNumber = {
|
||||
JAN: '01',
|
||||
FEB: '02',
|
||||
MAR: '03',
|
||||
APR: '04',
|
||||
MAY: '05',
|
||||
JUN: '06',
|
||||
JUL: '07',
|
||||
AUG: '08',
|
||||
SEP: '09',
|
||||
OCT: '10',
|
||||
NOV: '11',
|
||||
DEC: '12',
|
||||
}
|
||||
if (!dateString || dateString.length < 11) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
if (!dateString.substring(7)) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
if (!monthToNumber.hasOwnProperty(dateString.substring(2, 5).toUpperCase())) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
|
||||
let year = "20" + dateString.substring(5, 7);
|
||||
let month = monthToNumber[dateString.substring(2, 5).toUpperCase()];
|
||||
let day = dateString.substring(0, 2);
|
||||
let hour = dateString.substring(7, 9);
|
||||
let min = dateString.substring(9, 11);
|
||||
return year + '-' + month + '-' + day + ' ' + hour + ':' + min
|
||||
}
|
||||
|
||||
public timeFormatter(dateString) {
|
||||
const monthToNumber = {
|
||||
JAN: '01',
|
||||
FEB: '02',
|
||||
MAR: '03',
|
||||
APR: '04',
|
||||
MAY: '05',
|
||||
JUN: '06',
|
||||
JUL: '07',
|
||||
AUG: '08',
|
||||
SEP: '09',
|
||||
OCT: '10',
|
||||
NOV: '11',
|
||||
DEC: '12',
|
||||
}
|
||||
if (!dateString || dateString.length < 11) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
if (!dateString.substring(7)) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
if (!monthToNumber.hasOwnProperty(dateString.substring(2, 5).toUpperCase())) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
let hour = dateString.substring(7, 9);
|
||||
let min = dateString.substring(9, 11);
|
||||
return hour + ':' + min
|
||||
}
|
||||
|
||||
public dateWithoutTime(dateString) {
|
||||
const monthToNumber = {
|
||||
JAN: '01',
|
||||
FEB: '02',
|
||||
MAR: '03',
|
||||
APR: '04',
|
||||
MAY: '05',
|
||||
JUN: '06',
|
||||
JUL: '07',
|
||||
AUG: '08',
|
||||
SEP: '09',
|
||||
OCT: '10',
|
||||
NOV: '11',
|
||||
DEC: '12',
|
||||
}
|
||||
if (!dateString || dateString.length < 11) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
if (!dateString.substring(7)) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
if (!monthToNumber.hasOwnProperty(dateString.substring(2, 5).toUpperCase())) {
|
||||
return dateString ? dateString : '';
|
||||
}
|
||||
|
||||
let year = "20" + dateString.substring(5, 7);
|
||||
let month = monthToNumber[dateString.substring(2, 5).toUpperCase()];
|
||||
let day = dateString.substring(0, 2);
|
||||
return year + '-' + month + '-' + day
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user