颜色配置处理
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export class FlightsDataHandle {
|
||||
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)) {
|
||||
//航线处理
|
||||
let erutCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
@@ -179,7 +179,9 @@ export class FlightsDataHandle {
|
||||
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
|
||||
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 {
|
||||
//航线处理
|
||||
let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - ');
|
||||
@@ -205,6 +207,14 @@ export class FlightsDataHandle {
|
||||
}
|
||||
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 erutPreChnArray = []
|
||||
@@ -223,6 +233,9 @@ export class FlightsDataHandle {
|
||||
item['renderPreFlight']['ALCD'] = airlines[airlinePreIndex].airlineName;
|
||||
//运营状态处理
|
||||
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(' - ');
|
||||
@@ -242,12 +255,14 @@ export class FlightsDataHandle {
|
||||
item['renderReaFlight']['ALCD'] = airlines[airlineReaIndex].airlineName;
|
||||
//运营状态处理
|
||||
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;
|
||||
}
|
||||
|
||||
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') {
|
||||
//针对combined_data的处理
|
||||
let index = combined_data.findIndex(element => {
|
||||
@@ -264,7 +279,7 @@ export class FlightsDataHandle {
|
||||
if (index > -1) {
|
||||
combined_data[index]['preFlight'] = message;
|
||||
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 (this.orderHandle.isArriFlight(combined_data[index])) {
|
||||
@@ -290,7 +305,7 @@ export class FlightsDataHandle {
|
||||
combined_data.splice(i, 1);
|
||||
|
||||
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)
|
||||
}
|
||||
} else if (this.orderHandle.isLinked(combined_data[index])) {
|
||||
@@ -315,7 +330,7 @@ export class FlightsDataHandle {
|
||||
let newFlight = {};
|
||||
newFlight['preFlight'] = message;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -334,7 +349,7 @@ export class FlightsDataHandle {
|
||||
if (index1 > -1) {
|
||||
render_data[index1]['preFlight'] = message;
|
||||
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;
|
||||
for (const key in filterItems) {
|
||||
@@ -413,7 +428,7 @@ export class FlightsDataHandle {
|
||||
newFlight['reaFlight'] = render_data[i]['reaFlight'];
|
||||
render_data.splice(i, 1);
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -440,14 +455,14 @@ export class FlightsDataHandle {
|
||||
delete render_data[index1]['preFlight'];
|
||||
delete render_data[index1]['renderPreFlight'];
|
||||
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 {
|
||||
let newFlight = {};
|
||||
newFlight['preFlight'] = message;
|
||||
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;
|
||||
for (const key in filterItems) {
|
||||
@@ -521,7 +536,7 @@ export class FlightsDataHandle {
|
||||
newFlight['reaFlight'] = Object.assign({}, render_data[i]['reaFlight']);
|
||||
render_data.splice(i, 1);
|
||||
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);
|
||||
} else {
|
||||
render_data.push(newFlight);
|
||||
@@ -544,12 +559,12 @@ export class FlightsDataHandle {
|
||||
if (index > -1) {
|
||||
combined_data[index]['reaFlight'] = message;
|
||||
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 {
|
||||
let newFlight = {};
|
||||
newFlight['reaFlight'] = message;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -568,7 +583,7 @@ export class FlightsDataHandle {
|
||||
if (index1 > -1) {
|
||||
render_data[index1]['reaFlight'] = message;
|
||||
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;
|
||||
for (const key in filterItems) {
|
||||
@@ -630,14 +645,14 @@ export class FlightsDataHandle {
|
||||
delete render_data[index1]['renderReaFlight'];
|
||||
|
||||
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 {
|
||||
let newFlight = {};
|
||||
newFlight['reaFlight'] = message;
|
||||
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;
|
||||
for (const key in filterItems) {
|
||||
@@ -710,7 +725,7 @@ export class FlightsDataHandle {
|
||||
newFlight['preFlight'] = Object.assign({}, render_data[i]['preFlight']);
|
||||
render_data.splice(i, 1);
|
||||
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);
|
||||
} else {
|
||||
render_data.push(newFlight);
|
||||
|
||||
Reference in New Issue
Block a user