代码抽取优化、添加重要提示
This commit is contained in:
@@ -12,6 +12,8 @@ import { WebsocketService } from '../../services/websocket.service';
|
||||
import { DynamicFlightOrder } from './utils/dynamic-flight-order';
|
||||
import { FlightsDataHandle } from './utils/flights-data-handle';
|
||||
|
||||
import dateFormatter from '../../utils/data-formatter';
|
||||
|
||||
import * as $ from 'jquery';
|
||||
@Component({
|
||||
selector: 'app-main',
|
||||
@@ -19,7 +21,6 @@ import * as $ from 'jquery';
|
||||
styleUrls: ['./main.component.scss']
|
||||
})
|
||||
export class MainComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private basicDataService: BasicDataService,
|
||||
private operateSpinServiceService: OperateSpinServiceService,
|
||||
@@ -35,7 +36,9 @@ export class MainComponent implements OnInit {
|
||||
public dataHandle = new FlightsDataHandle();
|
||||
|
||||
public tabClose: boolean = true;
|
||||
public isSpinning: boolean = true;
|
||||
|
||||
public canHandleDynamicMessage: boolean = false;
|
||||
public dynamicMessageArray: Array<any> = [];
|
||||
|
||||
//各项基础数据
|
||||
public terminals: Array<any>;
|
||||
@@ -44,7 +47,10 @@ export class MainComponent implements OnInit {
|
||||
public citys: 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 render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
@@ -66,478 +72,14 @@ export class MainComponent implements OnInit {
|
||||
event => {
|
||||
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;
|
||||
//是否可以开始处理动态消息
|
||||
if (this.canHandleDynamicMessage) {
|
||||
this.dynamicMessageHandle(message)
|
||||
} 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') {
|
||||
let message = JSON.parse(data.message);
|
||||
console.log(message);
|
||||
@@ -554,7 +96,7 @@ export class MainComponent implements OnInit {
|
||||
this.col_lists = data;
|
||||
}
|
||||
)
|
||||
/* 获取航班动态信息 */
|
||||
//获取航班动态信息
|
||||
this.httpCilent.get('/msgexchangeapi/all/flights').subscribe(
|
||||
data => {
|
||||
this.raw_data = data.body;
|
||||
@@ -608,9 +150,7 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* 固定表头
|
||||
*/
|
||||
//固定表头
|
||||
var tableCont = document.querySelector('#table-container')
|
||||
function scrollHandle() {
|
||||
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) {
|
||||
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 => {
|
||||
element['ORDER'] = this.orderHandle.sequence(element);
|
||||
@@ -631,10 +236,15 @@ export class MainComponent implements OnInit {
|
||||
return (a['ORDER'] - b['ORDER']);
|
||||
})
|
||||
this.render_data = combined_data;
|
||||
console.log(new Date().getTime());
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
this.changeDetectorRef.detectChanges();
|
||||
this.operateSpinServiceService.hideSpin()
|
||||
|
||||
//开始处理动态消息
|
||||
this.canHandleDynamicMessage = true;
|
||||
this.dynamicMessageArray.forEach(message => {
|
||||
this.dynamicMessageHandle(message);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -667,8 +277,9 @@ export class MainComponent implements OnInit {
|
||||
FLIN: '', //航线类别
|
||||
FLTY: '', //航班类别
|
||||
MVIN: '', //到达/出发
|
||||
FTSS: '',
|
||||
FTSS: '', //运营状态
|
||||
TRML: '', //航站楼
|
||||
Abnormal_state: '', //异常状态
|
||||
FHAG: '', //机坪代理
|
||||
MHAG: '', //维护代理
|
||||
PHAG: '', //旅客代理
|
||||
@@ -681,7 +292,6 @@ export class MainComponent implements OnInit {
|
||||
if (this.FLT_POS === 1) {
|
||||
this.selectChange()
|
||||
} else {
|
||||
// this.selectChange()
|
||||
this.inputPosition(this.render_data)
|
||||
}
|
||||
}
|
||||
@@ -703,12 +313,22 @@ export class MainComponent implements OnInit {
|
||||
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;
|
||||
if (key === 'Abnormal_state') {
|
||||
if (item['preFlight'][filterItems[key]]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
if (item['preFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -717,12 +337,22 @@ export class MainComponent implements OnInit {
|
||||
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;
|
||||
if (key === 'Abnormal_state') {
|
||||
if (item['reaFlight'][filterItems[key]]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
if (item['reaFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -732,23 +362,43 @@ export class MainComponent implements OnInit {
|
||||
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;
|
||||
if (key === 'Abnormal_state') {
|
||||
if (item['preFlight'][filterItems[key]]) {
|
||||
pre_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
pre_satis = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
pre_satis = false;
|
||||
break;
|
||||
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;
|
||||
if (key === 'Abnormal_state') {
|
||||
if (item['reaFlight'][filterItems[key]]) {
|
||||
rea_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
rea_satis = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
rea_satis = false;
|
||||
break;
|
||||
if (item['reaFlight'][key] === filterItems[key]) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 复选框勾选事件
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user