动态信息提醒处理
This commit is contained in:
@@ -12,6 +12,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 { AlertMessageHandle } from './utils/alert-message-handle';
|
||||
|
||||
import dateFormatter from '../../utils/data-formatter';
|
||||
|
||||
@@ -36,12 +37,16 @@ export class MainComponent implements OnInit {
|
||||
public orderHandle = new DynamicFlightOrder();
|
||||
public dataHandle = new FlightsDataHandle();
|
||||
public cellColorHandle = new CellColorHandle();
|
||||
public alertMessageHandle = new AlertMessageHandle();
|
||||
|
||||
public tabClose: boolean = true;
|
||||
|
||||
public canHandleDynamicMessage: boolean = false;
|
||||
public dynamicMessageArray: Array<any> = [];
|
||||
|
||||
public canHandleDynamicAlert: boolean = false;
|
||||
public dynamicAlertArray: Array<any> = [];
|
||||
|
||||
//各项基础数据
|
||||
public flightTypes: Array<any>;
|
||||
public terminals: Array<any>;
|
||||
@@ -61,6 +66,7 @@ export class MainComponent implements OnInit {
|
||||
public render_col_lists: Array<object>;
|
||||
|
||||
public airline_color: Array<object> = [];
|
||||
public airline_message_alert: Array<object> = [];
|
||||
public row_state: any = { renderFlight: {} };
|
||||
|
||||
public checkboxGroup = {
|
||||
@@ -88,6 +94,12 @@ export class MainComponent implements OnInit {
|
||||
} else if (data.topic === 'msg') {
|
||||
let message = JSON.parse(data.message);
|
||||
console.log(message);
|
||||
if (this.canHandleDynamicAlert) {
|
||||
this.dynamicAlertHandle(message);
|
||||
} else {
|
||||
this.dynamicAlertArray.push(message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -101,6 +113,8 @@ export class MainComponent implements OnInit {
|
||||
this.render_col_lists = JSON.parse(element.settingContent).targetList;
|
||||
} else if (element.groupCode === 'userSettingColor') {
|
||||
this.airline_color = JSON.parse(element.settingContent);
|
||||
} else if (element.groupCode === 'userSettingMsgAlert') {
|
||||
this.airline_message_alert = JSON.parse(element.settingContent).targetList;
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -228,6 +242,43 @@ export class MainComponent implements OnInit {
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态警示处理方法
|
||||
* @param message
|
||||
*/
|
||||
public alertMessage = {
|
||||
'FLOP-CNCL': this.alertMessageHandle.flopCncl.bind(this.alertMessageHandle),
|
||||
'FLOP-FRET': this.alertMessageHandle.flopFret.bind(this.alertMessageHandle),
|
||||
'FLOP-FDIV': this.alertMessageHandle.flopFdiv.bind(this.alertMessageHandle),
|
||||
'FLOP-FDEL': this.alertMessageHandle.flopFdel.bind(this.alertMessageHandle),
|
||||
'FLOP-DELY': this.alertMessageHandle.flopDely.bind(this.alertMessageHandle),
|
||||
'FLOP-ACTT': this.alertMessageHandle.flopActt.bind(this.alertMessageHandle),
|
||||
'FLOP-GTDT': this.alertMessageHandle.flopGtdt.bind(this.alertMessageHandle),
|
||||
'FLOP-PSDT': this.alertMessageHandle.flopPsdt.bind(this.alertMessageHandle),
|
||||
'FLOP-ESTT': this.alertMessageHandle.flopEstt.bind(this.alertMessageHandle),
|
||||
'FLOP-PADT': this.alertMessageHandle.flopPadt.bind(this.alertMessageHandle),
|
||||
'FLOP-CKDT': this.alertMessageHandle.flopCkdt.bind(this.alertMessageHandle),
|
||||
'FLOP-BOTM': this.alertMessageHandle.flopBotm.bind(this.alertMessageHandle),
|
||||
'FLOP-CLDT': this.alertMessageHandle.flopCldt.bind(this.alertMessageHandle),
|
||||
'FLOP-ROUT': this.alertMessageHandle.flopRout.bind(this.alertMessageHandle),
|
||||
'FLOP-VIPP': this.alertMessageHandle.flopVipp.bind(this.alertMessageHandle),
|
||||
'FLOP-HNAG': this.alertMessageHandle.flopHnag.bind(this.alertMessageHandle),
|
||||
'FLOP-FLBG': this.alertMessageHandle.flopFlbg.bind(this.alertMessageHandle),
|
||||
'FLOP-RENO': this.alertMessageHandle.flopReno.bind(this.alertMessageHandle),
|
||||
'FLOP-ABTM': this.alertMessageHandle.flopAbtm.bind(this.alertMessageHandle),
|
||||
'FLOP-CHDT': this.alertMessageHandle.flopChdt.bind(this.alertMessageHandle),
|
||||
'FLOP-TRML': this.alertMessageHandle.flopTrml.bind(this.alertMessageHandle),
|
||||
}
|
||||
dynamicAlertHandle(message) {
|
||||
let alertType = message.META.TYPE + '-' + message.META.STYP;
|
||||
let index = this.airline_message_alert.findIndex(val => val['COL_CODE'] === alertType);
|
||||
if (index > -1) {
|
||||
let alertText = this.alertMessage[alertType]();
|
||||
const toastCfg = new ToastConfig(ToastType.SUCCESS, '', alertText, 10000);
|
||||
this.toastService.toast(toastCfg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据组合完毕,执行排序、渲染以及动态信息处理
|
||||
* @param combined_data
|
||||
@@ -260,6 +311,10 @@ export class MainComponent implements OnInit {
|
||||
this.dynamicMessageArray.forEach(message => {
|
||||
this.dynamicMessageHandle(message);
|
||||
})
|
||||
this.canHandleDynamicAlert = true;
|
||||
this.dynamicAlertArray.forEach(message => {
|
||||
this.dynamicAlertHandle(message);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
export class AlertMessageHandle{
|
||||
public alertMessage = {
|
||||
'FLOP-CNCL':'',
|
||||
'FLOP-FRET':'',
|
||||
'FLOP-FDIV':'',
|
||||
'FLOP-FDEL':'',
|
||||
'FLOP-DELY':'',
|
||||
'FLOP-ACTT':'',
|
||||
'FLOP-GTDT':'',
|
||||
'FLOP-PSDT':'',
|
||||
'FLOP-ESTT':'',
|
||||
'FLOP-PADT':'',
|
||||
'FLOP-CKDT':'',
|
||||
'FLOP-BOTM':'',
|
||||
'FLOP-CLDT':'',
|
||||
'FLOP-ROUT':'',
|
||||
'FLOP-VIPP':'',
|
||||
'FLOP-HNAG':'',
|
||||
'FLOP-FLBG':'',
|
||||
'FLOP-RENO':'',
|
||||
'FLOP-ABTM':'',
|
||||
'FLOP-CHOT':'',
|
||||
'FLOP-TRML':'',
|
||||
}
|
||||
|
||||
public flopCncl(){
|
||||
return '航班取消事件'
|
||||
}
|
||||
public flopFret(){
|
||||
return '航班返航事件'
|
||||
}
|
||||
public flopFdiv(){
|
||||
return '航班备降事件'
|
||||
}
|
||||
public flopFdel(){
|
||||
return '航班删除事件'
|
||||
}
|
||||
public flopDely(){
|
||||
return '航班延误事件'
|
||||
}
|
||||
public flopActt(){
|
||||
return '航班实际时间事件'
|
||||
}
|
||||
public flopGtdt(){
|
||||
return '航班登机门事件'
|
||||
}
|
||||
public flopPsdt(){
|
||||
return '航班机位变更事件'
|
||||
}
|
||||
public flopEstt(){
|
||||
return '航班预计时间事件'
|
||||
}
|
||||
public flopPadt(){
|
||||
return '航班站起飞时间事件'
|
||||
}
|
||||
public flopCkdt(){
|
||||
return '航班值机柜台事件'
|
||||
}
|
||||
public flopBotm(){
|
||||
return '航班登机开始事件'
|
||||
}
|
||||
public flopCldt(){
|
||||
return '航班行李转盘事件'
|
||||
}
|
||||
public flopRout(){
|
||||
return '航班航线事件'
|
||||
}
|
||||
public flopVipp(){
|
||||
return '航班VIP事件'
|
||||
}
|
||||
public flopHnag(){
|
||||
return '航班代理事件'
|
||||
}
|
||||
public flopFlbg(){
|
||||
return '航班首末件行李到达事件'
|
||||
}
|
||||
public flopReno(){
|
||||
return '航班飞机号变更事件'
|
||||
}
|
||||
public flopAbtm(){
|
||||
return '航班靠桥撤桥事件'
|
||||
}
|
||||
public flopChdt(){
|
||||
return '航班上下轮档事件'
|
||||
}
|
||||
public flopTrml(){
|
||||
return '航班航站楼事件'
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user