部分代码抽取(数据处理,排序)优化
This commit is contained in:
@@ -24,6 +24,18 @@
|
||||
"ws": true
|
||||
},
|
||||
"/v2": {
|
||||
"target": "http://130.120.3.231:97",
|
||||
"secure": false,
|
||||
"changeOrigin": true,
|
||||
"ws": true
|
||||
},
|
||||
"/all": {
|
||||
"target": "http://130.120.3.232:8001",
|
||||
"secure": false,
|
||||
"changeOrigin": true,
|
||||
"ws": true
|
||||
},
|
||||
"/msgexchangeapi": {
|
||||
"target": "http://130.120.3.231:91",
|
||||
"secure": false,
|
||||
"changeOrigin": true,
|
||||
|
||||
@@ -9,32 +9,8 @@ import { BasicDataService } from '../basic-data-service';
|
||||
import { OperateSpinServiceService } from '../operate-spin-service.service';
|
||||
import { WebsocketService } from '../../services/websocket.service';
|
||||
|
||||
import dateFormatter from '../../utils/data-formatter';
|
||||
import timeFormatter from '../../utils/time-formatter';
|
||||
|
||||
import gctmFormatter from '../../utils/gctm-formatter';
|
||||
import botmFormatter from '../../utils/botm-formatter';
|
||||
import abdgFormatter from '../../utils/abdg-formatter';
|
||||
import aotm_aFormatter from '../../utils/aotm_a-formatter';
|
||||
import aotm_dFormatter from '../../utils/aotm_d-formatter';
|
||||
import beltFormatter from '../../utils/belt-formatter';
|
||||
import chkcFormatter from '../../utils/chkc-formatter';
|
||||
import cctmFormatter from '../../utils/cctm-formatter';
|
||||
import cotmFormatter from '../../utils/cotm-formatter';
|
||||
import chtmOnFormatter from '../../utils/chtm_on-formatter';
|
||||
import chtmOffFormatter from '../../utils/chtm_off-formatter';
|
||||
import laclFormatter from '../../utils/lacl-formatter';
|
||||
import chutFormatter from '../../utils/chut-formatter';
|
||||
import acttFormatter from '../../utils/actt-formatter';
|
||||
import psstFormatter from '../../utils/psst-formatter';
|
||||
import esttFormatter from '../../utils/estt-formatter';
|
||||
import mvinFormatter from '../../utils/mvin-formatter';
|
||||
import erutFormatter from '../../utils/erut-formatter';
|
||||
import flinFormatter from '../../utils/flin-formatter';
|
||||
import sodtFormatter from '../../utils/sodt-formatter';
|
||||
import gateFormatter from '../../utils/gate-formatter';
|
||||
import padtFormatter from '../../utils/padt-formatter';
|
||||
|
||||
import { DynamicFlightOrder } from './utils/dynamic-flight-order';
|
||||
import { FlightsDataHandle } from './utils/flights-data-handle';
|
||||
|
||||
import * as $ from 'jquery';
|
||||
@Component({
|
||||
@@ -52,9 +28,12 @@ export class MainComponent implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private websocketService: WebsocketService
|
||||
) {
|
||||
console.log(new Date().getTime())
|
||||
this.operateSpinServiceService.showSpin();
|
||||
this.changeDetectorRef.detach();
|
||||
}
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
public dataHandle = new FlightsDataHandle();
|
||||
|
||||
public tabClose: boolean = true;
|
||||
public isSpinning: boolean = true;
|
||||
|
||||
@@ -62,7 +41,7 @@ export class MainComponent implements OnInit {
|
||||
public terminals: Array<any>;
|
||||
public flightStatus: Array<any>;
|
||||
public airports: Array<any>;
|
||||
public citys: Array<any>;;
|
||||
public citys: Array<any>;
|
||||
public airlines: Array<any>;
|
||||
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
@@ -73,8 +52,6 @@ export class MainComponent implements OnInit {
|
||||
public airline_color: Array<object> = [];
|
||||
public row_state: any = { renderFlight: {} };
|
||||
|
||||
|
||||
|
||||
public checkboxGroup = {
|
||||
'related': false,
|
||||
'detail': false,
|
||||
@@ -83,40 +60,20 @@ export class MainComponent implements OnInit {
|
||||
'guarantee': false
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'GCTM': gctmFormatter,
|
||||
'BOTM': botmFormatter,
|
||||
'ABDG': abdgFormatter,
|
||||
'AOTM_A': aotm_aFormatter,
|
||||
'AOTM_D': aotm_dFormatter,
|
||||
'BELT': beltFormatter,
|
||||
'CHKC': chkcFormatter,
|
||||
'CCTM': cctmFormatter,
|
||||
'COTM': cotmFormatter,
|
||||
'CHTM_ON': chtmOnFormatter,
|
||||
'CHTM_OFF': chtmOffFormatter,
|
||||
'LACL': laclFormatter,
|
||||
'CHUT': chutFormatter,
|
||||
'ACTT': acttFormatter,
|
||||
'PSST': psstFormatter,
|
||||
'ESTT': esttFormatter,
|
||||
'MVIN': mvinFormatter,
|
||||
'ERUT': erutFormatter,
|
||||
'FLIN': flinFormatter,
|
||||
'SODT': sodtFormatter,
|
||||
'GATE': gateFormatter,
|
||||
'PADT': padtFormatter
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
//订阅航班更新
|
||||
this.websocketService.dynamicsMessage().subscribe(
|
||||
event => {
|
||||
console.log(event);
|
||||
console.log(JSON.parse(event['data']));
|
||||
// let index = this.raw_data.findIndex(val => val['FLID'] === event['FLID']);
|
||||
// if (index > -1) {
|
||||
// this.raw_data[index] = event;
|
||||
// } else {
|
||||
// this.raw_data.push(event)
|
||||
// }
|
||||
}
|
||||
)
|
||||
|
||||
this.changeDetectorRef.detach();
|
||||
/* 获取显示列 */
|
||||
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
|
||||
data => {
|
||||
@@ -127,125 +84,16 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
)
|
||||
/* 获取航班动态信息 */
|
||||
this.httpCilent.get('/assets/mock-data/airline-data.json').subscribe(
|
||||
this.httpCilent.get('/msgexchangeapi/all/flights').subscribe(
|
||||
data => {
|
||||
//解析数据
|
||||
data.forEach(element => {
|
||||
this.raw_data.push(JSON.parse(element.value));
|
||||
});
|
||||
this.raw_data = data.body;
|
||||
|
||||
let combined_linked_data = this.raw_data;
|
||||
//查找链接航班并将其组合成一条数据
|
||||
for (let i = 0; i < combined_linked_data.length; i++) {
|
||||
if (combined_linked_data[i]['MVIN'] === 'D') {
|
||||
if (combined_linked_data[i]['TAID']) {
|
||||
let index = combined_linked_data.findIndex(val => { return val['FLID'] === combined_linked_data[i]['TAID'] });
|
||||
if (index > -1) {
|
||||
combined_linked_data[i]['isLinked'] = true;
|
||||
combined_linked_data[i]['linkFlight'] = combined_linked_data[index];
|
||||
combined_linked_data.splice(index, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let combined_linked_data = this.dataHandle.findLinkFlights(data.body);
|
||||
combined_linked_data.forEach(element => {
|
||||
let row_flights = {};
|
||||
let render_flight = {};
|
||||
let render_pre_flight = {};
|
||||
let render_rea_flight = {};
|
||||
if (element['MVIN'] === 'A' && !element['isLinked']) {
|
||||
row_flights['preFlight'] = element;
|
||||
|
||||
for (let i = 0; i < this.col_lists.length; i++) {
|
||||
let key = this.col_lists[i]['COL_CODE']
|
||||
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](row_flights['preFlight']) : row_flights['preFlight'][key];
|
||||
}
|
||||
row_flights['renderFlight'] = render_flight;
|
||||
|
||||
} else if (element['MVIN'] === 'D' && !element['isLinked']) {
|
||||
row_flights['reaFlight'] = element;
|
||||
for (let i = 0; i < this.col_lists.length; i++) {
|
||||
let key = this.col_lists[i]['COL_CODE']
|
||||
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](row_flights['reaFlight']) : row_flights['reaFlight'][key];
|
||||
}
|
||||
row_flights['renderFlight'] = render_flight;
|
||||
|
||||
} else if (element['isLinked']) {
|
||||
row_flights['preFlight'] = element['linkFlight'];
|
||||
delete element['linkFlight'];
|
||||
delete element['isLinked'];
|
||||
row_flights['reaFlight'] = element;
|
||||
|
||||
for (let i = 0; i < this.col_lists.length; i++) {
|
||||
let key = this.col_lists[i]['COL_CODE']
|
||||
if (this.formatter.hasOwnProperty(key)) {
|
||||
let preHasValue = this.formatter[key](row_flights['preFlight']);
|
||||
let reaHasValue = this.formatter[key](row_flights['reaFlight']);
|
||||
if (preHasValue && !reaHasValue) {
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = preHasValue + ' / '
|
||||
} else {
|
||||
render_flight[key] = preHasValue;
|
||||
}
|
||||
} else if (!preHasValue && reaHasValue) {
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = ' / ' + reaHasValue
|
||||
} else {
|
||||
render_flight[key] = reaHasValue;
|
||||
}
|
||||
// render_flight[key] = reaHasValue;
|
||||
} else if (preHasValue && reaHasValue) {
|
||||
if (preHasValue === reaHasValue) {
|
||||
render_flight[key] = preHasValue
|
||||
} else {
|
||||
if (key === 'ERUT') {
|
||||
render_flight[key] = preHasValue.split(' - ').slice(0, -1).join(' - ') + ' - ' + reaHasValue;
|
||||
} else {
|
||||
render_flight[key] = preHasValue + ' / ' + reaHasValue;
|
||||
}
|
||||
// render_flight[key] = preHasValue + ' / ' + reaHasValue;
|
||||
}
|
||||
} else {
|
||||
render_flight[key] = '';
|
||||
}
|
||||
render_pre_flight[key] = preHasValue;
|
||||
render_rea_flight[key] = reaHasValue;
|
||||
} else {
|
||||
let preHasValue = row_flights['preFlight'][key];
|
||||
let reaHasValue = row_flights['reaFlight'][key]
|
||||
if (preHasValue && !reaHasValue) {
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = preHasValue + ' / '
|
||||
} else {
|
||||
render_flight[key] = preHasValue;
|
||||
}
|
||||
} else if (!preHasValue && reaHasValue) {
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = ' / ' + reaHasValue
|
||||
} else {
|
||||
render_flight[key] = reaHasValue;
|
||||
}
|
||||
} else if (preHasValue && reaHasValue) {
|
||||
if (preHasValue === reaHasValue) {
|
||||
render_flight[key] = preHasValue
|
||||
} else {
|
||||
render_flight[key] = preHasValue + ' / ' + reaHasValue;
|
||||
}
|
||||
} else {
|
||||
render_flight[key] = '';
|
||||
}
|
||||
// render_flight[key] = (row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key]);
|
||||
render_pre_flight[key] = preHasValue;
|
||||
render_rea_flight[key] = reaHasValue;
|
||||
}
|
||||
}
|
||||
row_flights['renderFlight'] = render_flight;
|
||||
row_flights['renderPreFlight'] = render_pre_flight;
|
||||
row_flights['renderReaFlight'] = render_rea_flight;
|
||||
}
|
||||
this.combined_data.push(row_flights)
|
||||
})
|
||||
let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists);
|
||||
this.combined_data.push(flights_item);
|
||||
});
|
||||
|
||||
//从基础数据服务中拿出部分基础数据
|
||||
this.terminals = this.basicDataService.terminal;
|
||||
@@ -255,17 +103,9 @@ export class MainComponent implements OnInit {
|
||||
this.airports = this.basicDataService.airport;
|
||||
|
||||
if (this.airports && this.airports.length > 0) {
|
||||
this.basicDataTransHandle();
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
if (this.airports && this.airports.length > 0) {
|
||||
|
||||
} else {
|
||||
const toastCfg = new ToastConfig(ToastType.ERROR, '', '基础数据获取失败!', 3000);
|
||||
this.toastService.toast(toastCfg);
|
||||
this.combined_data = this.dataHandle.basicDataTransHandle(this.combined_data, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||
this.doSequence(this.combined_data);
|
||||
}
|
||||
}, 5000);
|
||||
} else {
|
||||
this.basicDataService.terminal_subject.subscribe(
|
||||
val => this.terminals = val
|
||||
)
|
||||
@@ -281,11 +121,11 @@ export class MainComponent implements OnInit {
|
||||
this.basicDataService.airport_subject.subscribe(
|
||||
val => {
|
||||
this.airports = val;
|
||||
this.basicDataTransHandle();
|
||||
this.combined_data = this.dataHandle.basicDataTransHandle(this.combined_data, this.airports, this.citys, this.airlines, this.flightStatus);
|
||||
this.doSequence(this.combined_data);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
@@ -300,104 +140,12 @@ export class MainComponent implements OnInit {
|
||||
tableCont.addEventListener('scroll', scrollHandle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础数据转换
|
||||
*/
|
||||
basicDataTransHandle() {
|
||||
this.combined_data.forEach(item => {
|
||||
if (this.isArriFlight(item) || this.isDeptFlight(item)) {
|
||||
//航线处理
|
||||
let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
let erutChnArray = []
|
||||
for (let i = 0; i < erutCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutChnArray.push(erutCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderFlight']['ERUT'] = erutChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineIndex = this.airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
||||
item['renderFlight']['ALCD'] = this.airlines[airlineIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderFlight']['FTSS'] = this.flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc
|
||||
} else {
|
||||
//航线处理
|
||||
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
let erutLinkChnArray = []
|
||||
for (let i = 0; i < erutLinkCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutLinkChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutLinkChnArray.push(erutLinkCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderFlight']['ERUT'] = erutLinkChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineLinkIndex = this.airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
||||
item['renderFlight']['ALCD'] = this.airlines[airlineLinkIndex].airlineName;
|
||||
//运营状态处理
|
||||
let ftssLinkCodeArray = item['renderFlight']['FTSS'].split(' / ');
|
||||
let ftssChnArray = [];
|
||||
for (let i = 0; i < ftssLinkCodeArray.length; i++) {
|
||||
ftssChnArray.push(this.flightStatus.find(val => val.sttc === ftssLinkCodeArray[i]).stdc)
|
||||
}
|
||||
item['renderFlight']['FTSS'] = ftssChnArray.join(' / ');
|
||||
|
||||
//航线处理
|
||||
let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - ');
|
||||
let erutPreChnArray = []
|
||||
for (let i = 0; i < erutPreCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutPreChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutPreChnArray.push(erutPreCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderPreFlight']['ERUT'] = erutPreChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlinePreIndex = this.airlines.findIndex(val => val.airlineCode === item['renderPreFlight']['ALCD']);
|
||||
item['renderPreFlight']['ALCD'] = this.airlines[airlinePreIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderPreFlight']['FTSS'] = this.flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc
|
||||
|
||||
//航线处理
|
||||
let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - ');
|
||||
let erutReaChnArray = []
|
||||
for (let i = 0; i < erutReaCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
|
||||
let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId);
|
||||
erutReaChnArray.push(this.citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutReaChnArray.push(erutReaCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderReaFlight']['ERUT'] = erutReaChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineReaIndex = this.airlines.findIndex(val => val.airlineCode === item['renderReaFlight']['ALCD']);
|
||||
item['renderReaFlight']['ALCD'] = this.airlines[airlineReaIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderReaFlight']['FTSS'] = this.flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc
|
||||
}
|
||||
});
|
||||
this.doSequence(this.combined_data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 执行排序并渲染
|
||||
*/
|
||||
doSequence(sequenceData) {
|
||||
sequenceData.forEach(element => {
|
||||
element['ORDER'] = this.sequence(element);
|
||||
element['ORDER'] = this.orderHandle.sequence(element);
|
||||
})
|
||||
sequenceData.sort(function (a, b) {
|
||||
return (a['ORDER'] - b['ORDER']);
|
||||
@@ -408,31 +156,6 @@ export class MainComponent implements OnInit {
|
||||
this.operateSpinServiceService.hideSpin()
|
||||
}
|
||||
|
||||
/**
|
||||
* 复选框勾选事件
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新
|
||||
*/
|
||||
@@ -487,7 +210,7 @@ export class MainComponent implements OnInit {
|
||||
})
|
||||
//下拉框筛选
|
||||
filter_data = filter_data.filter(item => {
|
||||
if (this.isArriFlight(item)) {
|
||||
if (this.orderHandle.isArriFlight(item)) {
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
@@ -498,11 +221,10 @@ export class MainComponent implements OnInit {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return is_satis;
|
||||
} else if (this.isDeptFlight(item)) {
|
||||
} else if (this.orderHandle.isDeptFlight(item)) {
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
@@ -513,7 +235,6 @@ export class MainComponent implements OnInit {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return is_satis;
|
||||
@@ -529,7 +250,6 @@ export class MainComponent implements OnInit {
|
||||
pre_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (const key in filterItems) {
|
||||
@@ -541,7 +261,6 @@ export class MainComponent implements OnInit {
|
||||
rea_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,310 +416,6 @@ export class MainComponent implements OnInit {
|
||||
$("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
|
||||
}
|
||||
|
||||
/**
|
||||
* 行排序规则方法
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public TOP_1 = 1000000000000;
|
||||
public TOP_2 = 2000000000000;
|
||||
public TOP_3 = 3000000000000;
|
||||
public TOP_4 = 4000000000000;
|
||||
public TOP_5 = 5000000000000;
|
||||
public TOP_6 = 6000000000000;
|
||||
public TOP_7 = 7000000000000;
|
||||
public TOP_8 = 8000000000000;
|
||||
public TOP_9 = 9000000000000;
|
||||
public TOP_10 = 10000000000000;
|
||||
public TOP_11 = 11000000000000;
|
||||
public TOP_12 = 12000000000000;
|
||||
public TOP_13 = 13000000000000;
|
||||
public TOP_14 = 14000000000000;
|
||||
|
||||
public sequence(flight) {
|
||||
let dateTag: number = 10;
|
||||
let dateToCompare = new Date().getTime();
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) {
|
||||
if (this.isLinked(flight)) {
|
||||
if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_1;
|
||||
}
|
||||
else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_3;
|
||||
}
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_4;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) {
|
||||
if (this.getEstimatedDatetime(flight['preFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime();
|
||||
} else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
}
|
||||
dateTag = this.TOP_5;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_6;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_7;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_8;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_9;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) {
|
||||
if (this.isLinked(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_10;
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_11;
|
||||
}
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_12;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (this.isCancled(flight)) {
|
||||
if (this.isDeptFlight(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
} else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
}
|
||||
|
||||
dateTag = this.TOP_13;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
return this.TOP_14
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取航班实际时间
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public getActualDatetime(flight) {
|
||||
return flight['ACTT'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取航班预计时间
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public getEstimatedDatetime(flight) {
|
||||
return flight['ESTT']
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取航班计划时间
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public getScheduledDatetime(flight) {
|
||||
return flight['SODT']
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否是链接航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isLinked(flight) {
|
||||
if (flight['preFlight'] && flight['reaFlight']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否是纯离港航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDeptFlight(flight) {
|
||||
if (!flight['preFlight'] && flight['reaFlight']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否是纯到港航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isArriFlight(flight) {
|
||||
if (flight['preFlight'] && !flight['reaFlight']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否已经前站起飞
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isFlying(flight) {
|
||||
if (this.isArriFlight(flight) || this.isLinked(flight)) {
|
||||
if (flight['preFlight']['PADT']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否取消
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isCancled(flight) {
|
||||
if (this.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['CNCL']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['CNCL']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班)
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDelayed(flight) {
|
||||
if (this.isDeptFlight(flight) || this.isLinked(flight)) {
|
||||
if (flight['reaFlight']['DELY']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否已经执行完成
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDone(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (!this.getActualDatetime(flight['reaFlight'])) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
if (!this.getActualDatetime(flight['preFlight'])) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否开始登机
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public startBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (!flight['reaFlight']['BOTM']) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否正在登机中
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['BOTM'] && !(flight['reaFlight']['GTDT']['GCTM'])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否登机结束
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isOverBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 选中某行
|
||||
* @param i
|
||||
@@ -1015,7 +430,7 @@ export class MainComponent implements OnInit {
|
||||
* @param col_CODE
|
||||
*/
|
||||
getColor(col_CODE, flight) {
|
||||
if (this.isArriFlight(flight)) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (col_CODE === 'SODT') {
|
||||
if (flight['preFlight']['SODT']) {
|
||||
if (!flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
|
||||
@@ -1085,11 +500,11 @@ export class MainComponent implements OnInit {
|
||||
* @param flight
|
||||
*/
|
||||
getPosition(col_CODE, flight) {
|
||||
if (this.isDeptFlight(flight)) {
|
||||
if (this.orderHandle.isDeptFlight(flight)) {
|
||||
if (col_CODE === 'FLNO' || col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
|
||||
return 'text-right';
|
||||
}
|
||||
} else if (this.isLinked(flight)) {
|
||||
} else if (this.orderHandle.isLinked(flight)) {
|
||||
if (col_CODE === 'SODT' || col_CODE === 'ESTT' || col_CODE === 'ACTT') {
|
||||
if (!flight['renderPreFlight'][col_CODE] && flight['renderReaFlight'][col_CODE]) {
|
||||
return 'text-right';
|
||||
@@ -1099,4 +514,29 @@ export class MainComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 复选框勾选事件
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
import dateFormatter from '../../../utils/data-formatter';
|
||||
export class DynamicFlightOrder {
|
||||
|
||||
public TOP_1 = 1000000000000;
|
||||
public TOP_2 = 2000000000000;
|
||||
public TOP_3 = 3000000000000;
|
||||
public TOP_4 = 4000000000000;
|
||||
public TOP_5 = 5000000000000;
|
||||
public TOP_6 = 6000000000000;
|
||||
public TOP_7 = 7000000000000;
|
||||
public TOP_8 = 8000000000000;
|
||||
public TOP_9 = 9000000000000;
|
||||
public TOP_10 = 10000000000000;
|
||||
public TOP_11 = 11000000000000;
|
||||
public TOP_12 = 12000000000000;
|
||||
public TOP_13 = 13000000000000;
|
||||
public TOP_14 = 14000000000000;
|
||||
|
||||
/**
|
||||
* 获取航班实际时间
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public getActualDatetime(flight) {
|
||||
return flight['ACTT'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取航班预计时间
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public getEstimatedDatetime(flight) {
|
||||
return flight['ESTT']
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取航班计划时间
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public getScheduledDatetime(flight) {
|
||||
return flight['SODT']
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否是链接航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isLinked(flight) {
|
||||
if (flight['preFlight'] && flight['reaFlight']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否是纯离港航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDeptFlight(flight) {
|
||||
if (!flight['preFlight'] && flight['reaFlight']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否是纯到港航班
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isArriFlight(flight) {
|
||||
if (flight['preFlight'] && !flight['reaFlight']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否已经前站起飞
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isFlying(flight) {
|
||||
if (this.isArriFlight(flight) || this.isLinked(flight)) {
|
||||
if (flight['preFlight']['PADT']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否取消
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isCancled(flight) {
|
||||
if (this.isArriFlight(flight)) {
|
||||
if (flight['preFlight']['CNCL']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['CNCL']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班)
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDelayed(flight) {
|
||||
if (this.isDeptFlight(flight) || this.isLinked(flight)) {
|
||||
if (flight['reaFlight']['DELY']) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否已经执行完成
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isDone(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (!this.getActualDatetime(flight['reaFlight'])) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
if (!this.getActualDatetime(flight['preFlight'])) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否开始登机
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public startBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (!flight['reaFlight']['BOTM']) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断航班是否正在登机中
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['BOTM'] && !(flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM'])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断航班是否登机结束
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public isOverBoading(flight) {
|
||||
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
|
||||
if (flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 行排序规则方法
|
||||
* @param flight
|
||||
* @return
|
||||
*/
|
||||
public sequence(flight) {
|
||||
let dateTag: number = 10;
|
||||
let dateToCompare = new Date().getTime();
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) {
|
||||
if (this.isLinked(flight)) {
|
||||
if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_1;
|
||||
}
|
||||
else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_3;
|
||||
}
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_4;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) {
|
||||
if (this.getEstimatedDatetime(flight['preFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime();
|
||||
} else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
}
|
||||
dateTag = this.TOP_5;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_6;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_7;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_8;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_9;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) {
|
||||
if (this.isLinked(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_10;
|
||||
} else if (this.isArriFlight(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
dateTag = this.TOP_11;
|
||||
}
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) {
|
||||
dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime();
|
||||
dateTag = this.TOP_12;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
if (this.isCancled(flight)) {
|
||||
if (this.isDeptFlight(flight)) {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime();
|
||||
} else {
|
||||
dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime();
|
||||
}
|
||||
|
||||
dateTag = this.TOP_13;
|
||||
return dateToCompare + dateTag;
|
||||
}
|
||||
return this.TOP_14
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
import gctmFormatter from '../../../utils/gctm-formatter';
|
||||
import botmFormatter from '../../../utils/botm-formatter';
|
||||
import abdgFormatter from '../../../utils/abdg-formatter';
|
||||
import aotm_aFormatter from '../../../utils/aotm_a-formatter';
|
||||
import aotm_dFormatter from '../../../utils/aotm_d-formatter';
|
||||
import beltFormatter from '../../../utils/belt-formatter';
|
||||
import chkcFormatter from '../../../utils/chkc-formatter';
|
||||
import cctmFormatter from '../../../utils/cctm-formatter';
|
||||
import cotmFormatter from '../../../utils/cotm-formatter';
|
||||
import chtmOnFormatter from '../../../utils/chtm_on-formatter';
|
||||
import chtmOffFormatter from '../../../utils/chtm_off-formatter';
|
||||
import laclFormatter from '../../../utils/lacl-formatter';
|
||||
import chutFormatter from '../../../utils/chut-formatter';
|
||||
import acttFormatter from '../../../utils/actt-formatter';
|
||||
import psstFormatter from '../../../utils/psst-formatter';
|
||||
import esttFormatter from '../../../utils/estt-formatter';
|
||||
import mvinFormatter from '../../../utils/mvin-formatter';
|
||||
import erutFormatter from '../../../utils/erut-formatter';
|
||||
import flinFormatter from '../../../utils/flin-formatter';
|
||||
import sodtFormatter from '../../../utils/sodt-formatter';
|
||||
import gateFormatter from '../../../utils/gate-formatter';
|
||||
import padtFormatter from '../../../utils/padt-formatter';
|
||||
|
||||
import { DynamicFlightOrder } from './dynamic-flight-order';
|
||||
|
||||
export class FlightsDataHandle {
|
||||
public formatter = {
|
||||
'GCTM': gctmFormatter,
|
||||
'BOTM': botmFormatter,
|
||||
'ABDG': abdgFormatter,
|
||||
'AOTM_A': aotm_aFormatter,
|
||||
'AOTM_D': aotm_dFormatter,
|
||||
'BELT': beltFormatter,
|
||||
'CHKC': chkcFormatter,
|
||||
'CCTM': cctmFormatter,
|
||||
'COTM': cotmFormatter,
|
||||
'CHTM_ON': chtmOnFormatter,
|
||||
'CHTM_OFF': chtmOffFormatter,
|
||||
'LACL': laclFormatter,
|
||||
'CHUT': chutFormatter,
|
||||
'ACTT': acttFormatter,
|
||||
'PSST': psstFormatter,
|
||||
'ESTT': esttFormatter,
|
||||
'MVIN': mvinFormatter,
|
||||
'ERUT': erutFormatter,
|
||||
'FLIN': flinFormatter,
|
||||
'SODT': sodtFormatter,
|
||||
'GATE': gateFormatter,
|
||||
'PADT': padtFormatter
|
||||
}
|
||||
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
|
||||
|
||||
public findLinkFlights(raw_flights) {
|
||||
let combined_raw_flights: Array<any> = [];
|
||||
|
||||
for (let i = 0; i < raw_flights.length; i++) {
|
||||
if (raw_flights[i]['MVIN'] === 'D') {
|
||||
if (raw_flights[i]['TAID']) {
|
||||
let index = raw_flights.findIndex(val => { return val['FLID'] === raw_flights[i]['TAID'] });
|
||||
if (index > -1) {
|
||||
raw_flights[i]['isLinked'] = true;
|
||||
raw_flights[i]['linkFlight'] = raw_flights[index];
|
||||
if (!raw_flights[i]['linkFlight']['TAID']) {
|
||||
raw_flights[i]['linkFlight']['TAID'] = raw_flights[i]['TAID'];
|
||||
}
|
||||
raw_flights.splice(index, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
raw_flights.forEach(element => {
|
||||
let flights_item = {};
|
||||
if (element['MVIN'] === 'A' && !element['isLinked']) {
|
||||
flights_item['preFlight'] = element;
|
||||
} else if (element['MVIN'] === 'D' && !element['isLinked']) {
|
||||
flights_item['reaFlight'] = element;
|
||||
} else {
|
||||
flights_item['preFlight'] = element['linkFlight'];
|
||||
delete element['linkFlight'];
|
||||
delete element['isLinked'];
|
||||
flights_item['reaFlight'] = element;
|
||||
}
|
||||
|
||||
combined_raw_flights.push(flights_item);
|
||||
});
|
||||
|
||||
return combined_raw_flights;
|
||||
}
|
||||
|
||||
public flightsRenderTransfer(flights_item, col_lists) {
|
||||
let render_flight = {},
|
||||
render_pre_flight = {},
|
||||
render_rea_flight = {};
|
||||
|
||||
if (flights_item['preFlight'] && !flights_item['reaFlight']) {
|
||||
for (let i = 0; i < col_lists.length; i++) {
|
||||
let key = col_lists[i]['COL_CODE'];
|
||||
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](flights_item['preFlight']) : flights_item['preFlight'][key];
|
||||
}
|
||||
flights_item['renderFlight'] = render_flight;
|
||||
} else if (!flights_item['preFlight'] && flights_item['reaFlight']) {
|
||||
for (let i = 0; i < col_lists.length; i++) {
|
||||
let key = col_lists[i]['COL_CODE']
|
||||
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](flights_item['reaFlight']) : flights_item['reaFlight'][key];
|
||||
}
|
||||
flights_item['renderFlight'] = render_flight;
|
||||
} else {
|
||||
for (let i = 0; i < col_lists.length; i++) {
|
||||
let preHasValue, reaHasValue;
|
||||
let key = col_lists[i]['COL_CODE'];
|
||||
if (this.formatter.hasOwnProperty(key)) {
|
||||
preHasValue = this.formatter[key](flights_item['preFlight']);
|
||||
reaHasValue = this.formatter[key](flights_item['reaFlight']);
|
||||
} else {
|
||||
preHasValue = flights_item['preFlight'][key];
|
||||
reaHasValue = flights_item['reaFlight'][key];
|
||||
}
|
||||
|
||||
if (preHasValue && !reaHasValue) {
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = preHasValue + ' / ';
|
||||
} else {
|
||||
render_flight[key] = preHasValue;
|
||||
}
|
||||
} else if (!preHasValue && reaHasValue) {
|
||||
if (key === 'SODT' || key === 'ESTT' || key === 'ACTT') {
|
||||
render_flight[key] = ' / ' + reaHasValue;
|
||||
} else {
|
||||
render_flight[key] = reaHasValue;
|
||||
}
|
||||
} else if (preHasValue && reaHasValue) {
|
||||
if (preHasValue === reaHasValue) {
|
||||
render_flight[key] = preHasValue;
|
||||
} else {
|
||||
if (key === 'ERUT') {
|
||||
render_flight[key] = preHasValue.split(' - ').slice(0, -1).join(' - ') + ' - ' + reaHasValue;
|
||||
} else {
|
||||
render_flight[key] = preHasValue + ' / ' + reaHasValue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
render_flight[key] = '';
|
||||
}
|
||||
render_pre_flight[key] = preHasValue;
|
||||
render_rea_flight[key] = reaHasValue;
|
||||
}
|
||||
flights_item['renderFlight'] = render_flight;
|
||||
flights_item['renderPreFlight'] = render_pre_flight;
|
||||
flights_item['renderReaFlight'] = render_rea_flight;
|
||||
}
|
||||
|
||||
return flights_item;
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础数据转换
|
||||
*/
|
||||
basicDataTransHandle(combind_flights, airports, citys, airlines, flightStatus) {
|
||||
combind_flights.forEach(item => {
|
||||
if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) {
|
||||
//航线处理
|
||||
let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
let erutChnArray = []
|
||||
for (let i = 0; i < erutCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutChnArray.push(citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutChnArray.push(erutCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderFlight']['ERUT'] = erutChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
||||
item['renderFlight']['ALCD'] = airlines[airlineIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc
|
||||
} else {
|
||||
//航线处理
|
||||
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
let erutLinkChnArray = []
|
||||
for (let i = 0; i < erutLinkCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutLinkChnArray.push(citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutLinkChnArray.push(erutLinkCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderFlight']['ERUT'] = erutLinkChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineLinkIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
|
||||
item['renderFlight']['ALCD'] = airlines[airlineLinkIndex].airlineName;
|
||||
//运营状态处理
|
||||
let ftssLinkCodeArray = item['renderFlight']['FTSS'].split(' / ');
|
||||
let ftssChnArray = [];
|
||||
for (let i = 0; i < ftssLinkCodeArray.length; i++) {
|
||||
ftssChnArray.push(flightStatus.find(val => val.sttc === ftssLinkCodeArray[i]).stdc)
|
||||
}
|
||||
item['renderFlight']['FTSS'] = ftssChnArray.join(' / ');
|
||||
|
||||
//航线处理
|
||||
let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - ');
|
||||
let erutPreChnArray = []
|
||||
for (let i = 0; i < erutPreCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutPreChnArray.push(citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutPreChnArray.push(erutPreCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderPreFlight']['ERUT'] = erutPreChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlinePreIndex = airlines.findIndex(val => val.airlineCode === item['renderPreFlight']['ALCD']);
|
||||
item['renderPreFlight']['ALCD'] = airlines[airlinePreIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderPreFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc
|
||||
|
||||
//航线处理
|
||||
let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - ');
|
||||
let erutReaChnArray = []
|
||||
for (let i = 0; i < erutReaCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutReaChnArray.push(citys[cityIndex].cityNameChn);
|
||||
} catch (error) {
|
||||
erutReaChnArray.push(erutReaCodeArray[i]);
|
||||
}
|
||||
}
|
||||
item['renderReaFlight']['ERUT'] = erutReaChnArray.join(' - ');
|
||||
//航空公司处理
|
||||
let airlineReaIndex = airlines.findIndex(val => val.airlineCode === item['renderReaFlight']['ALCD']);
|
||||
item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName;
|
||||
//运营状态处理
|
||||
item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc
|
||||
}
|
||||
});
|
||||
return combind_flights;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import { filter } from 'rxjs/operators';
|
||||
})
|
||||
export class PagesComponent implements OnInit {
|
||||
public menuClose: boolean = false;
|
||||
public isSpinning: any = true;
|
||||
public isSpinning: any = false;
|
||||
menuData = [
|
||||
{
|
||||
"name": "航班动态",
|
||||
@@ -196,6 +196,9 @@ export class PagesComponent implements OnInit {
|
||||
private httpClient: HttpClientService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.operateSpinService.spinSubject.subscribe(
|
||||
val => this.isSpinning = val
|
||||
)
|
||||
this.basicDataService.loadBasicData();
|
||||
}
|
||||
|
||||
@@ -209,9 +212,7 @@ export class PagesComponent implements OnInit {
|
||||
this.selectActiveMenu(this.menuData, event['urlAfterRedirects'])
|
||||
});
|
||||
|
||||
this.operateSpinService.spinSubject.subscribe(
|
||||
val => this.isSpinning = val
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -75,8 +75,8 @@ export class DepartmentManagementComponent implements OnInit {
|
||||
treeSave(){
|
||||
if(this.treeSelectedChild){
|
||||
this.orgSeleted=this.treeSelectedChild;
|
||||
this.visible = false;
|
||||
this.orgSeletedBtn=false;
|
||||
// this.visible = false;
|
||||
// this.orgSeletedBtn=false;
|
||||
}else{
|
||||
//如果没有选择机构,提示请选择机构
|
||||
this.message.create('warning', `请选择所属机构!`,{ nzDuration: 2000 });
|
||||
@@ -85,15 +85,15 @@ export class DepartmentManagementComponent implements OnInit {
|
||||
//打开机构树抽屉
|
||||
open(): void {
|
||||
this.treeSelectedChild='';
|
||||
this.visible = true;
|
||||
// this.visible = true;
|
||||
}
|
||||
//关闭机构选择页面
|
||||
close(): void {
|
||||
this.visible = false;
|
||||
// this.visible = false;
|
||||
}
|
||||
//删除机构标签
|
||||
tagClose(event){
|
||||
this.orgSeletedBtn=true;
|
||||
// this.orgSeletedBtn=true;
|
||||
this.orgSeleted='';
|
||||
}
|
||||
//修改时查询该系统下的所有用户
|
||||
|
||||
@@ -10,7 +10,7 @@ export class WebsocketService {
|
||||
constructor() { }
|
||||
|
||||
dynamicsMessage() {
|
||||
let url = ("ws://" + window.location.host + "/v2/broker/?topics=topic2");
|
||||
let url = ("ws://" + window.location.host + "/v2/broker/?topics=schd,msg");
|
||||
|
||||
if (window.location.protocol === 'https:' && url.indexOf(INSECURE) === 0) {
|
||||
url = SECURE + url.substr(INSECURE.length);
|
||||
@@ -22,7 +22,7 @@ export class WebsocketService {
|
||||
console.log('websocket was connected...')
|
||||
}
|
||||
this.websocket.onmessage = (event) => {
|
||||
ob.next(event.data)
|
||||
ob.next(event)
|
||||
}
|
||||
this.websocket.onerror = () => {
|
||||
ob.error("连接失败")
|
||||
|
||||
Reference in New Issue
Block a user