颜色配置处理

This commit is contained in:
zhouyuejun
2018-12-15 10:30:38 +08:00
parent 05cb9674e7
commit ea742a9d36
5 changed files with 288 additions and 100 deletions
+7
View File
@@ -4,6 +4,8 @@ import { Subject, forkJoin, zip } from 'rxjs'
@Injectable() @Injectable()
export class BasicDataService { export class BasicDataService {
public flightTypes:Array<any>;
public flightTypes_subject = new Subject<any>();
public flightStatus:Array<any>; public flightStatus:Array<any>;
public flightStatus_subject = new Subject<any>(); public flightStatus_subject = new Subject<any>();
public checkin_group: Array<any>; public checkin_group: Array<any>;
@@ -46,6 +48,7 @@ export class BasicDataService {
) { } ) { }
loadBasicData() { loadBasicData() {
let flightTypesHttp = this.httpClient.get('/adminapi/basicdata/sysFlightTypes');
let flightStatusHttp = this.httpClient.get('/adminapi/basicdata/sysFlightStatus'); let flightStatusHttp = this.httpClient.get('/adminapi/basicdata/sysFlightStatus');
let checkinGroupHttp = this.httpClient.get('/adminapi/basicdata/checkinGroups'); let checkinGroupHttp = this.httpClient.get('/adminapi/basicdata/checkinGroups');
let gateHttp = this.httpClient.get('/adminapi/basicdata/ormsGates'); let gateHttp = this.httpClient.get('/adminapi/basicdata/ormsGates');
@@ -65,6 +68,7 @@ export class BasicDataService {
let airportGroupsHttp = this.httpClient.get('/adminapi/basicdata/sysAirportGroups'); let airportGroupsHttp = this.httpClient.get('/adminapi/basicdata/sysAirportGroups');
let airlineGroupHttp = this.httpClient.get('/adminapi/basicdata/sysAirlineGroup'); let airlineGroupHttp = this.httpClient.get('/adminapi/basicdata/sysAirlineGroup');
zip( zip(
flightTypesHttp,
flightStatusHttp, flightStatusHttp,
checkinGroupHttp, checkinGroupHttp,
gateHttp, gateHttp,
@@ -85,6 +89,7 @@ export class BasicDataService {
airlineGroupHttp airlineGroupHttp
).subscribe( ).subscribe(
([ ([
flightTypesRes,
flightStatusRes, flightStatusRes,
checkinGroupRes, checkinGroupRes,
gateRes, gateRes,
@@ -104,6 +109,8 @@ export class BasicDataService {
airportGroupRes, airportGroupRes,
airlineGroupRes airlineGroupRes
]) => { ]) => {
this.flightTypes = flightTypesRes.body;
this.flightTypes_subject.next(flightTypesRes.body)
this.flightStatus = flightStatusRes.body; this.flightStatus = flightStatusRes.body;
this.flightStatus_subject.next(flightStatusRes.body); this.flightStatus_subject.next(flightStatusRes.body);
this.checkin_group = checkinGroupRes.body; this.checkin_group = checkinGroupRes.body;
+5 -8
View File
@@ -5,7 +5,7 @@
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10"> <div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
<select [(ngModel)]="SEL_COL" class="mr-4 form-control" name="" id=""> <select [(ngModel)]="SEL_COL" class="mr-4 form-control" name="" id="">
<option value="">选择列名</option> <option value="">选择列名</option>
<option *ngFor="let airline_col of col_lists" [value]="airline_col.COL_CODE">{{airline_col.COL_CN}}</option> <option *ngFor="let airline_col of render_col_lists" [value]="airline_col.COL_CODE">{{airline_col.COL_CN}}</option>
</select> </select>
<label class="radio-inline custom-radio nowrap mr-4"> <label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position"> <input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
@@ -44,10 +44,7 @@
<label for="">航班类别:&nbsp;&nbsp;</label> <label for="">航班类别:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.FLTY" (ngModelChange)="selectChange()" class="form-control"> <select [(ngModel)]="filterItems.FLTY" (ngModelChange)="selectChange()" class="form-control">
<option value=""></option> <option value=""></option>
<option value="">客机</option> <option *ngFor="let type of flightTypeSelections" [value]="type.flightTypeCode">{{type.flightTypeNameCn}}</option>
<option value="">货机</option>
<option value="">军用</option>
<option value="">VIP</option>
</select> </select>
</div> </div>
<div class="input-container mr-4"> <div class="input-container mr-4">
@@ -138,7 +135,7 @@
<tr> <tr>
<th>序号</th> <th>序号</th>
<th>重要提示</th> <th>重要提示</th>
<th *ngFor="let airline_col of col_lists">{{airline_col.COL_CN}}</th> <th *ngFor="let airline_col of render_col_lists">{{airline_col.COL_CN}}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -155,8 +152,8 @@
<img class="mr-2" *ngIf="getCancleNotes(airline_row)" src="/assets/images/important-notes/cancle.png" alt=""> <img class="mr-2" *ngIf="getCancleNotes(airline_row)" src="/assets/images/important-notes/cancle.png" alt="">
<img class="mr-2" *ngIf="getStopoverNotes(airline_row)" src="/assets/images/important-notes/stopover.png" alt=""> <img class="mr-2" *ngIf="getStopoverNotes(airline_row)" src="/assets/images/important-notes/stopover.png" alt="">
</td> </td>
<td *ngFor="let airline_col of col_lists" [ngClass]="getPosition(airline_col.COL_CODE,airline_row)" <td *ngFor="let airline_col of render_col_lists" [ngClass]="getPosition(airline_col.COL_CODE,airline_row)"
[ngStyle]="{'background-color':getColor(airline_col.COL_CODE,airline_row)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td> [ngStyle]="getColor(airline_col.COL_CODE,airline_row)">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
+58 -74
View File
@@ -11,6 +11,7 @@ import { WebsocketService } from '../../services/websocket.service';
import { DynamicFlightOrder } from './utils/dynamic-flight-order'; import { DynamicFlightOrder } from './utils/dynamic-flight-order';
import { FlightsDataHandle } from './utils/flights-data-handle'; import { FlightsDataHandle } from './utils/flights-data-handle';
import { CellColorHandle } from './utils/cell-color-handle';
import dateFormatter from '../../utils/data-formatter'; import dateFormatter from '../../utils/data-formatter';
@@ -34,6 +35,7 @@ export class MainComponent implements OnInit {
} }
public orderHandle = new DynamicFlightOrder(); public orderHandle = new DynamicFlightOrder();
public dataHandle = new FlightsDataHandle(); public dataHandle = new FlightsDataHandle();
public cellColorHandle = new CellColorHandle();
public tabClose: boolean = true; public tabClose: boolean = true;
@@ -41,6 +43,7 @@ export class MainComponent implements OnInit {
public dynamicMessageArray: Array<any> = []; public dynamicMessageArray: Array<any> = [];
//各项基础数据 //各项基础数据
public flightTypes: Array<any>;
public terminals: Array<any>; public terminals: Array<any>;
public flightStatus: Array<any>; public flightStatus: Array<any>;
public airports: Array<any>; public airports: Array<any>;
@@ -55,6 +58,8 @@ export class MainComponent implements OnInit {
public render_data: Array<object> = []; //显示数据,即需要显示的数据 public render_data: Array<object> = []; //显示数据,即需要显示的数据
public col_lists: Array<object>; //列数据 public col_lists: Array<object>; //列数据
public render_col_lists: Array<object>;
public airline_color: Array<object> = []; public airline_color: Array<object> = [];
public row_state: any = { renderFlight: {} }; public row_state: any = { renderFlight: {} };
@@ -87,13 +92,17 @@ export class MainComponent implements OnInit {
} }
) )
/* 获取显示列 */ /* 获取用户设置 */
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe( this.httpCilent.get('/adminapi/settings/uisettings').subscribe(
data => { data => {
data.sort(function (a, b) { data.body.forEach(element => {
return (a['COL_ORDER'] - b['COL_ORDER']); if (element.groupCode === 'userSettingCol') {
this.col_lists = JSON.parse(element.settingContent).allCols;
this.render_col_lists = JSON.parse(element.settingContent).targetList;
} else if (element.groupCode === 'userSettingColor') {
this.airline_color = JSON.parse(element.settingContent);
}
}) })
this.col_lists = data;
} }
) )
//获取航班动态信息 //获取航班动态信息
@@ -109,6 +118,7 @@ export class MainComponent implements OnInit {
}); });
//从基础数据服务中拿出部分基础数据 //从基础数据服务中拿出部分基础数据
this.flightTypes = this.basicDataService.flightTypes;
this.terminals = this.basicDataService.terminal; this.terminals = this.basicDataService.terminal;
this.flightStatus = this.basicDataService.flightStatus; this.flightStatus = this.basicDataService.flightStatus;
this.airlines = this.basicDataService.airline; this.airlines = this.basicDataService.airline;
@@ -118,11 +128,14 @@ export class MainComponent implements OnInit {
if (this.airports && this.airports.length > 0) { if (this.airports && this.airports.length > 0) {
let combined_data = [] let combined_data = []
this.combined_data.forEach(item => { this.combined_data.forEach(item => {
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus)); combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus, this.flightTypes));
}) })
this.combined_data = combined_data; this.combined_data = combined_data;
this.doSequence(this.combined_data); this.doSequence(this.combined_data);
} else { } else {
this.basicDataService.flightTypes_subject.subscribe(
val => this.flightTypes = val
)
this.basicDataService.terminal_subject.subscribe( this.basicDataService.terminal_subject.subscribe(
val => this.terminals = val val => this.terminals = val
) )
@@ -140,7 +153,7 @@ export class MainComponent implements OnInit {
this.airports = val; this.airports = val;
let combined_data = [] let combined_data = []
this.combined_data.forEach(item => { this.combined_data.forEach(item => {
combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus)); combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus, this.flightTypes));
}) })
this.combined_data = combined_data; this.combined_data = combined_data;
this.doSequence(this.combined_data); this.doSequence(this.combined_data);
@@ -176,6 +189,11 @@ export class MainComponent implements OnInit {
this.airlinesSelections.push(this.airlines[index]); this.airlinesSelections.push(this.airlines[index]);
} }
if (this.flightTypeSelections.findIndex(flightType => flightType.flightTypeCode === message['FLTY']) === -1) {
let index = this.flightTypes.findIndex(val => val.flightTypeCode === message['FLTY']);
this.flightTypeSelections.push(this.flightTypes[index]);
}
let dynamicHandleData = this.dataHandle.dynamicMessageHandle( let dynamicHandleData = this.dataHandle.dynamicMessageHandle(
message, message,
this.combined_data, this.combined_data,
@@ -186,7 +204,9 @@ export class MainComponent implements OnInit {
this.LAST_SEL_COL, this.LAST_SEL_COL,
this.airports, this.airports,
this.citys, this.citys,
this.airlines, this.flightStatus this.airlines,
this.flightStatus,
this.flightTypes
) )
this.combined_data = dynamicHandleData.combined_data; this.combined_data = dynamicHandleData.combined_data;
@@ -218,6 +238,10 @@ export class MainComponent implements OnInit {
let index = this.airlines.findIndex(val => val.airlineCodeIata === element['ALCD']); let index = this.airlines.findIndex(val => val.airlineCodeIata === element['ALCD']);
this.airlinesSelections.push(this.airlines[index]); this.airlinesSelections.push(this.airlines[index]);
} }
if (this.flightTypeSelections.findIndex(flightType => flightType.flightTypeCode === element['FLTY']) === -1) {
let index = this.flightTypes.findIndex(val => val.flightTypeCode === element['FLTY']);
this.flightTypeSelections.push(this.flightTypes[index]);
}
}) })
combined_data.forEach(element => { combined_data.forEach(element => {
@@ -242,14 +266,17 @@ export class MainComponent implements OnInit {
* 刷新 * 刷新
*/ */
refresh() { refresh() {
let testss = this.render_data.reverse(); // let testss = this.render_data.reverse();
let tstt = []; // let tstt = [];
testss.forEach(element => { // testss.forEach(element => {
tstt.push(Object.assign({}, element)) // tstt.push(Object.assign({}, element))
}) // })
this.render_data = testss; // this.render_data = testss;
this.changeDetectorRef.detectChanges(); // this.changeDetectorRef.detectChanges();
const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '登录成功!', 3000);
this.toastService.toast(toastCfg);
} }
@@ -552,69 +579,26 @@ export class MainComponent implements OnInit {
* 获取当前单元格颜色 * 获取当前单元格颜色
* @param col_CODE * @param col_CODE
*/ */
public colorFormatter = {
'RENO': this.cellColorHandle.reno.bind(this.cellColorHandle),
'ACTT': this.cellColorHandle.actt.bind(this.cellColorHandle),
'ESTT': this.cellColorHandle.estt.bind(this.cellColorHandle),
'SODT': this.cellColorHandle.sodt.bind(this.cellColorHandle),
'PADT': this.cellColorHandle.padt.bind(this.cellColorHandle),
'PSST': this.cellColorHandle.psst.bind(this.cellColorHandle),
'COTM': this.cellColorHandle.cotm.bind(this.cellColorHandle),
'CCTM': this.cellColorHandle.cctm.bind(this.cellColorHandle),
'BOTM': this.cellColorHandle.botm.bind(this.cellColorHandle),
'GCTM': this.cellColorHandle.gctm.bind(this.cellColorHandle)
}
getColor(col_CODE, flight) { getColor(col_CODE, flight) {
if (this.orderHandle.isArriFlight(flight)) { let index = this.airline_color.findIndex(color => color['COL_CODE'] === col_CODE)
if (col_CODE === 'SODT') { if (index > -1) {
if (flight['preFlight']['SODT']) { let styles = this.colorFormatter[col_CODE](flight, this.airline_color[index]);
if (!flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) { return styles;
return 'rgb(0,255,255)';
} else { } else {
return null; return null;
} }
} else {
return null;
}
} else if (col_CODE === 'ESTT') {
if (flight['preFlight']['ESTT']) {
if (!flight['preFlight']['ACTT']) {
return 'rgb(255,207,156)';
} else {
return null;
}
} else {
return null;
}
} else if (col_CODE === 'ACTT') {
if (flight['preFlight']['ACTT']) {
return 'rgb(148,207,255)';
} else {
return null;
}
} else {
return null;
}
} else {
if (col_CODE === 'SODT') {
if (flight['reaFlight']['SODT']) {
if (!flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
return 'rgb(0,255,255)';
} else {
return null;
}
} else {
return null;
}
} else if (col_CODE === 'ESTT') {
if (flight['reaFlight']['ESTT']) {
if (!flight['reaFlight']['ACTT']) {
return 'rgb(255,207,156)';
} else {
return null;
}
} else {
return null;
}
} else if (col_CODE === 'ACTT') {
if (flight['reaFlight']['ACTT']) {
return 'rgb(148,207,255)';
} else {
return null;
}
} else {
return null;
}
}
} }
/** /**
@@ -0,0 +1,185 @@
import { DynamicFlightOrder } from './dynamic-flight-order';
export class CellColorHandle {
public orderHandle = new DynamicFlightOrder();
public reno(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['RENO'] && flight['preFlight']['RENO'].indexOf('(') > 0) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['RENO'] && flight['reaFlight']['RENO'].indexOf('(') > 0) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
} else {
if ((flight['preFlight']['RENO'] && flight['preFlight']['RENO'].indexOf('(') > 0) || (flight['reaFlight']['RENO'] && flight['reaFlight']['RENO'].indexOf('(') > 0)) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
}
}
public actt(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
} else {
if (flight['reaFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
}
}
public estt(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
} else {
if (flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
}
}
public sodt(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['SODT'] && !flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
} else {
if (flight['reaFlight']['SODT'] && !flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
};
} else {
return null;
}
}
}
public padt(flight, colorSetting) {
if (this.orderHandle.isArriFlight(flight)) {
if (flight['preFlight']['PADT'] && flight['preFlight']['PADT'].indexOf('(') > 0) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
} else if (this.orderHandle.isDeptFlight(flight)) {
if (flight['reaFlight']['PADT'] && flight['reaFlight']['PADT'].indexOf('(') > 0) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
} else {
if ((flight['preFlight']['PADT'] && flight['preFlight']['PADT'].indexOf('(') > 0) || (flight['reaFlight']['PADT'] && flight['reaFlight']['PADT'].indexOf('(') > 0)) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return null;
}
}
}
public psst(flight, colorSetting) {
}
public cotm(flight, colorSetting) {
if (flight['renderFlight']['COTM'] && !flight['renderFlight']['CCTM']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return false;
}
}
public cctm(flight, colorSetting) {
if (flight['renderFlight']['CCTM']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return false;
}
}
public botm(flight, colorSetting) {
if (flight['renderFlight']['BOTM'] && !flight['renderFlight']['GCTM']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return false;
}
}
public gctm(flight, colorSetting) {
if (flight['renderFlight']['GCTM']) {
return {
'background-color': colorSetting.COL_BG_COLOR,
'color': colorSetting.COL_COLOR
}
} else {
return false;
}
}
}
+32 -17
View File
@@ -160,7 +160,7 @@ export class FlightsDataHandle {
return flights_item; return flights_item;
} }
public basicDataTransHandle(item, airports, citys, airlines, flightStatus) { public basicDataTransHandle(item, airports, citys, airlines, flightStatus, flightTypes) {
if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) { if (this.orderHandle.isArriFlight(item) || this.orderHandle.isDeptFlight(item)) {
//航线处理 //航线处理
let erutCodeArray = item['renderFlight']['ERUT'].split(' - '); let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
@@ -179,7 +179,9 @@ export class FlightsDataHandle {
let airlineIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']); let airlineIndex = airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']);
item['renderFlight']['ALCD'] = airlines[airlineIndex].airlineName; item['renderFlight']['ALCD'] = airlines[airlineIndex].airlineName;
//运营状态处理 //运营状态处理
item['renderFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc item['renderFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc;
//航班类型处理
item['renderFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderFlight']['FLTY']).flightTypeNameCn;
} else { } else {
//航线处理 //航线处理
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - '); let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
@@ -205,6 +207,14 @@ export class FlightsDataHandle {
} }
item['renderFlight']['FTSS'] = ftssLinkChnArray.join(' / '); item['renderFlight']['FTSS'] = ftssLinkChnArray.join(' / ');
//航班类型处理
let fltyLinkCodeArray = item['renderFlight']['FLTY'].split(' / ');
let fltyLinkChnArray = [];
for (let i = 0; i < fltyLinkCodeArray.length; i++) {
fltyLinkChnArray.push(flightTypes.find(val => val.flightTypeCode === fltyLinkCodeArray[i]).flightTypeNameCn)
}
item['renderFlight']['FLTY'] = fltyLinkChnArray.join(' / ');
//航线处理 //航线处理
let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - '); let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - ');
let erutPreChnArray = [] let erutPreChnArray = []
@@ -223,6 +233,9 @@ export class FlightsDataHandle {
item['renderPreFlight']['ALCD'] = airlines[airlinePreIndex].airlineName; item['renderPreFlight']['ALCD'] = airlines[airlinePreIndex].airlineName;
//运营状态处理 //运营状态处理
item['renderPreFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc item['renderPreFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc
//航班类型处理
item['renderPreFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderPreFlight']['FLTY']).flightTypeNameCn;
//航线处理 //航线处理
let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - '); let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - ');
@@ -242,12 +255,14 @@ export class FlightsDataHandle {
item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName; item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName;
//运营状态处理 //运营状态处理
item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc item['renderReaFlight']['FTSS'] = flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc
//航班类型处理
item['renderReaFlight']['FLTY'] = flightTypes.find(val => val.flightTypeCode === item['renderReaFlight']['FLTY']).flightTypeNameCn;
} }
return item; return item;
} }
public dynamicMessageHandle(message, combined_data, render_data, col_lists, filterItems, LASTSEARCH, LAST_SEL_COL, airports, citys, airlines, flightStatus) { public dynamicMessageHandle(message, combined_data, render_data, col_lists, filterItems, LASTSEARCH, LAST_SEL_COL, airports, citys, airlines, flightStatus, flightTypes) {
if (message.MVIN === 'A') { if (message.MVIN === 'A') {
//针对combined_data的处理 //针对combined_data的处理
let index = combined_data.findIndex(element => { let index = combined_data.findIndex(element => {
@@ -264,7 +279,7 @@ export class FlightsDataHandle {
if (index > -1) { if (index > -1) {
combined_data[index]['preFlight'] = message; combined_data[index]['preFlight'] = message;
combined_data[index] = this.flightsRenderTransfer(combined_data[index], col_lists); combined_data[index] = this.flightsRenderTransfer(combined_data[index], col_lists);
combined_data[index] = this.basicDataTransHandle(combined_data[index], airports, citys, airlines, flightStatus); combined_data[index] = this.basicDataTransHandle(combined_data[index], airports, citys, airlines, flightStatus, flightTypes);
if (message.UPTP === 'FLOP-AOTP') { if (message.UPTP === 'FLOP-AOTP') {
if (this.orderHandle.isArriFlight(combined_data[index])) { if (this.orderHandle.isArriFlight(combined_data[index])) {
@@ -290,7 +305,7 @@ export class FlightsDataHandle {
combined_data.splice(i, 1); combined_data.splice(i, 1);
newFlight = this.flightsRenderTransfer(newFlight, col_lists); newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus); newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
combined_data.push(newFlight) combined_data.push(newFlight)
} }
} else if (this.orderHandle.isLinked(combined_data[index])) { } else if (this.orderHandle.isLinked(combined_data[index])) {
@@ -315,7 +330,7 @@ export class FlightsDataHandle {
let newFlight = {}; let newFlight = {};
newFlight['preFlight'] = message; newFlight['preFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists); newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus); newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
combined_data.push(newFlight); combined_data.push(newFlight);
} }
@@ -334,7 +349,7 @@ export class FlightsDataHandle {
if (index1 > -1) { if (index1 > -1) {
render_data[index1]['preFlight'] = message; render_data[index1]['preFlight'] = message;
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists); render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus); render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
let is_satis = true; let is_satis = true;
for (const key in filterItems) { for (const key in filterItems) {
@@ -413,7 +428,7 @@ export class FlightsDataHandle {
newFlight['reaFlight'] = render_data[i]['reaFlight']; newFlight['reaFlight'] = render_data[i]['reaFlight'];
render_data.splice(i, 1); render_data.splice(i, 1);
newFlight = this.flightsRenderTransfer(newFlight, col_lists); newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus); newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
render_data.push(newFlight) render_data.push(newFlight)
} }
} }
@@ -440,14 +455,14 @@ export class FlightsDataHandle {
delete render_data[index1]['preFlight']; delete render_data[index1]['preFlight'];
delete render_data[index1]['renderPreFlight']; delete render_data[index1]['renderPreFlight'];
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists); render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus); render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
} }
} }
} else { } else {
let newFlight = {}; let newFlight = {};
newFlight['preFlight'] = message; newFlight['preFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists); newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus); newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
let is_satis = true; let is_satis = true;
for (const key in filterItems) { for (const key in filterItems) {
@@ -521,7 +536,7 @@ export class FlightsDataHandle {
newFlight['reaFlight'] = Object.assign({}, render_data[i]['reaFlight']); newFlight['reaFlight'] = Object.assign({}, render_data[i]['reaFlight']);
render_data.splice(i, 1); render_data.splice(i, 1);
newFlight = this.flightsRenderTransfer(newFlight, col_lists); newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus); newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
render_data.push(newFlight); render_data.push(newFlight);
} else { } else {
render_data.push(newFlight); render_data.push(newFlight);
@@ -544,12 +559,12 @@ export class FlightsDataHandle {
if (index > -1) { if (index > -1) {
combined_data[index]['reaFlight'] = message; combined_data[index]['reaFlight'] = message;
combined_data[index] = this.flightsRenderTransfer(combined_data[index], col_lists); combined_data[index] = this.flightsRenderTransfer(combined_data[index], col_lists);
combined_data[index] = this.basicDataTransHandle(combined_data[index], airports, citys, airlines, flightStatus); combined_data[index] = this.basicDataTransHandle(combined_data[index], airports, citys, airlines, flightStatus, flightTypes);
} else { } else {
let newFlight = {}; let newFlight = {};
newFlight['reaFlight'] = message; newFlight['reaFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists); newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus); newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
combined_data.push(newFlight); combined_data.push(newFlight);
} }
@@ -568,7 +583,7 @@ export class FlightsDataHandle {
if (index1 > -1) { if (index1 > -1) {
render_data[index1]['reaFlight'] = message; render_data[index1]['reaFlight'] = message;
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists); render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus); render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
let is_satis = true; let is_satis = true;
for (const key in filterItems) { for (const key in filterItems) {
@@ -630,14 +645,14 @@ export class FlightsDataHandle {
delete render_data[index1]['renderReaFlight']; delete render_data[index1]['renderReaFlight'];
render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists); render_data[index1] = this.flightsRenderTransfer(render_data[index1], col_lists);
render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus); render_data[index1] = this.basicDataTransHandle(render_data[index1], airports, citys, airlines, flightStatus, flightTypes);
} }
} }
} else { } else {
let newFlight = {}; let newFlight = {};
newFlight['reaFlight'] = message; newFlight['reaFlight'] = message;
newFlight = this.flightsRenderTransfer(newFlight, col_lists); newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus); newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
let is_satis = true; let is_satis = true;
for (const key in filterItems) { for (const key in filterItems) {
@@ -710,7 +725,7 @@ export class FlightsDataHandle {
newFlight['preFlight'] = Object.assign({}, render_data[i]['preFlight']); newFlight['preFlight'] = Object.assign({}, render_data[i]['preFlight']);
render_data.splice(i, 1); render_data.splice(i, 1);
newFlight = this.flightsRenderTransfer(newFlight, col_lists); newFlight = this.flightsRenderTransfer(newFlight, col_lists);
newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus); newFlight = this.basicDataTransHandle(newFlight, airports, citys, airlines, flightStatus, flightTypes);
render_data.push(newFlight); render_data.push(newFlight);
} else { } else {
render_data.push(newFlight); render_data.push(newFlight);