代码抽取优化、添加重要提示

This commit is contained in:
zhouyuejun
2018-12-13 18:15:41 +08:00
parent 95db4e4450
commit ffc263e7d1
26 changed files with 866 additions and 574 deletions
+18 -5
View File
@@ -27,7 +27,7 @@
<label for="">航空公司:&nbsp;&nbsp;</label> <label for="">航空公司:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.ALCD" (ngModelChange)="selectChange()" class="form-control"> <select [(ngModel)]="filterItems.ALCD" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option> <option value=""></option>
<option *ngFor="let airline of airlines" [value]="airline.airlineCodeIata">{{airline.airlineName}}</option> <option *ngFor="let airline of airlinesSelections" [value]="airline.airlineCodeIata">{{airline.airlineName}}</option>
</select> </select>
</div> </div>
<div class="input-container mr-4"> <div class="input-container mr-4">
@@ -74,8 +74,12 @@
</div> </div>
<div class="input-container mr-4"> <div class="input-container mr-4">
<label for="">异常状态:&nbsp;&nbsp;</label> <label for="">异常状态:&nbsp;&nbsp;</label>
<select class="form-control"> <select [(ngModel)]="filterItems.Abnormal_state" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option> <option value=""></option>
<option value="CNCL">取消</option>
<option value="DELY">延误</option>
<option value="FDIV">备降</option>
<option value="FRET">返航</option>
</select> </select>
</div> </div>
<div class="input-container mr-4"> <div class="input-container mr-4">
@@ -113,7 +117,7 @@
<input type="checkbox" [(ngModel)]="checkboxGroup.detail" (ngModelChange)="checkboxChange()"> <input type="checkbox" [(ngModel)]="checkboxGroup.detail" (ngModelChange)="checkboxChange()">
<span>详细信息</span> <span>详细信息</span>
</label> </label>
<label class="radio-inline custom-checkbox nowrap mr-4"> <!-- <label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox" [(ngModel)]="checkboxGroup.vip" (ngModelChange)="checkboxChange()"> <input type="checkbox" [(ngModel)]="checkboxGroup.vip" (ngModelChange)="checkboxChange()">
<span>航班VIP信息</span> <span>航班VIP信息</span>
</label> </label>
@@ -124,7 +128,7 @@
<label class="radio-inline custom-checkbox nowrap"> <label class="radio-inline custom-checkbox nowrap">
<input type="checkbox" [(ngModel)]="checkboxGroup.special" (ngModelChange)="checkboxChange()"> <input type="checkbox" [(ngModel)]="checkboxGroup.special" (ngModelChange)="checkboxChange()">
<span>航班特服信息</span> <span>航班特服信息</span>
</label> </label> -->
</div> </div>
</div> </div>
<div class="airline-table"> <div class="airline-table">
@@ -141,7 +145,16 @@
<tr *ngFor="let airline_row of render_data;let i = index;last as isLast" (click)="selectRow(airline_row)" <tr *ngFor="let airline_row of render_data;let i = index;last as isLast" (click)="selectRow(airline_row)"
[ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}"> [ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}">
<td>{{i+1}}</td> <td>{{i+1}}</td>
<td>{{isLast}}</td> <td>
<img class="mr-2" *ngIf="getVipNotes(airline_row)" src="/assets/images/important-notes/vip.png" alt="">
<img class="mr-2" *ngIf="getOutplanNotes(airline_row)" src="/assets/images/important-notes/out_plan.png" alt="">
<img class="mr-2" *ngIf="getAlternateNotes(airline_row)" src="/assets/images/important-notes/alternate.png" alt="">
<img class="mr-2" *ngIf="getDelay30Notes(airline_row)" src="/assets/images/important-notes/delay_30.png" alt="">
<img class="mr-2" *ngIf="getDelayNotes(airline_row)" src="/assets/images/important-notes/delay.png" alt="">
<img class="mr-2" *ngIf="getReturnNotes(airline_row)" src="/assets/images/important-notes/return.png" alt="">
<img class="mr-2" *ngIf="getCancleNotes(airline_row)" src="/assets/images/important-notes/cancle.png" alt="">
<img class="mr-2" *ngIf="getStopoverNotes(airline_row)" src="/assets/images/important-notes/stopover.png" alt="">
</td>
<td *ngFor="let airline_col of col_lists" [ngClass]="getPosition(airline_col.COL_CODE,airline_row)" <td *ngFor="let airline_col of col_lists" [ngClass]="getPosition(airline_col.COL_CODE,airline_row)"
[ngStyle]="{'background-color':getColor(airline_col.COL_CODE,airline_row)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td> [ngStyle]="{'background-color':getColor(airline_col.COL_CODE,airline_row)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
</tr> </tr>
+345 -499
View File
@@ -12,6 +12,8 @@ import { WebsocketService } from '../../services/websocket.service';
import { DynamicFlightOrder } from './utils/dynamic-flight-order'; import { DynamicFlightOrder } from './utils/dynamic-flight-order';
import { FlightsDataHandle } from './utils/flights-data-handle'; import { FlightsDataHandle } from './utils/flights-data-handle';
import dateFormatter from '../../utils/data-formatter';
import * as $ from 'jquery'; import * as $ from 'jquery';
@Component({ @Component({
selector: 'app-main', selector: 'app-main',
@@ -19,7 +21,6 @@ import * as $ from 'jquery';
styleUrls: ['./main.component.scss'] styleUrls: ['./main.component.scss']
}) })
export class MainComponent implements OnInit { export class MainComponent implements OnInit {
constructor( constructor(
private basicDataService: BasicDataService, private basicDataService: BasicDataService,
private operateSpinServiceService: OperateSpinServiceService, private operateSpinServiceService: OperateSpinServiceService,
@@ -35,7 +36,9 @@ export class MainComponent implements OnInit {
public dataHandle = new FlightsDataHandle(); public dataHandle = new FlightsDataHandle();
public tabClose: boolean = true; public tabClose: boolean = true;
public isSpinning: boolean = true;
public canHandleDynamicMessage: boolean = false;
public dynamicMessageArray: Array<any> = [];
//各项基础数据 //各项基础数据
public terminals: Array<any>; public terminals: Array<any>;
@@ -44,7 +47,10 @@ export class MainComponent implements OnInit {
public citys: Array<any>; public citys: Array<any>;
public airlines: Array<any>; public airlines: Array<any>;
public raw_data: Array<object> = []; //原始数据,即航班计划 public airlinesSelections: Array<any> = [];
public flightTypeSelections: Array<any> = [];
public raw_data: Array<object> = []; //原始数据,未经过任何转换和组合
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据 public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
public render_data: Array<object> = []; //显示数据,即需要显示的数据 public render_data: Array<object> = []; //显示数据,即需要显示的数据
@@ -66,478 +72,14 @@ export class MainComponent implements OnInit {
event => { event => {
let data = JSON.parse(event as string); let data = JSON.parse(event as string);
if (data.topic === 'schd') { if (data.topic === 'schd') {
console.log('========')
let message = JSON.parse(data.message); let message = JSON.parse(data.message);
let index = this.raw_data.findIndex(element => element['FLID'] === message.FLID); //是否可以开始处理动态消息
if (index > -1) { if (this.canHandleDynamicMessage) {
this.raw_data[index] = message; this.dynamicMessageHandle(message)
} else { } else {
this.raw_data.push(message); this.dynamicMessageArray.push(message);
} }
// let testss = []
// let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data);
// combined_linked_data.forEach(element => {
// let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists);
// testss.push(flights_item);
// });
// let combined_data = [];
// testss.forEach(item => {
// combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
// })
// this.combined_data = combined_data;
// this.doSequence(this.combined_data);
if (message.MVIN === 'A') {
//针对combined_data的处理
let index = this.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) {
this.combined_data[index]['preFlight'] = message;
this.combined_data[index] = this.dataHandle.flightsRenderTransfer(this.combined_data[index], this.col_lists);
this.combined_data[index] = this.dataHandle.basicDataTransHandle(this.combined_data[index], this.airports, this.citys, this.airlines, this.flightStatus);
if (message.UPTP === 'FLOP-AOTP') {
if (this.orderHandle.isArriFlight(this.combined_data[index])) {
if (message.TAID) {
this.combined_data.splice(index, 1);
let i = this.combined_data.findIndex(element => {
if (this.orderHandle.isDeptFlight(element)) {
if (message.TAID === element['reaFlight']['FLID']) {
return true;
} else {
return false;
}
} else {
return false;
}
})
this.combined_data[i]['reaFlight']['TAID'] = message.FLID;
let newFlight = {};
newFlight['preFlight'] = message;
newFlight['reaFlight'] = this.combined_data[i]['reaFlight'];
this.combined_data.splice(i, 1);
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
this.combined_data.push(newFlight)
}
} else if (this.orderHandle.isLinked(this.combined_data[index])) {
if (!message.TAID) {
let newPreFlight = {},
newReaFlight = {};
newPreFlight['preFlight'] = this.combined_data[index]['preFlight'];
newPreFlight['renderFlight'] = this.combined_data[index]['renderPreFlight'];
this.combined_data.push(newPreFlight);
delete this.combined_data[index]['reaFlight']['TAID'];
newPreFlight['reaFlight'] = this.combined_data[index]['reaFlight'];
newPreFlight['renderFlight'] = this.combined_data[index]['renderReaFlight'];
this.combined_data.push(newReaFlight);
this.combined_data.splice(index, 1);
}
}
}
} else {
let newFlight = {};
newFlight['preFlight'] = message;
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
this.combined_data.push(newFlight);
}
//针对render_data的处理
let index1 = this.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) {
this.render_data[index1]['preFlight'] = message;
this.render_data[index1] = this.dataHandle.flightsRenderTransfer(this.render_data[index1], this.col_lists);
this.render_data[index1] = this.dataHandle.basicDataTransHandle(this.render_data[index1], this.airports, this.citys, this.airlines, this.flightStatus);
let is_satis = true;
for (const key in this.filterItems) {
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
if (this.render_data[index1]['preFlight'][key] === this.filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
let search_satis = true;
if (this.LASTSEARCH) {
if (this.LAST_SEL_COL) {
if (this.render_data[index1]['preFlight'][this.LAST_SEL_COL]) {
if (this.render_data[index1]['preFlight'][this.LAST_SEL_COL].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
search_satis = true;
} else {
search_satis = false;
}
} else {
search_satis = false;
}
} else {
let cols = this.col_lists;
for (let i = 0; i < cols.length; i++) {
if (this.render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) {
if (this.render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.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(this.render_data[index1])) {
if (message.TAID) {
let i = this.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) {
this.render_data.splice(index1, 1);
this.render_data[i]['reaFlight']['TAID'] = message.FLID;
let newFlight = {};
newFlight['preFlight'] = message;
newFlight['reaFlight'] = this.render_data[i]['reaFlight'];
this.render_data.splice(i, 1);
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
this.render_data.push(newFlight)
}
}
} else if (this.orderHandle.isLinked(this.render_data[index1])) {
if (!message.TAID) {
let newPreFlight = {},
newReaFlight = {};
delete this.render_data[index1]['preFlight']['TAID'];
newPreFlight['preFlight'] = this.render_data[index1]['preFlight'];
newPreFlight['renderFlight'] = this.render_data[index1]['renderPreFlight'];
delete this.render_data[index1]['reaFlight']['TAID'];
newPreFlight['reaFlight'] = this.render_data[index1]['reaFlight'];
newPreFlight['renderFlight'] = this.render_data[index1]['renderReaFlight'];
this.render_data.splice(index1, 1);
this.render_data.push(newPreFlight);
this.render_data.push(newReaFlight);
}
}
}
} else {
if (this.orderHandle.isArriFlight(this.render_data[index1])) {
this.render_data.splice(index1, 1);
} else if (this.orderHandle.isLinked(this.render_data[index1])) {
delete this.render_data[index1]['preFlight'];
delete this.render_data[index1]['renderPreFlight'];
this.render_data[index1] = this.dataHandle.flightsRenderTransfer(this.render_data[index1], this.col_lists);
this.render_data[index1] = this.dataHandle.basicDataTransHandle(this.render_data[index1], this.airports, this.citys, this.airlines, this.flightStatus);
}
}
} else {
let newFlight = {};
newFlight['preFlight'] = message;
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
let is_satis = true;
for (const key in this.filterItems) {
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
if (newFlight['preFlight'][key] === this.filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
let search_satis = true;
if (this.LASTSEARCH) {
if (this.LAST_SEL_COL) {
if (newFlight['preFlight'][this.LAST_SEL_COL]) {
if (newFlight['preFlight'][this.LAST_SEL_COL].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
search_satis = true;
} else {
search_satis = false;
}
} else {
search_satis = false;
}
} else {
let cols = this.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(this.LASTSEARCH, 'i'))) {
search_satis = true;
break;
} else {
search_satis = false;
continue;
}
} else {
search_satis = false;
continue;
}
}
}
}
if (is_satis && search_satis) {
let i = this.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({}, this.render_data[i]['reaFlight']);
this.render_data.splice(i, 1);
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
this.render_data.push(newFlight);
} else {
this.render_data.push(newFlight);
}
}
}
} else {
//针对combined_data的处理
let index = this.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) {
this.combined_data[index]['reaFlight'] = message;
this.combined_data[index] = this.dataHandle.flightsRenderTransfer(this.combined_data[index], this.col_lists);
this.combined_data[index] = this.dataHandle.basicDataTransHandle(this.combined_data[index], this.airports, this.citys, this.airlines, this.flightStatus);
} else {
let newFlight = {};
newFlight['reaFlight'] = message;
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
this.combined_data.push(newFlight);
}
//针对render_data的处理
let index1 = this.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) {
this.render_data[index1]['reaFlight'] = message;
this.render_data[index1] = this.dataHandle.flightsRenderTransfer(this.render_data[index1], this.col_lists);
this.render_data[index1] = this.dataHandle.basicDataTransHandle(this.render_data[index1], this.airports, this.citys, this.airlines, this.flightStatus);
let is_satis = true;
for (const key in this.filterItems) {
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
if (this.render_data[index1]['reaFlight'][key] === this.filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
let search_satis = true;
if (this.LASTSEARCH) {
if (this.LAST_SEL_COL) {
if (this.render_data[index1]['reaFlight'][this.LAST_SEL_COL]) {
if (this.render_data[index1]['reaFlight'][this.LAST_SEL_COL].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
search_satis = true;
} else {
search_satis = false;
}
} else {
search_satis = false;
}
} else {
let cols = this.col_lists;
for (let i = 0; i < cols.length; i++) {
if (this.render_data[index1]['renderFlight'][cols[i]['COL_CODE']]) {
if (this.render_data[index1]['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.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(this.render_data[index1])) {
this.render_data.splice(index1, 1);
} else if (this.orderHandle.isLinked(this.render_data[index1])) {
delete this.render_data[index1]['reaFlight'];
delete this.render_data[index1]['renderReaFlight'];
this.render_data[index1] = this.dataHandle.flightsRenderTransfer(this.render_data[index1], this.col_lists);
this.render_data[index1] = this.dataHandle.basicDataTransHandle(this.render_data[index1], this.airports, this.citys, this.airlines, this.flightStatus);
}
}
} else {
let newFlight = {};
newFlight['reaFlight'] = message;
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
let is_satis = true;
for (const key in this.filterItems) {
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
if (newFlight['reaFlight'][key] === this.filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
let search_satis = true;
if (this.LASTSEARCH) {
if (this.LAST_SEL_COL) {
if (newFlight['reaFlight'][this.LAST_SEL_COL]) {
if (newFlight['reaFlight'][this.LAST_SEL_COL].toString().match(new RegExp(this.LASTSEARCH, 'i'))) {
search_satis = true;
} else {
search_satis = false;
}
} else {
search_satis = false;
}
} else {
let cols = this.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(this.LASTSEARCH, 'i'))) {
search_satis = true;
break;
} else {
search_satis = false;
continue;
}
} else {
search_satis = false;
continue;
}
}
}
}
if (is_satis && search_satis) {
let i = this.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({}, this.render_data[i]['preFlight']);
this.render_data.splice(i, 1);
newFlight = this.dataHandle.flightsRenderTransfer(newFlight, this.col_lists);
newFlight = this.dataHandle.basicDataTransHandle(newFlight, this.airports, this.citys, this.airlines, this.flightStatus);
this.render_data.push(newFlight);
} else {
this.render_data.push(newFlight);
}
}
}
}
this.combined_data.forEach(element => {
element['ORDER'] = this.orderHandle.sequence(element);
})
this.combined_data = this.combined_data.sort(function (a, b) {
return (a['ORDER'] - b['ORDER']);
})
this.render_data.forEach(element => {
element['ORDER'] = this.orderHandle.sequence(element);
})
this.render_data = this.render_data.sort(function (a, b) {
return (a['ORDER'] - b['ORDER']);
})
this.changeDetectorRef.detectChanges();
// this.doSequence(this.combined_data);
} else if (data.topic === 'msg') { } else if (data.topic === 'msg') {
let message = JSON.parse(data.message); let message = JSON.parse(data.message);
console.log(message); console.log(message);
@@ -554,7 +96,7 @@ export class MainComponent implements OnInit {
this.col_lists = data; this.col_lists = data;
} }
) )
/* 获取航班动态信息 */ //获取航班动态信息
this.httpCilent.get('/msgexchangeapi/all/flights').subscribe( this.httpCilent.get('/msgexchangeapi/all/flights').subscribe(
data => { data => {
this.raw_data = data.body; this.raw_data = data.body;
@@ -608,9 +150,7 @@ export class MainComponent implements OnInit {
} }
) )
/** //固定表头
* 固定表头
*/
var tableCont = document.querySelector('#table-container') var tableCont = document.querySelector('#table-container')
function scrollHandle() { function scrollHandle() {
var scrollTop = this.scrollTop; var scrollTop = this.scrollTop;
@@ -620,9 +160,74 @@ export class MainComponent implements OnInit {
} }
/** /**
* 执行排序并渲染 * 动态消息处理方法
* @param message
*/
dynamicMessageHandle(message) {
let index = this.raw_data.findIndex(element => element['FLID'] === message.FLID);
if (index > -1) {
this.raw_data[index] = message;
} else {
this.raw_data.push(message);
}
// let testss = []
// let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data);
// combined_linked_data.forEach(element => {
// let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists);
// testss.push(flights_item);
// });
// let combined_data = [];
// testss.forEach(item => {
// combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
// })
// this.combined_data = combined_data;
// this.doSequence(this.combined_data);
let dynamicHandleData = this.dataHandle.dynamicMessageHandle(
message,
this.combined_data,
this.render_data,
this.col_lists,
this.filterItems,
this.LASTSEARCH,
this.LAST_SEL_COL,
this.airports,
this.citys,
this.airlines, this.flightStatus
)
this.combined_data = dynamicHandleData.combined_data;
this.render_data = dynamicHandleData.render_data;
this.combined_data.forEach(element => {
element['ORDER'] = this.orderHandle.sequence(element);
})
this.combined_data = this.combined_data.sort(function (a, b) {
return (a['ORDER'] - b['ORDER']);
})
this.render_data.forEach(element => {
element['ORDER'] = this.orderHandle.sequence(element);
})
this.render_data = this.render_data.sort(function (a, b) {
return (a['ORDER'] - b['ORDER']);
})
this.changeDetectorRef.detectChanges();
}
/**
* 数据组合完毕,执行排序、渲染以及动态信息处理
* @param combined_data
*/ */
doSequence(combined_data) { doSequence(combined_data) {
this.raw_data.forEach(element => {
if (this.airlinesSelections.findIndex(airline => airline.airlineCodeIata === element['ALCD']) === -1) {
let index = this.airlines.findIndex(val => val.airlineCodeIata === element['ALCD']);
this.airlinesSelections.push(this.airlines[index]);
}
})
combined_data.forEach(element => { combined_data.forEach(element => {
element['ORDER'] = this.orderHandle.sequence(element); element['ORDER'] = this.orderHandle.sequence(element);
@@ -631,10 +236,15 @@ export class MainComponent implements OnInit {
return (a['ORDER'] - b['ORDER']); return (a['ORDER'] - b['ORDER']);
}) })
this.render_data = combined_data; this.render_data = combined_data;
console.log(new Date().getTime());
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
this.operateSpinServiceService.hideSpin() this.operateSpinServiceService.hideSpin()
//开始处理动态消息
this.canHandleDynamicMessage = true;
this.dynamicMessageArray.forEach(message => {
this.dynamicMessageHandle(message);
})
} }
/** /**
@@ -667,8 +277,9 @@ export class MainComponent implements OnInit {
FLIN: '', //航线类别 FLIN: '', //航线类别
FLTY: '', //航班类别 FLTY: '', //航班类别
MVIN: '', //到达/出发 MVIN: '', //到达/出发
FTSS: '', FTSS: '', //运营状态
TRML: '', //航站楼 TRML: '', //航站楼
Abnormal_state: '', //异常状态
FHAG: '', //机坪代理 FHAG: '', //机坪代理
MHAG: '', //维护代理 MHAG: '', //维护代理
PHAG: '', //旅客代理 PHAG: '', //旅客代理
@@ -681,7 +292,6 @@ export class MainComponent implements OnInit {
if (this.FLT_POS === 1) { if (this.FLT_POS === 1) {
this.selectChange() this.selectChange()
} else { } else {
// this.selectChange()
this.inputPosition(this.render_data) this.inputPosition(this.render_data)
} }
} }
@@ -703,12 +313,22 @@ export class MainComponent implements OnInit {
let is_satis = true; let is_satis = true;
for (const key in filterItems) { for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) { if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['preFlight'][key] === filterItems[key]) { if (key === 'Abnormal_state') {
is_satis = true; if (item['preFlight'][filterItems[key]]) {
continue; is_satis = true;
continue;
} else {
is_satis = false;
break;
}
} else { } else {
is_satis = false; if (item['preFlight'][key] === filterItems[key]) {
break; is_satis = true;
continue;
} else {
is_satis = false;
break;
}
} }
} }
} }
@@ -717,12 +337,22 @@ export class MainComponent implements OnInit {
let is_satis = true; let is_satis = true;
for (const key in filterItems) { for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) { if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['reaFlight'][key] === filterItems[key]) { if (key === 'Abnormal_state') {
is_satis = true; if (item['reaFlight'][filterItems[key]]) {
continue; is_satis = true;
continue;
} else {
is_satis = false;
break;
}
} else { } else {
is_satis = false; if (item['reaFlight'][key] === filterItems[key]) {
break; is_satis = true;
continue;
} else {
is_satis = false;
break;
}
} }
} }
} }
@@ -732,23 +362,43 @@ export class MainComponent implements OnInit {
let rea_satis = true; let rea_satis = true;
for (const key in filterItems) { for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) { if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['preFlight'][key] === filterItems[key]) { if (key === 'Abnormal_state') {
pre_satis = true; if (item['preFlight'][filterItems[key]]) {
continue; pre_satis = true;
continue;
} else {
pre_satis = false;
break;
}
} else { } else {
pre_satis = false; if (item['preFlight'][key] === filterItems[key]) {
break; pre_satis = true;
continue;
} else {
pre_satis = false;
break;
}
} }
} }
} }
for (const key in filterItems) { for (const key in filterItems) {
if (filterItems.hasOwnProperty(key) && filterItems[key]) { if (filterItems.hasOwnProperty(key) && filterItems[key]) {
if (item['reaFlight'][key] === filterItems[key]) { if (key === 'Abnormal_state') {
rea_satis = true; if (item['reaFlight'][filterItems[key]]) {
continue; rea_satis = true;
continue;
} else {
rea_satis = false;
break;
}
} else { } else {
rea_satis = false; if (item['reaFlight'][key] === filterItems[key]) {
break; rea_satis = true;
continue;
} else {
rea_satis = false;
break;
}
} }
} }
} }
@@ -996,6 +646,202 @@ export class MainComponent implements OnInit {
} }
getVipNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['VIPP'] && flight['preFlight']['VIPP'] > 0) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['VIPP'] && flight['reaFlight']['VIPP'] > 0) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['VIPP'] && flight['preFlight']['VIPP'] > 0) || (flight['reaFlight']['VIPP'] && flight['reaFlight']['VIPP'] > 0)) {
return true;
} else {
return false;
}
}
}
getOutplanNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['UPTP'] && flight['preFlight']['UPTP'] === 'SCHD-ADFT') {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['UPTP'] && flight['reaFlight']['UPTP'] === 'SCHD-ADFT') {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['UPTP'] && flight['preFlight']['UPTP'] === 'SCHD-ADFT') || (flight['reaFlight']['UPTP'] && flight['reaFlight']['UPTP'] === 'SCHD-ADFT')) {
return true;
} else {
return false;
}
}
}
getAlternateNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['FDIV']) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['FDIV']) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['FDIV']) || (flight['reaFlight']['FDIV'])) {
return true;
} else {
return false;
}
}
}
getDelay30Notes(flight) {
// return false;
if (this.orderHandle.isArriFlight(flight)) {
return false;
} else {
if (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0) {
if (parseInt(flight['preFlight']['DELY'][0]['DURA']) - 30 > 0) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
getDelayNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['DELY'] && Array.isArray(flight['preFlight']['DELY']) && flight['preFlight']['DELY'].length > 0) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['DELY'] && Array.isArray(flight['preFlight']['DELY']) && flight['preFlight']['DELY'].length > 0) || (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0)) {
return true;
} else {
return false;
}
}
}
getReturnNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['FRET']) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['FRET']) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['FRET']) || (flight['reaFlight']['FRET'])) {
return true;
} else {
return false;
}
}
}
getCancleNotes(flight) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['CNCL']) {
return true;
} else {
return false;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['CNCL']) {
return true;
} else {
return false;
}
} else {
if ((flight['preFlight']['CNCL']) || (flight['reaFlight']['CNCL'])) {
return true;
} else {
return false;
}
}
}
getStopoverNotes(flight) {
if (this.orderHandle.isLinked(flight)) {
if (flight['preFlight']['ACTT'] && flight['reaFlight']['ESTT']) {
if (new Date(dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(dateFormatter(flight['preFlight']['ACTT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['ACTT'] && flight['reaFlight']['SODT']) {
if (new Date(dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(dateFormatter(flight['preFlight']['ACTT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['ESTT'] && flight['reaFlight']['ESTT']) {
if (new Date(dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(dateFormatter(flight['preFlight']['ESTT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['ESTT'] && flight['reaFlight']['SODT']) {
if (new Date(dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(dateFormatter(flight['preFlight']['ESTT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['SODT'] && flight['reaFlight']['ESTT']) {
if (new Date(dateFormatter(flight['reaFlight']['ESTT'])).getTime() - new Date(dateFormatter(flight['preFlight']['SODT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else if (flight['preFlight']['SODT'] && flight['reaFlight']['SODT']) {
if (new Date(dateFormatter(flight['reaFlight']['SODT'])).getTime() - new Date(dateFormatter(flight['preFlight']['SODT'])).getTime() > 3600000) {
return false;
} else {
return true;
}
} else {
return false;
}
} else {
return false;
}
}
/** /**
* 复选框勾选事件 * 复选框勾选事件
*/ */
+479 -29
View File
@@ -152,7 +152,6 @@ export class FlightsDataHandle {
render_pre_flight[key] = preHasValue; render_pre_flight[key] = preHasValue;
render_rea_flight[key] = reaHasValue; render_rea_flight[key] = reaHasValue;
} }
flights_item['renderCombinedFlight'] = render_flight;
flights_item['renderPreFlight'] = render_pre_flight; flights_item['renderPreFlight'] = render_pre_flight;
flights_item['renderReaFlight'] = render_rea_flight; flights_item['renderReaFlight'] = render_rea_flight;
flights_item['renderFlight'] = Object.assign({}, render_flight); flights_item['renderFlight'] = Object.assign({}, render_flight);
@@ -161,10 +160,7 @@ export class FlightsDataHandle {
return flights_item; return flights_item;
} }
/** public basicDataTransHandle(item, airports, citys, airlines, flightStatus) {
* 基础数据转换
*/
basicDataTransHandle(item, airports, citys, airlines, flightStatus) {
if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) { if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) {
//航线处理 //航线处理
let erutCodeArray = item['renderFlight']['ERUT'].split(' - '); let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
@@ -246,32 +242,486 @@ export class FlightsDataHandle {
item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName; item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName;
//运营状态处理 //运营状态处理
item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc
// //航线处理
// let erutCombinedCodeArray = item['renderCombinedFlight']['ERUT'].split(' - ');
// let erutCombinedChnArray = []
// for (let i = 0; i < erutCombinedCodeArray.length; i++) {
// try {
// let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCombinedCodeArray[i]);
// let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
// erutCombinedChnArray.push(citys[cityIndex].cityNameChn);
// } catch (error) {
// erutCombinedChnArray.push(erutCombinedCodeArray[i]);
// }
// }
// item['renderCombinedFlight']['ERUT'] = erutCombinedChnArray.join(' - ');
// //航空公司处理
// let airlineCombinedIndex = airlines.findIndex(val => val.airlineCode === item['renderCombinedFlight']['ALCD']);
// item['renderCombinedFlight']['ALCD'] = airlines[airlineCombinedIndex].airlineName;
// //运营状态处理
// let ftssCombinedCodeArray = item['renderCombinedFlight']['FTSS'].split(' / ');
// let ftssCombinedChnArray = [];
// for (let i = 0; i < ftssCombinedCodeArray.length; i++) {
// ftssCombinedChnArray.push(flightStatus.find(val => val.sttc === ftssCombinedCodeArray[i]).stdc)
// }
// item['renderCombinedFlight']['FTSS'] = ftssCombinedChnArray.join(' / ');
} }
return item; return item;
} }
public dynamicMessageHandle(message, combined_data, render_data, col_lists, filterItems, LASTSEARCH, LAST_SEL_COL, airports, citys, airlines, flightStatus) {
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);
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);
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);
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);
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);
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);
}
}
} else {
let newFlight = {};
newFlight['preFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus);
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);
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);
} else {
let newFlight = {};
newFlight['reaFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus);
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);
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);
}
}
} else {
let newFlight = {};
newFlight['reaFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus);
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);
render_data.push(newFlight);
} else {
render_data.push(newFlight);
}
}
}
}
return {
'combined_data': combined_data,
'render_data': render_data
}
}
} }
+1 -1
View File
@@ -12,7 +12,7 @@ export default function (flight) {
let set = new Set(abdg); let set = new Set(abdg);
return Array.from(set).join(','); return Array.from(set).join(',');
}else{ }else{
return flight['ABTM']['ABDG'] return ''
} }
}else{ }else{
return ''; return '';
+1 -5
View File
@@ -12,11 +12,7 @@ export default function (flight) {
} }
} }
} else { } else {
if (flight['ABTM']['ABOP'] === 'A') { return '';
return timeFormatter(flight['ABTM']['AOTM']);
} else {
return '';
}
} }
} else { } else {
return ''; return '';
+1 -5
View File
@@ -12,11 +12,7 @@ export default function (flight) {
} }
} }
} else { } else {
if (flight['ABTM']['ABOP'] === 'D') { return '';
return timeFormatter(flight['ABTM']['AOTM']);
} else {
return '';
}
} }
} else { } else {
return ''; return '';
+5 -5
View File
@@ -3,18 +3,18 @@
*/ */
export default function (flight) { export default function (flight) {
if(flight['CLDT']){ if (flight['CLDT']) {
if(Array.isArray(flight['CLDT'])&&flight['CLDT'].length>0){ if (Array.isArray(flight['CLDT']) && flight['CLDT'].length > 0) {
let belt = []; let belt = [];
for (let i = 0; i < flight['CLDT'].length; i++) { for (let i = 0; i < flight['CLDT'].length; i++) {
belt.push(flight['CLDT'][i]['BELT']); belt.push(flight['CLDT'][i]['BELT']);
} }
let set = new Set(belt); let set = new Set(belt);
return Array.from(set).join(','); return Array.from(set).join(',');
}else{ } else {
return flight['CLDT']['BELT'] return '';
} }
}else{ } else {
return ''; return '';
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* 登机结束时间显示转换 * 登机开始时间显示转换
*/ */
import timeFormatter from './time-formatter'; import timeFormatter from './time-formatter';
+1 -1
View File
@@ -7,7 +7,7 @@ export default function(flight){
if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){ if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){
return timeFormatter(flight['CKDT'][0]['CCTM']); return timeFormatter(flight['CKDT'][0]['CCTM']);
}else{ }else{
return timeFormatter(flight['CKDT']['CCTM']); return '';
} }
}else{ }else{
return ''; return '';
+1 -1
View File
@@ -11,7 +11,7 @@ export default function(flight){
let set = new Set(chkc); let set = new Set(chkc);
return Array.from(set).join(','); return Array.from(set).join(',');
}else{ }else{
return flight['CKDT']['CHKC'] return '';
} }
}else{ }else{
return ''; return '';
+1 -5
View File
@@ -12,11 +12,7 @@ export default function (flight) {
} }
} }
} else { } else {
if (flight['CHOT']['CHID'] === 'OFF') { return '';
return timeFormatter(flight['CHOT']['CHTM']);
} else {
return '';
}
} }
} else { } else {
return ''; return '';
+1 -5
View File
@@ -12,11 +12,7 @@ export default function (flight) {
} }
} }
} else { } else {
if (flight['CHOT']['CHID'] === 'ON') { return '';
return timeFormatter(flight['CHOT']['CHTM']);
} else {
return '';
}
} }
} else { } else {
return ''; return '';
+1 -1
View File
@@ -11,7 +11,7 @@ export default function (flight) {
let set = new Set(chdt); let set = new Set(chdt);
return Array.from(set).join(','); return Array.from(set).join(',');
}else{ }else{
return flight['CHDT']['CHUT'] return '';
} }
}else{ }else{
return ''; return '';
+6 -6
View File
@@ -2,14 +2,14 @@
* 值机结束时间显示转换 * 值机结束时间显示转换
*/ */
import timeFormatter from './time-formatter'; import timeFormatter from './time-formatter';
export default function(flight){ export default function (flight) {
if(flight['CKDT']){ if (flight['CKDT']) {
if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){ if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) {
return timeFormatter(flight['CKDT'][0]['COTM']); return timeFormatter(flight['CKDT'][0]['COTM']);
}else{ } else {
return timeFormatter(flight['CKDT']['COTM']); return '';
} }
}else{ } else {
return ''; return '';
} }
} }
+1 -1
View File
@@ -10,7 +10,7 @@ export default function(flight){
} }
return erut.join(' - '); return erut.join(' - ');
}else{ }else{
return flight['ERUT']['APCD'] return '';
} }
}else{ }else{
return ''; return '';
+1 -2
View File
@@ -1,7 +1,6 @@
/** /**
* 登机门显示转换 * 登机门显示转换
*/ */
import timeFormatter from './time-formatter';
export default function (flight) { export default function (flight) {
if (flight['GTDT']) { if (flight['GTDT']) {
@@ -13,7 +12,7 @@ export default function (flight) {
let set = new Set(gate); let set = new Set(gate);
return Array.from(set).join(','); return Array.from(set).join(',');
} else { } else {
return flight['GTDT']['GATE']; return '';
} }
} else { } else {
return ''; return '';
+1 -1
View File
@@ -8,7 +8,7 @@ export default function (flight) {
if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) { if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) {
return timeFormatter(flight['GTDT'][0]['GCTM']); return timeFormatter(flight['GTDT'][0]['GCTM']);
} else { } else {
return timeFormatter(flight['GTDT']['GCTM']); return '';
} }
} else { } else {
return ''; return '';
+1 -1
View File
@@ -11,7 +11,7 @@ export default function(flight){
let set = new Set(chkc); let set = new Set(chkc);
return Array.from(set).join(','); return Array.from(set).join(',');
}else{ }else{
return flight['PSDT']['PSST'] return '';
} }
}else{ }else{
return ''; return '';
Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B