颜色配置处理
This commit is contained in:
@@ -11,6 +11,7 @@ import { WebsocketService } from '../../services/websocket.service';
|
||||
|
||||
import { DynamicFlightOrder } from './utils/dynamic-flight-order';
|
||||
import { FlightsDataHandle } from './utils/flights-data-handle';
|
||||
import { CellColorHandle } from './utils/cell-color-handle';
|
||||
|
||||
import dateFormatter from '../../utils/data-formatter';
|
||||
|
||||
@@ -34,6 +35,7 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
public dataHandle = new FlightsDataHandle();
|
||||
public cellColorHandle = new CellColorHandle();
|
||||
|
||||
public tabClose: boolean = true;
|
||||
|
||||
@@ -41,6 +43,7 @@ export class MainComponent implements OnInit {
|
||||
public dynamicMessageArray: Array<any> = [];
|
||||
|
||||
//各项基础数据
|
||||
public flightTypes: Array<any>;
|
||||
public terminals: Array<any>;
|
||||
public flightStatus: Array<any>;
|
||||
public airports: Array<any>;
|
||||
@@ -55,6 +58,8 @@ export class MainComponent implements OnInit {
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public col_lists: Array<object>; //列数据
|
||||
public render_col_lists: Array<object>;
|
||||
|
||||
public airline_color: Array<object> = [];
|
||||
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.sort(function (a, b) {
|
||||
return (a['COL_ORDER'] - b['COL_ORDER']);
|
||||
data.body.forEach(element => {
|
||||
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.flightStatus = this.basicDataService.flightStatus;
|
||||
this.airlines = this.basicDataService.airline;
|
||||
@@ -118,11 +128,14 @@ export class MainComponent implements OnInit {
|
||||
if (this.airports && this.airports.length > 0) {
|
||||
let combined_data = []
|
||||
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.doSequence(this.combined_data);
|
||||
} else {
|
||||
this.basicDataService.flightTypes_subject.subscribe(
|
||||
val => this.flightTypes = val
|
||||
)
|
||||
this.basicDataService.terminal_subject.subscribe(
|
||||
val => this.terminals = val
|
||||
)
|
||||
@@ -140,7 +153,7 @@ export class MainComponent implements OnInit {
|
||||
this.airports = val;
|
||||
let combined_data = []
|
||||
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.doSequence(this.combined_data);
|
||||
@@ -176,6 +189,11 @@ export class MainComponent implements OnInit {
|
||||
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(
|
||||
message,
|
||||
this.combined_data,
|
||||
@@ -186,7 +204,9 @@ export class MainComponent implements OnInit {
|
||||
this.LAST_SEL_COL,
|
||||
this.airports,
|
||||
this.citys,
|
||||
this.airlines, this.flightStatus
|
||||
this.airlines,
|
||||
this.flightStatus,
|
||||
this.flightTypes
|
||||
)
|
||||
|
||||
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']);
|
||||
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 => {
|
||||
@@ -242,14 +266,17 @@ export class MainComponent implements OnInit {
|
||||
* 刷新
|
||||
*/
|
||||
refresh() {
|
||||
let testss = this.render_data.reverse();
|
||||
let tstt = [];
|
||||
testss.forEach(element => {
|
||||
tstt.push(Object.assign({}, element))
|
||||
})
|
||||
// let testss = this.render_data.reverse();
|
||||
// let tstt = [];
|
||||
// testss.forEach(element => {
|
||||
// tstt.push(Object.assign({}, element))
|
||||
// })
|
||||
|
||||
this.render_data = testss;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
// this.render_data = testss;
|
||||
// this.changeDetectorRef.detectChanges();
|
||||
|
||||
const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '登录成功!', 3000);
|
||||
this.toastService.toast(toastCfg);
|
||||
}
|
||||
|
||||
|
||||
@@ -552,68 +579,25 @@ export class MainComponent implements OnInit {
|
||||
* 获取当前单元格颜色
|
||||
* @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) {
|
||||
if (this.orderHandle.isArriFlight(flight)) {
|
||||
if (col_CODE === 'SODT') {
|
||||
if (flight['preFlight']['SODT']) {
|
||||
if (!flight['preFlight']['ESTT'] && !flight['preFlight']['ACTT']) {
|
||||
return 'rgb(0,255,255)';
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
let index = this.airline_color.findIndex(color => color['COL_CODE'] === col_CODE)
|
||||
if (index > -1) {
|
||||
let styles = this.colorFormatter[col_CODE](flight, this.airline_color[index]);
|
||||
return styles;
|
||||
} 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;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user