2018-10-26 11:33:25 +08:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2018-11-12 11:27:23 +08:00
|
|
|
import { ChangeDetectorRef } from '@angular/core';
|
2018-10-26 11:33:25 +08:00
|
|
|
|
2018-11-26 18:53:23 +08:00
|
|
|
import { ToastService } from '../../components/toast/toast.service';
|
|
|
|
|
import { ToastConfig, ToastType } from '../../components/toast/toast-model';
|
|
|
|
|
|
2018-10-26 11:33:25 +08:00
|
|
|
import { HttpClientService } from '../../services/http-client.service';
|
2018-11-29 10:40:23 +08:00
|
|
|
import { BasicDataService } from '../basic-data-service';
|
|
|
|
|
import { OperateSpinServiceService } from '../operate-spin-service.service';
|
|
|
|
|
import { WebsocketService } from '../../services/websocket.service';
|
2018-10-26 11:33:25 +08:00
|
|
|
|
2018-12-07 11:28:45 +08:00
|
|
|
import { DynamicFlightOrder } from './utils/dynamic-flight-order';
|
|
|
|
|
import { FlightsDataHandle } from './utils/flights-data-handle';
|
2018-11-06 09:41:04 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
import * as $ from 'jquery';
|
2018-10-26 11:33:25 +08:00
|
|
|
@Component({
|
|
|
|
|
selector: 'app-main',
|
|
|
|
|
templateUrl: './main.component.html',
|
|
|
|
|
styleUrls: ['./main.component.scss']
|
|
|
|
|
})
|
|
|
|
|
export class MainComponent implements OnInit {
|
2018-11-12 11:27:23 +08:00
|
|
|
|
|
|
|
|
constructor(
|
2018-11-19 09:30:59 +08:00
|
|
|
private basicDataService: BasicDataService,
|
2018-12-03 11:28:24 +08:00
|
|
|
private operateSpinServiceService: OperateSpinServiceService,
|
2018-11-12 11:27:23 +08:00
|
|
|
private httpCilent: HttpClientService,
|
2018-11-26 18:53:23 +08:00
|
|
|
private changeDetectorRef: ChangeDetectorRef,
|
|
|
|
|
private toastService: ToastService,
|
2018-11-29 10:40:23 +08:00
|
|
|
private websocketService: WebsocketService
|
2018-11-26 18:53:23 +08:00
|
|
|
) {
|
2018-12-03 11:28:24 +08:00
|
|
|
this.operateSpinServiceService.showSpin();
|
2018-12-07 11:28:45 +08:00
|
|
|
this.changeDetectorRef.detach();
|
2018-11-27 18:16:25 +08:00
|
|
|
}
|
2018-12-07 11:28:45 +08:00
|
|
|
public orderHandle = new DynamicFlightOrder();
|
|
|
|
|
public dataHandle = new FlightsDataHandle();
|
|
|
|
|
|
2018-11-27 18:16:25 +08:00
|
|
|
public tabClose: boolean = true;
|
2018-11-29 10:40:23 +08:00
|
|
|
public isSpinning: boolean = true;
|
2018-11-19 09:30:59 +08:00
|
|
|
|
|
|
|
|
//各项基础数据
|
2018-11-27 18:16:25 +08:00
|
|
|
public terminals: Array<any>;
|
2018-11-21 18:55:57 +08:00
|
|
|
public flightStatus: Array<any>;
|
|
|
|
|
public airports: Array<any>;
|
2018-12-07 11:28:45 +08:00
|
|
|
public citys: Array<any>;
|
2018-11-21 18:55:57 +08:00
|
|
|
public airlines: Array<any>;
|
2018-11-12 11:27:23 +08:00
|
|
|
|
|
|
|
|
public raw_data: Array<object> = []; //原始数据,即航班计划
|
|
|
|
|
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
|
|
|
|
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
|
|
|
|
|
|
|
|
|
public col_lists: Array<object>; //列数据
|
2018-10-26 11:33:25 +08:00
|
|
|
public airline_color: Array<object> = [];
|
2018-11-15 14:57:26 +08:00
|
|
|
public row_state: any = { renderFlight: {} };
|
2018-10-26 11:33:25 +08:00
|
|
|
|
2018-11-27 18:16:25 +08:00
|
|
|
public checkboxGroup = {
|
|
|
|
|
'related': false,
|
|
|
|
|
'detail': false,
|
|
|
|
|
'vip': false,
|
|
|
|
|
'special': false,
|
|
|
|
|
'guarantee': false
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-26 11:33:25 +08:00
|
|
|
ngOnInit() {
|
2018-12-07 11:28:45 +08:00
|
|
|
//订阅航班更新
|
2018-11-29 10:40:23 +08:00
|
|
|
this.websocketService.dynamicsMessage().subscribe(
|
|
|
|
|
event => {
|
2018-12-12 18:27:21 +08:00
|
|
|
let data = JSON.parse(event as string);
|
|
|
|
|
if (data.topic === 'schd') {
|
|
|
|
|
console.log('========')
|
|
|
|
|
let message = JSON.parse(data.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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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') {
|
|
|
|
|
let message = JSON.parse(data.message);
|
|
|
|
|
console.log(message);
|
|
|
|
|
}
|
2018-11-29 10:40:23 +08:00
|
|
|
}
|
|
|
|
|
)
|
2018-12-03 11:28:24 +08:00
|
|
|
|
2018-10-26 11:33:25 +08:00
|
|
|
/* 获取显示列 */
|
|
|
|
|
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
|
|
|
|
|
data => {
|
|
|
|
|
data.sort(function (a, b) {
|
|
|
|
|
return (a['COL_ORDER'] - b['COL_ORDER']);
|
|
|
|
|
})
|
2018-11-12 11:27:23 +08:00
|
|
|
this.col_lists = data;
|
2018-10-26 11:33:25 +08:00
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
/* 获取航班动态信息 */
|
2018-12-07 11:28:45 +08:00
|
|
|
this.httpCilent.get('/msgexchangeapi/all/flights').subscribe(
|
2018-10-26 11:33:25 +08:00
|
|
|
data => {
|
2018-12-07 11:28:45 +08:00
|
|
|
this.raw_data = data.body;
|
2018-11-06 09:41:04 +08:00
|
|
|
|
|
|
|
|
//查找链接航班并将其组合成一条数据
|
2018-12-12 18:27:21 +08:00
|
|
|
let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data);
|
2018-11-12 11:27:23 +08:00
|
|
|
combined_linked_data.forEach(element => {
|
2018-12-07 11:28:45 +08:00
|
|
|
let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists);
|
|
|
|
|
this.combined_data.push(flights_item);
|
|
|
|
|
});
|
2018-11-06 09:41:04 +08:00
|
|
|
|
2018-11-21 18:55:57 +08:00
|
|
|
//从基础数据服务中拿出部分基础数据
|
2018-11-27 18:16:25 +08:00
|
|
|
this.terminals = this.basicDataService.terminal;
|
2018-11-21 18:55:57 +08:00
|
|
|
this.flightStatus = this.basicDataService.flightStatus;
|
|
|
|
|
this.airlines = this.basicDataService.airline;
|
|
|
|
|
this.citys = this.basicDataService.city;
|
|
|
|
|
this.airports = this.basicDataService.airport;
|
|
|
|
|
|
|
|
|
|
if (this.airports && this.airports.length > 0) {
|
2018-12-12 18:27:21 +08:00
|
|
|
let combined_data = []
|
|
|
|
|
this.combined_data.forEach(item => {
|
|
|
|
|
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
|
|
|
|
|
})
|
|
|
|
|
this.combined_data = combined_data;
|
2018-12-07 11:28:45 +08:00
|
|
|
this.doSequence(this.combined_data);
|
2018-11-21 18:55:57 +08:00
|
|
|
} else {
|
2018-11-27 18:16:25 +08:00
|
|
|
this.basicDataService.terminal_subject.subscribe(
|
|
|
|
|
val => this.terminals = val
|
|
|
|
|
)
|
2018-11-21 18:55:57 +08:00
|
|
|
this.basicDataService.flightStatus_subject.subscribe(
|
|
|
|
|
val => this.flightStatus = val
|
|
|
|
|
);
|
|
|
|
|
this.basicDataService.airline_subject.subscribe(
|
|
|
|
|
val => this.airlines = val
|
|
|
|
|
);
|
|
|
|
|
this.basicDataService.city_subject.subscribe(
|
|
|
|
|
val => this.citys = val
|
|
|
|
|
);
|
|
|
|
|
this.basicDataService.airport_subject.subscribe(
|
|
|
|
|
val => {
|
|
|
|
|
this.airports = val;
|
2018-12-12 18:27:21 +08:00
|
|
|
let combined_data = []
|
|
|
|
|
this.combined_data.forEach(item => {
|
|
|
|
|
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus));
|
|
|
|
|
})
|
|
|
|
|
this.combined_data = combined_data;
|
2018-12-07 11:28:45 +08:00
|
|
|
this.doSequence(this.combined_data);
|
2018-11-21 18:55:57 +08:00
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
2018-10-26 11:33:25 +08:00
|
|
|
}
|
|
|
|
|
)
|
2018-11-15 18:29:19 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 固定表头
|
|
|
|
|
*/
|
|
|
|
|
var tableCont = document.querySelector('#table-container')
|
2018-11-19 09:30:59 +08:00
|
|
|
function scrollHandle() {
|
|
|
|
|
var scrollTop = this.scrollTop;
|
|
|
|
|
this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
|
2018-11-15 18:29:19 +08:00
|
|
|
}
|
2018-11-19 09:30:59 +08:00
|
|
|
tableCont.addEventListener('scroll', scrollHandle)
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-12 14:32:28 +08:00
|
|
|
/**
|
2018-11-15 14:57:26 +08:00
|
|
|
* 执行排序并渲染
|
2018-11-12 14:32:28 +08:00
|
|
|
*/
|
2018-12-12 18:27:21 +08:00
|
|
|
doSequence(combined_data) {
|
|
|
|
|
|
|
|
|
|
combined_data.forEach(element => {
|
2018-12-07 11:28:45 +08:00
|
|
|
element['ORDER'] = this.orderHandle.sequence(element);
|
2018-11-15 14:57:26 +08:00
|
|
|
})
|
2018-12-12 18:27:21 +08:00
|
|
|
combined_data.sort(function (a, b) {
|
2018-11-15 14:57:26 +08:00
|
|
|
return (a['ORDER'] - b['ORDER']);
|
|
|
|
|
})
|
2018-12-12 18:27:21 +08:00
|
|
|
this.render_data = combined_data;
|
|
|
|
|
console.log(new Date().getTime());
|
2018-11-15 14:57:26 +08:00
|
|
|
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
2018-11-26 18:53:23 +08:00
|
|
|
this.changeDetectorRef.detectChanges();
|
2018-12-03 11:28:24 +08:00
|
|
|
this.operateSpinServiceService.hideSpin()
|
2018-11-26 18:53:23 +08:00
|
|
|
}
|
|
|
|
|
|
2018-11-27 18:16:25 +08:00
|
|
|
/**
|
|
|
|
|
* 刷新
|
|
|
|
|
*/
|
|
|
|
|
refresh() {
|
2018-12-12 18:27:21 +08:00
|
|
|
let testss = this.render_data.reverse();
|
|
|
|
|
let tstt = [];
|
|
|
|
|
testss.forEach(element => {
|
|
|
|
|
tstt.push(Object.assign({}, element))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.render_data = testss;
|
2018-11-27 18:16:25 +08:00
|
|
|
this.changeDetectorRef.detectChanges();
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
/**
|
|
|
|
|
* 过滤及定位
|
|
|
|
|
* @param filterItems
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2018-11-19 09:30:59 +08:00
|
|
|
SEARCH = ''; //手动输入条件
|
2018-12-12 18:27:21 +08:00
|
|
|
LASTSEARCH = '';
|
2018-11-19 09:30:59 +08:00
|
|
|
FLT_POS = 1; //过滤还是定位
|
|
|
|
|
SEL_COL = ''; //选择列名
|
2018-12-12 18:27:21 +08:00
|
|
|
LAST_SEL_COL = '';
|
2018-11-19 09:30:59 +08:00
|
|
|
public filterItems = {
|
|
|
|
|
ALCD: '', //航空公司
|
|
|
|
|
FLIN: '', //航线类别
|
|
|
|
|
FLTY: '', //航班类别
|
|
|
|
|
MVIN: '', //到达/出发
|
2018-11-27 18:16:25 +08:00
|
|
|
FTSS: '',
|
2018-11-19 09:30:59 +08:00
|
|
|
TRML: '', //航站楼
|
|
|
|
|
FHAG: '', //机坪代理
|
|
|
|
|
MHAG: '', //维护代理
|
|
|
|
|
PHAG: '', //旅客代理
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 输入框回车事件
|
|
|
|
|
*/
|
2018-11-15 14:57:26 +08:00
|
|
|
inputEnter() {
|
|
|
|
|
if (this.FLT_POS === 1) {
|
|
|
|
|
this.selectChange()
|
|
|
|
|
} else {
|
2018-11-21 18:55:57 +08:00
|
|
|
// this.selectChange()
|
2018-11-15 14:57:26 +08:00
|
|
|
this.inputPosition(this.render_data)
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-19 09:30:59 +08:00
|
|
|
/**
|
|
|
|
|
* 下拉框选择筛选
|
|
|
|
|
*/
|
2018-11-15 14:57:26 +08:00
|
|
|
selectChange() {
|
2018-12-03 11:28:24 +08:00
|
|
|
this.operateSpinServiceService.showSpin();
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
let filter_data = [];
|
|
|
|
|
let filterItems = this.filterItems;
|
|
|
|
|
this.combined_data.forEach(item => {
|
|
|
|
|
filter_data.push(Object.assign({}, item));
|
|
|
|
|
})
|
|
|
|
|
//下拉框筛选
|
|
|
|
|
filter_data = filter_data.filter(item => {
|
2018-12-07 11:28:45 +08:00
|
|
|
if (this.orderHandle.isArriFlight(item)) {
|
2018-12-03 11:28:24 +08:00
|
|
|
let is_satis = true;
|
|
|
|
|
for (const key in filterItems) {
|
|
|
|
|
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
|
|
|
|
if (item['preFlight'][key] === filterItems[key]) {
|
|
|
|
|
is_satis = true;
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
is_satis = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-12-03 11:28:24 +08:00
|
|
|
return is_satis;
|
2018-12-07 11:28:45 +08:00
|
|
|
} else if (this.orderHandle.isDeptFlight(item)) {
|
2018-12-03 11:28:24 +08:00
|
|
|
let is_satis = true;
|
|
|
|
|
for (const key in filterItems) {
|
|
|
|
|
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
|
|
|
|
if (item['reaFlight'][key] === filterItems[key]) {
|
|
|
|
|
is_satis = true;
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
is_satis = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-12-03 11:28:24 +08:00
|
|
|
return is_satis;
|
2018-11-15 14:57:26 +08:00
|
|
|
} else {
|
2018-12-03 11:28:24 +08:00
|
|
|
let pre_satis = true;
|
|
|
|
|
let rea_satis = true;
|
|
|
|
|
for (const key in filterItems) {
|
|
|
|
|
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
|
|
|
|
if (item['preFlight'][key] === filterItems[key]) {
|
|
|
|
|
pre_satis = true;
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
pre_satis = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (const key in filterItems) {
|
|
|
|
|
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
|
|
|
|
if (item['reaFlight'][key] === filterItems[key]) {
|
|
|
|
|
rea_satis = true;
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
rea_satis = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pre_satis && !rea_satis) {
|
|
|
|
|
item['renderFlight'] = item['renderPreFlight'];
|
2018-12-12 18:27:21 +08:00
|
|
|
delete item['reaFlight'];
|
|
|
|
|
delete item['renderReaFlight'];
|
2018-12-03 11:28:24 +08:00
|
|
|
return pre_satis;
|
|
|
|
|
} else if (!pre_satis && rea_satis) {
|
|
|
|
|
item['renderFlight'] = item['renderReaFlight'];
|
2018-12-12 18:27:21 +08:00
|
|
|
delete item['preFlight'];
|
|
|
|
|
delete item['renderPreFlight'];
|
2018-12-03 11:28:24 +08:00
|
|
|
return rea_satis;
|
|
|
|
|
} else if (pre_satis && rea_satis) {
|
|
|
|
|
return pre_satis && rea_satis;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
2018-12-03 11:28:24 +08:00
|
|
|
})
|
|
|
|
|
if (this.FLT_POS === 1) {
|
|
|
|
|
this.inputFilter(filter_data);
|
|
|
|
|
} else {
|
|
|
|
|
this.render_data = filter_data;
|
|
|
|
|
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
|
|
|
|
this.changeDetectorRef.detectChanges();
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
2018-12-03 11:28:24 +08:00
|
|
|
}, 10)
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
2018-11-19 09:30:59 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 输入框筛选
|
|
|
|
|
* @param filterData
|
|
|
|
|
*/
|
2018-11-15 14:57:26 +08:00
|
|
|
inputFilter(filterData) {
|
2018-12-12 18:27:21 +08:00
|
|
|
this.LAST_SEL_COL = this.SEL_COL;
|
|
|
|
|
this.LASTSEARCH = this.SEARCH;
|
2018-11-15 14:57:26 +08:00
|
|
|
if (this.SEARCH) {
|
|
|
|
|
if (this.SEL_COL) {
|
|
|
|
|
let sel_col = this.SEL_COL;
|
|
|
|
|
filterData = filterData.filter(item => {
|
|
|
|
|
if (item['renderFlight'][sel_col]) {
|
|
|
|
|
if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2018-12-12 18:27:21 +08:00
|
|
|
return false;
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
filterData = filterData.filter(item => {
|
|
|
|
|
let is_satis = false;
|
2018-12-12 18:27:21 +08:00
|
|
|
let cols = this.col_lists;
|
|
|
|
|
for (let i = 0; i < cols.length; i++) {
|
|
|
|
|
if (item['renderFlight'][cols[i]['COL_CODE']]) {
|
|
|
|
|
if (item['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
|
|
|
|
is_satis = true;
|
|
|
|
|
break;
|
2018-11-15 14:57:26 +08:00
|
|
|
} else {
|
2018-12-12 18:27:21 +08:00
|
|
|
is_satis = false;
|
|
|
|
|
continue;
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
} else {
|
2018-12-12 18:27:21 +08:00
|
|
|
is_satis = false;
|
2018-11-15 14:57:26 +08:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return is_satis;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.render_data = filterData;
|
|
|
|
|
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
|
|
|
|
this.changeDetectorRef.detectChanges();
|
2018-12-03 11:28:24 +08:00
|
|
|
this.operateSpinServiceService.hideSpin()
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
|
2018-11-19 09:30:59 +08:00
|
|
|
/**
|
|
|
|
|
* 输入框定位
|
|
|
|
|
*/
|
2018-11-15 14:57:26 +08:00
|
|
|
positionArray: Array<any> = [];
|
|
|
|
|
positionArrayIndex: number = 0;
|
2018-11-19 09:30:59 +08:00
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
inputPosition(filterData) {
|
|
|
|
|
let transArray = []
|
|
|
|
|
if (this.SEL_COL) {
|
|
|
|
|
let sel_col = this.SEL_COL;
|
|
|
|
|
filterData.forEach(element => {
|
|
|
|
|
if (element['renderFlight'][sel_col]) {
|
|
|
|
|
if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
|
|
|
|
transArray.push(element)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!this.SEARCH) {
|
|
|
|
|
transArray.push(element)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
filterData.forEach(element => {
|
2018-12-12 18:27:21 +08:00
|
|
|
let cols = this.col_lists;
|
|
|
|
|
for (let i = 0; i < cols.length; i++) {
|
|
|
|
|
if (element['renderFlight'][cols[i]['COL_CODE']]) {
|
|
|
|
|
if (element['renderFlight'][cols[i]['COL_CODE']].toString().match(new RegExp(this.SEARCH, 'i'))) {
|
|
|
|
|
transArray.push(element)
|
|
|
|
|
break;
|
2018-11-15 14:57:26 +08:00
|
|
|
} else {
|
2018-12-12 18:27:21 +08:00
|
|
|
continue;
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
} else {
|
2018-12-12 18:27:21 +08:00
|
|
|
if (this.SEARCH) {
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
transArray.push(element)
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (transArray.length > 0) {
|
|
|
|
|
if (transArray.toString() == this.positionArray.toString()) {
|
|
|
|
|
this.positionArrayIndex++;
|
|
|
|
|
if (this.positionArrayIndex === this.positionArray.length) {
|
|
|
|
|
this.positionArrayIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
this.row_state = this.positionArray[this.positionArrayIndex];
|
|
|
|
|
} else {
|
|
|
|
|
this.positionArray = transArray;
|
|
|
|
|
this.positionArrayIndex = 0;
|
|
|
|
|
this.row_state = this.positionArray[this.positionArrayIndex];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
alert('没有搜索到相关数据');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.changeDetectorRef.detectChanges();
|
|
|
|
|
|
|
|
|
|
let tr = $(".selected");
|
|
|
|
|
let objTr = tr[0];
|
2018-12-12 18:27:21 +08:00
|
|
|
if (objTr) {
|
|
|
|
|
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-15 14:57:26 +08:00
|
|
|
}
|
2018-11-12 14:32:28 +08:00
|
|
|
|
2018-11-19 09:30:59 +08:00
|
|
|
/**
|
|
|
|
|
* 选中某行
|
|
|
|
|
* @param i
|
|
|
|
|
*/
|
|
|
|
|
selectRow(i) {
|
|
|
|
|
this.row_state = i;
|
|
|
|
|
this.changeDetectorRef.detectChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前单元格颜色
|
|
|
|
|
* @param col_CODE
|
|
|
|
|
*/
|
2018-11-29 10:40:23 +08:00
|
|
|
getColor(col_CODE, flight) {
|
2018-12-07 11:28:45 +08:00
|
|
|
if (this.orderHandle.isArriFlight(flight)) {
|
2018-11-29 10:40:23 +08:00
|
|
|
if (col_CODE === 'SODT') {
|
|
|
|
|
if (flight['preFlight']['SODT']) {
|
|
|
|
|
if (!flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
|
|
|
|
|
return 'rgb(0,255,255)';
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else if (col_CODE === 'ESTT') {
|
|
|
|
|
if (flight['preFlight']['ESTT']) {
|
|
|
|
|
if (!flight['preFlight']['ACTT']) {
|
|
|
|
|
return 'rgb(255,207,156)';
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else if (col_CODE === 'ACTT') {
|
|
|
|
|
if (flight['preFlight']['ACTT']) {
|
|
|
|
|
return 'rgb(148,207,255)';
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-19 09:30:59 +08:00
|
|
|
} else {
|
2018-11-29 10:40:23 +08:00
|
|
|
if (col_CODE === 'SODT') {
|
|
|
|
|
if (flight['reaFlight']['SODT']) {
|
|
|
|
|
if (!flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
|
|
|
|
|
return 'rgb(0,255,255)';
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else if (col_CODE === 'ESTT') {
|
|
|
|
|
if (flight['reaFlight']['ESTT']) {
|
|
|
|
|
if (!flight['reaFlight']['ACTT']) {
|
|
|
|
|
return 'rgb(255,207,156)';
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else if (col_CODE === 'ACTT') {
|
|
|
|
|
if (flight['reaFlight']['ACTT']) {
|
|
|
|
|
return 'rgb(148,207,255)';
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2018-11-19 09:30:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-29 10:40:23 +08:00
|
|
|
/**
|
|
|
|
|
* 单元格内容居左居右
|
|
|
|
|
* @param col_CODE
|
|
|
|
|
* @param flight
|
|
|
|
|
*/
|
|
|
|
|
getPosition(col_CODE, flight) {
|
2018-12-07 11:28:45 +08:00
|
|
|
if (this.orderHandle.isDeptFlight(flight)) {
|
2018-11-29 10:40:23 +08:00
|
|
|
if (col_CODE === 'FLNO' || col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
|
|
|
|
|
return 'text-right';
|
|
|
|
|
}
|
2018-12-07 11:28:45 +08:00
|
|
|
} else if (this.orderHandle.isLinked(flight)) {
|
2018-11-29 10:40:23 +08:00
|
|
|
if (col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
|
|
|
|
|
if (!flight['renderPreFlight'][col_CODE] && flight['renderReaFlight'][col_CODE]) {
|
|
|
|
|
return 'text-right';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-07 11:28:45 +08:00
|
|
|
/**
|
|
|
|
|
* 复选框勾选事件
|
|
|
|
|
*/
|
|
|
|
|
checkboxChange() {
|
|
|
|
|
for (const key in this.checkboxGroup) {
|
|
|
|
|
if (this.checkboxGroup.hasOwnProperty(key)) {
|
|
|
|
|
if (this.checkboxGroup[key]) {
|
|
|
|
|
this.tabClose = false;
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
this.tabClose = true;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.changeDetectorRef.detectChanges()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* tab项切换事件
|
|
|
|
|
*/
|
|
|
|
|
nzClick() {
|
|
|
|
|
this.changeDetectorRef.detectChanges();
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-06 09:41:04 +08:00
|
|
|
}
|