航班信息显示转换

This commit is contained in:
zhouyuejun
2018-11-21 18:55:57 +08:00
parent 526cfe1251
commit 4582b465ee
36 changed files with 862 additions and 401 deletions
+13 -6
View File
@@ -4,6 +4,8 @@ import { Subject, forkJoin, zip } from 'rxjs'
@Injectable()
export class BasicDataService {
public flightStatus:Array<any>;
public flightStatus_subject = new Subject<any>();
public checkin_group: Array<any>;
public checkin_group_subject = new Subject<any>();
public gate: Array<any>;
@@ -36,7 +38,7 @@ export class BasicDataService {
) { }
loadBasicData() {
console.log('---')
let flightStatusHttp = this.httpClient.get('/adminapi/basicdata/sysFlightStatus');
let checkinGroupHttp = this.httpClient.get('/adminapi/basicdata/checkinGroups');
let gateHttp = this.httpClient.get('/adminapi/basicdata/ormsGates');
let terminalHttp = this.httpClient.get('/adminapi/basicdata/ormsTerminals');
@@ -51,6 +53,7 @@ export class BasicDataService {
let terminalAreaHttp = this.httpClient.get('/adminapi/basicdata/ormsTerminalareas');
let airlineHttp = this.httpClient.get('/adminapi/basicdata/sysAirlines');
zip(
flightStatusHttp,
checkinGroupHttp,
gateHttp,
terminalHttp,
@@ -66,6 +69,7 @@ export class BasicDataService {
airlineHttp
).subscribe(
([
flightStatusRes,
checkinGroupRes,
gateRes,
terminalRes,
@@ -80,12 +84,15 @@ export class BasicDataService {
terminalAreaRes,
airlineRes
]) => {
console.log('---')
this.flightStatus = flightStatusRes.body;
this.flightStatus_subject.next(flightStatusRes.body);
this.checkin_group = checkinGroupRes.body;
this.checkin_group_subject.next(checkinGroupRes.body);
this.gate = gateRes.body;
this.gate_subject.next(gateRes.body);
this.terminal = terminalRes.body;
this.terminal_area_subject.next(terminalRes.body);
this.terminal_subject.next(terminalRes.body);
this.chut = chutRes.body;
this.chut_subject.next(chutRes.body);
this.stand = standRes.body;
@@ -94,10 +101,6 @@ export class BasicDataService {
this.carousel_subject.next(carouselRes.body);
this.checkin_desk = checkinDeskRes.body;
this.checkin_desk_subject.next(checkinDeskRes.body);
this.airport = airportRes.body;
this.airport_subject.next(airportRes.body);
this.city = cityRes.body;
this.city_subject.next(cityRes.body);
this.aircraft_type = aircraftTypeRes.body;
this.aircraft_type_subject.next(aircraftTypeRes.body);
this.aircraft = aircraftRes.body;
@@ -106,6 +109,10 @@ export class BasicDataService {
this.terminal_area_subject.next(terminalAreaRes.body);
this.airline = airlineRes.body;
this.airline_subject.next(airlineRes.body);
this.city = cityRes.body;
this.city_subject.next(cityRes.body);
this.airport = airportRes.body;
this.airport_subject.next(airportRes.body);
}
)
}
+4 -3
View File
@@ -3,8 +3,9 @@
<div class="search-filter mb-3">
<div class="first-condition row">
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
<select class="mr-4 form-control" name="" id="">
<select [(ngModel)]="SEL_COL" class="mr-4 form-control" name="" id="">
<option value="">选择列名</option>
<option *ngFor="let airline_col of col_lists" [value]="airline_col.COL_CODE">{{airline_col.COL_CN}}</option>
</select>
<label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
@@ -29,6 +30,7 @@
<label for="">航空公司:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.ALCD" class="form-control">
<option value=""></option>
<option *ngFor="let airline of airlines" [value]="airline.airlineCodeIata">{{airline.airlineName}}</option>
</select>
</div>
<div class="input-container mr-4">
@@ -75,8 +77,7 @@
<label for="">航站楼:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.TRML" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option>
<option value="T1">T1</option>
<option value="T2">T2</option>
<option *ngFor="let terminal of terminals" [value]="terminal.terminalCode">{{terminal.terminalName}}</option>
</select>
</div>
<div class="input-container mr-4">
+255 -106
View File
@@ -5,10 +5,31 @@ import { HttpClientService } from '../../services/http-client.service';
import { BasicDataService } from '../basic-data-service'
import dateFormatter from '../../utils/data-formatter';
import routeType from '../../utils/route-type';
import flightType from '../../utils/flight-type';
import arriDept from '../../utils/arri-dept';
import { HttpParams } from '@angular/common/http';
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 * as $ from 'jquery';
@Component({
@@ -25,19 +46,10 @@ export class MainComponent implements OnInit {
) { }
//各项基础数据
public checkin_group: Array<any>;
public gate: Array<any>;
public terminal: Array<any>;
public chut: Array<any>;
public stand: Array<any>;
public carousel: Array<any>;
public checkin_desk: Array<any>;
public airport: Array<any>;
public city: Array<any>;
public aircraft_type: Array<any>;
public aircraft: Array<any>;
public terminal_area: Array<any>;
public airline: Array<any>;
public flightStatus: Array<any>;
public airports: Array<any>;
public citys: Array<any>;;
public airlines: Array<any>;
public raw_data: Array<object> = []; //原始数据,即航班计划
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
@@ -48,24 +60,32 @@ export class MainComponent implements OnInit {
public row_state: any = { renderFlight: {} };
public formatter = {
'MVIN': {
'A': '到达',
'D': '出发',
'DF': '其他'
},
'FLIN': {
'D': '国内',
'I': '国际',
'M': '混合',
'R': '地区',
'DF': '其他'
},
'SODT': dateFormatter,
'ESTT': dateFormatter,
'ACTT': dateFormatter
'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.getBasicData()
this.changeDetectorRef.detach();
/* 获取显示列 */
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
@@ -85,8 +105,6 @@ export class MainComponent implements OnInit {
});
let combined_linked_data = this.raw_data;
// this.combined_data = this.raw_data
//查找链接航班并将其组合成一条数据
for (let i = 0; i < combined_linked_data.length; i++) {
if (combined_linked_data[i]['MVIN'] === 'D') {
@@ -111,7 +129,7 @@ export class MainComponent implements OnInit {
for (let i = 0; i < this.col_lists.length; i++) {
let key = this.col_lists[i]['COL_CODE']
render_flight[key] = typeof (this.formatter[key]) === 'function' ? this.formatter[key](row_flights['preFlight'][key], 1) : this.formatter[key] ? this.formatter[key][row_flights['preFlight'][key]] : row_flights['preFlight'][key];
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](row_flights['preFlight']) : row_flights['preFlight'][key];
}
row_flights['renderFlight'] = render_flight;
@@ -119,7 +137,7 @@ export class MainComponent implements OnInit {
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] = typeof (this.formatter[key]) === 'function' ? this.formatter[key](row_flights['reaFlight'][key], 1) : this.formatter[key] ? this.formatter[key][row_flights['reaFlight'][key]] : row_flights['reaFlight'][key];
render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](row_flights['reaFlight']) : row_flights['reaFlight'][key];
}
row_flights['renderFlight'] = render_flight;
@@ -132,19 +150,47 @@ export class MainComponent implements OnInit {
for (let i = 0; i < this.col_lists.length; i++) {
let key = this.col_lists[i]['COL_CODE']
if (this.formatter.hasOwnProperty(key)) {
if (typeof (this.formatter[key]) === 'function') {
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key](row_flights['preFlight'][key], 1)) : (this.formatter[key](row_flights['preFlight'][key], 1) + '/' + this.formatter[key](row_flights['reaFlight'][key], 1));
render_pre_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1);
render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1);
let preHasValue = this.formatter[key](row_flights['preFlight']);
let reaHasValue = this.formatter[key](row_flights['reaFlight']);
if (preHasValue && !reaHasValue) {
render_flight[key] = preHasValue;
} else if (!preHasValue && 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] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key][row_flights['preFlight'][key]]) : (this.formatter[key][row_flights['preFlight'][key]] + '/' + this.formatter[key][row_flights['reaFlight'][key]]);
render_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]];
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
render_flight[key] = '';
}
render_pre_flight[key] = preHasValue;
render_rea_flight[key] = reaHasValue;
} else {
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (row_flights['preFlight'][key]) : (row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key]);
render_pre_flight[key] = row_flights['preFlight'][key];
render_rea_flight[key] = row_flights['reaFlight'][key];
let preHasValue = row_flights['preFlight'][key];
let reaHasValue = row_flights['reaFlight'][key]
if (preHasValue && !reaHasValue) {
render_flight[key] = preHasValue;
} else if (!preHasValue && reaHasValue) {
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;
@@ -154,7 +200,32 @@ export class MainComponent implements OnInit {
this.combined_data.push(row_flights)
})
this.doSequence(this.combined_data);
//从基础数据服务中拿出部分基础数据
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) {
this.basicDataTransHandle();
} else {
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;
this.basicDataTransHandle();
}
);
}
}
)
@@ -172,59 +243,138 @@ export class MainComponent implements OnInit {
/**
* 获取基础数据
*/
getBasicData() {
this.checkin_group = this.basicDataService.checkin_group;
this.basicDataService.checkin_group_subject.subscribe(
val => this.checkin_group = val
);
this.gate = this.basicDataService.gate;
this.basicDataService.gate_subject.subscribe(
val => this.gate = val
);
this.terminal = this.basicDataService.terminal;
this.basicDataService.terminal_subject.subscribe(
val => this.terminal = val
);
this.chut = this.basicDataService.chut;
this.basicDataService.chut_subject.subscribe(
val => this.chut = val
);
this.stand = this.basicDataService.stand;
this.basicDataService.stand_subject.subscribe(
val => this.stand = val
);
this.carousel = this.basicDataService.carousel;
this.basicDataService.carousel_subject.subscribe(
val => this.carousel = val
);
this.checkin_desk = this.basicDataService.checkin_desk;
this.basicDataService.checkin_desk_subject.subscribe(
val => this.checkin_desk = val
);
this.airport = this.basicDataService.airport;
this.basicDataService.airport_subject.subscribe(
val => this.airport = val
);
this.city = this.basicDataService.city;
this.basicDataService.city_subject.subscribe(
val => this.city = val
);
this.aircraft_type = this.basicDataService.aircraft_type;
this.basicDataService.aircraft_type_subject.subscribe(
val => this.aircraft_type = val
);
this.aircraft = this.basicDataService.aircraft;
this.basicDataService.aircraft_subject.subscribe(
val => this.aircraft = val
);
this.terminal_area = this.basicDataService.terminal_area;
this.basicDataService.terminal_area_subject.subscribe(
val => this.terminal_area = val
);
this.airline = this.basicDataService.airline;
this.basicDataService.airline_subject.subscribe(
val => this.airline = val
);
// getBasicData() {
// this.checkin_group = this.basicDataService.checkin_group;
// this.basicDataService.checkin_group_subject.subscribe(
// val => this.checkin_group = val
// );
// this.gate = this.basicDataService.gate;
// this.basicDataService.gate_subject.subscribe(
// val => this.gate = val
// );
// this.terminals = this.basicDataService.terminal;
// this.basicDataService.terminal_subject.subscribe(
// val => {
// this.terminals = val;
// this.changeDetectorRef.detectChanges();
// }
// );
// this.chut = this.basicDataService.chut;
// this.basicDataService.chut_subject.subscribe(
// val => this.chut = val
// );
// this.stand = this.basicDataService.stand;
// this.basicDataService.stand_subject.subscribe(
// val => this.stand = val
// );
// this.carousel = this.basicDataService.carousel;
// this.basicDataService.carousel_subject.subscribe(
// val => this.carousel = val
// );
// this.checkin_desk = this.basicDataService.checkin_desk;
// this.basicDataService.checkin_desk_subject.subscribe(
// val => this.checkin_desk = val
// );
// this.airports = this.basicDataService.airport;
// this.basicDataService.airport_subject.subscribe(
// val => this.airports = val
// );
// this.citys = this.basicDataService.city;
// this.basicDataService.city_subject.subscribe(
// val => this.citys = val
// );
// this.aircraft_type = this.basicDataService.aircraft_type;
// this.basicDataService.aircraft_type_subject.subscribe(
// val => this.aircraft_type = val
// );
// this.aircraft = this.basicDataService.aircraft;
// this.basicDataService.aircraft_subject.subscribe(
// val => this.aircraft = val
// );
// this.terminal_area = this.basicDataService.terminal_area;
// this.basicDataService.terminal_area_subject.subscribe(
// val => this.terminal_area = val
// );
// this.airlines = this.basicDataService.airline;
// this.basicDataService.airline_subject.subscribe(
// val => {
// this.airlines = val;
// this.changeDetectorRef.detectChanges();
// }
// );
// this.changeDetectorRef.detectChanges();
// }
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++) {
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);
}
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++) {
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);
}
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++) {
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);
}
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++) {
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);
}
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);
}
@@ -272,7 +422,7 @@ export class MainComponent implements OnInit {
if (this.FLT_POS === 1) {
this.selectChange()
} else {
this.selectChange()
// this.selectChange()
this.inputPosition(this.render_data)
}
}
@@ -364,7 +514,6 @@ export class MainComponent implements OnInit {
} else {
this.render_data = filter_data;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
// this.inputPosition(this.render_data);
this.changeDetectorRef.detectChanges();
}
}
@@ -773,7 +922,7 @@ export class MainComponent implements OnInit {
*/
public isBoading(flight) {
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) {
if (flight['reaFlight']['BOTM'] && !(flight['reaFlight']['GTDT']['GCTM'])) {
return true;
} else {
return false;
@@ -791,10 +940,10 @@ export class MainComponent implements OnInit {
*/
public isOverBoading(flight) {
if (this.isLinked(flight) || this.isDeptFlight(flight)) {
if (!flight['GCTM']) {
return false;
} else {
if (flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM']) {
return true;
} else {
return false;
}
} else {
return false;