消息处理修改方式及部分消息提示语修改

This commit is contained in:
zhouyuejun
2019-01-18 10:58:44 +08:00
parent 4bfc263fa3
commit 81b360d52b
6 changed files with 127 additions and 143 deletions
@@ -19,7 +19,7 @@
<div class="hr-line">资源类 -----------------------------------------</div>
<div class="message-container">
<p class="mt-2"><label>停机位:</label>{{showPsst}}</p>
<p><label>登机门:</label>{{singleFlight.GATE}}</p>
<p><label>登机门:</label>{{singleFlight.GTDT}}</p>
<p><label>值机柜台:</label>{{singleFlight.CHKC}}</p>
<p><label>行李传送带:</label>{{singleFlight.CHUT}}</p>
</div>
+16 -110
View File
@@ -319,8 +319,6 @@ export class MainComponent implements OnInit {
*/
calcVisibleCount() {
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px');
// console.log(this.tableContainer.nativeElement.offsetHeight);
// console.log(this.tableHead.nativeElement.offsetHeight);
this.renderer2.setStyle(this.tableBody.nativeElement, 'height', this.tableContainer.nativeElement.offsetHeight - this.tableHead.nativeElement.offsetHeight + 'px');
if (!this.tabClose) {
this.renderer2.setStyle(this.tabContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px');
@@ -425,33 +423,18 @@ export class MainComponent implements OnInit {
* @param message
*/
dynamicMessageHandle(message) {
let index = this.raw_data.findIndex(element => element['FLID'] === message.FLID);
if (index > -1) {
this.raw_data[index] = message;
} else {
this.raw_data.push(message);
}
if (this.airlinesSelections.findIndex(airline => airline.airlineCodeIata === message['ALCD']) === -1) {
let index = this.airlines.findIndex(val => val.airlineCodeIata === message['ALCD']);
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]);
}
this.creatWorkers();
this.creatWorkers(message);
}
/**
* 创建线程并执行
*/
public promise: Worker = new Worker('/adminweb/assets/web-worker-handle.js');
creatWorkers() {
creatWorkers(message?) {
let dynamicData = {
message: message,
airlinesSelections: this.airlinesSelections,
flightTypeSelections: this.flightTypeSelections,
raw_data: this.raw_data,
col_lists: this.col_lists,
airports: this.airports,
@@ -462,12 +445,18 @@ export class MainComponent implements OnInit {
}
this.promise.postMessage(dynamicData);
this.promise.onmessage = function (e) {
this.combined_data = e.data;
this.combined_data = e.data.combined_data;
this.raw_data = e.data.raw_data;
this.airlinesSelections = e.data.airlinesSelections;
this.flightTypeSelections = e.data.flightTypeSelections;
this.selectChange('dynamic');
}.bind(this);
// const promise = this.webWorkerService.run(webWorkerHandle, dynamicData);
// promise.then(function (response) {
// this.combined_data = response;
// this.combined_data = response.combined_data;
// this.raw_data = response.raw_data;
// this.airlinesSelections = response.airlinesSelections;
// this.flightTypeSelections = response.flightTypeSelections;
// this.selectChange('dynamic');
// this.webWorkerService.terminate(promise);
// }.bind(this));
@@ -603,27 +592,6 @@ export class MainComponent implements OnInit {
break;
}
}
// else if (key === 'Start_time') {
// let planTime = new Date(dateFormatter(item['preFlight']['SODT'])).getTime();
// let nowTime = new Date().getTime();
// if (nowTime - planTime >= +filterItems[key] * 60 * 60 * 1000 || nowTime - planTime < 0) {
// is_satis = false;
// break;
// } else {
// is_satis = true;
// continue;
// }
// } else if (key === 'End_time') {
// let planTime = new Date(dateFormatter(item['preFlight']['SODT'])).getTime();
// let nowTime = new Date().getTime();
// if (planTime - nowTime > +filterItems[key] * 60 * 60 * 1000 || planTime - nowTime < 0) {
// is_satis = false;
// break;
// } else {
// is_satis = true;
// continue;
// }
// }
else {
if (item['preFlight'][key] == filterItems[key]) {
is_satis = true;
@@ -649,27 +617,6 @@ export class MainComponent implements OnInit {
break;
}
}
// else if (key === 'Start_time') {
// let planTime = new Date(dateFormatter(item['reaFlight']['SODT'])).getTime();
// let nowTime = new Date().getTime();
// if (nowTime - planTime > +filterItems[key] * 60 * 60 * 1000 || nowTime - planTime < 0) {
// is_satis = false;
// break;
// } else {
// is_satis = true;
// continue;
// }
// } else if (key === 'End_time') {
// let planTime = new Date(dateFormatter(item['reaFlight']['SODT'])).getTime();
// let nowTime = new Date().getTime();
// if (planTime - nowTime > +filterItems[key] * 60 * 60 * 1000 || planTime - nowTime < 0) {
// is_satis = false;
// break;
// } else {
// is_satis = true;
// continue;
// }
// }
else {
if (item['reaFlight'][key] == filterItems[key]) {
is_satis = true;
@@ -696,27 +643,6 @@ export class MainComponent implements OnInit {
break;
}
}
// else if (key === 'Start_time') {
// let planTime = new Date(dateFormatter(item['preFlight']['SODT'])).getTime();
// let nowTime = new Date().getTime();
// if (nowTime - planTime > +filterItems[key] * 60 * 60 * 1000 || nowTime - planTime < 0) {
// pre_satis = false;
// break;
// } else {
// pre_satis = true;
// continue;
// }
// } else if (key === 'End_time') {
// let planTime = new Date(dateFormatter(item['preFlight']['SODT'])).getTime();
// let nowTime = new Date().getTime();
// if (planTime - nowTime > +filterItems[key] * 60 * 60 * 1000 || planTime - nowTime < 0) {
// pre_satis = false;
// break;
// } else {
// pre_satis = true;
// continue;
// }
// }
else {
if (item['preFlight'][key] == filterItems[key]) {
pre_satis = true;
@@ -739,27 +665,6 @@ export class MainComponent implements OnInit {
break;
}
}
// else if (key === 'Start_time') {
// let planTime = new Date(dateFormatter(item['reaFlight']['SODT'])).getTime();
// let nowTime = new Date().getTime();
// if (nowTime - planTime > +filterItems[key] * 60 * 60 * 1000 || nowTime - planTime < 0) {
// rea_satis = false;
// break;
// } else {
// rea_satis = true;
// continue;
// }
// } else if (key === 'End_time') {
// let planTime = new Date(dateFormatter(item['reaFlight']['SODT'])).getTime();
// let nowTime = new Date().getTime();
// if (planTime - nowTime > +filterItems[key] * 60 * 60 * 1000 || planTime - nowTime < 0) {
// rea_satis = false;
// break;
// } else {
// rea_satis = true;
// continue;
// }
// }
else {
if (item['reaFlight'][key] == filterItems[key]) {
rea_satis = true;
@@ -1051,9 +956,10 @@ export class MainComponent implements OnInit {
if (this.orderHandle.isArriFlight(flight)) {
return false;
} else {
let reaDelay = flight['reaFlight']['DELY'];
try {
if (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0) {
if (parseInt(flight['preFlight']['DELY'][0]['DURA']) - 30 > 0) {
if (reaDelay && Array.isArray(reaDelay) && reaDelay.length > 0) {
if (parseInt(reaDelay[reaDelay.length - 1]['DURA']) - 30 > 0) {
return true;
} else {
return false;
@@ -60,7 +60,8 @@ export class RelatedTabComponent implements OnInit {
let fretIndex = this.lines.preFlight['ABN'].findIndex(ele => ele.TYPE === 'RTN');
if (delyIndex > -1) {
this.predelay = this.lines.preFlight['ABN'][delyIndex].BODY;
let delyMessage = this.lines.preFlight['ABN'][delyIndex].BODY
this.predelay = delyMessage[delyMessage.length - 1];
this.predelay['STRT'] = new Date(dateFormatter(this.predelay['STRT'])).getTime();
this.predelay['DURA'] = parseInt(this.predelay['DURA'].substr(0, 2)) * 3600000 + parseInt(this.predelay['DURA'].substr(2, 3)) * 60000 + this.predelay['STRT']
}
@@ -86,7 +87,8 @@ export class RelatedTabComponent implements OnInit {
let fretIndex = this.lines.reaFlight['ABN'].findIndex(ele => ele.TYPE === 'RTN');
if (delyIndex > -1) {
this.readelay = this.lines.reaFlight['ABN'][delyIndex].BODY;
let delyMessage = this.lines.reaFlight['ABN'][delyIndex].BODY
this.readelay = delyMessage[delyMessage.length - 1];
this.readelay['STRT'] = new Date(dateFormatter(this.readelay['STRT'])).getTime();
this.readelay['DURA'] = parseInt(this.readelay['DURA'].substr(0, 2)) * 3600000 + parseInt(this.readelay['DURA'].substr(2, 3)) * 60000 + this.readelay['STRT'];
}
+22 -9
View File
@@ -33,11 +33,11 @@ export class AlertMessageHandle {
}
public flopFret(message, airports) {
if (message.FLOP.FRET.REID === 'G') {
return message.FLOP.FFID + '航班从地面返回,返回原因:' + message.FLOP.FRET.content || message.FLOP.FRET.VALUE;
return message.FLOP.FFID + '航班从地面返回,返回原因:' + (message.FLOP.FRET.content || message.FLOP.FRET.VALUE);
} else if (message.FLOP.FRET.REID === 'A') {
return message.FLOP.FFID + '航班从空中返回,返回原因:' + message.FLOP.FRET.content || message.FLOP.FRET.VALUE;
return message.FLOP.FFID + '航班从空中返回,返回原因:' + (message.FLOP.FRET.content || message.FLOP.FRET.VALUE);
} else {
return message.FLOP.FFID + '航班从空中或地面返回,返回原因:' + message.FLOP.FRET.content || message.FLOP.FRET.VALUE;
return message.FLOP.FFID + '航班从空中或地面返回,返回原因:' + (message.FLOP.FRET.content || message.FLOP.FRET.VALUE);
}
}
public flopFdiv(message, airports) {
@@ -47,24 +47,37 @@ export class AlertMessageHandle {
airportName = airports[index].airportNameChn;
}
if (message.FLOP.FDIV.DDIR === 'FROM') {
return message.FLOP.FFID + '航班备降自' + airportName + ',备降原因:' + message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE;
return message.FLOP.FFID + '航班备降自' + airportName + ',备降原因:' + (message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE);
} else if (message.FLOP.FDIV.DDIR === 'TO') {
return message.FLOP.FFID + '航班备降到' + airportName + ',备降原因:' + message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE;
return message.FLOP.FFID + '航班备降到' + airportName + ',备降原因:' + (message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE);
} else {
return message.FLOP.FFID + '航班备降,备降原因:' + message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE;
return message.FLOP.FFID + '航班备降,备降原因:' + (message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE);
}
}
public flopFdel(message, airports) {
return message.FLOP.FFID + '航班被删除了'
}
public flopDely(message, airports) {
return message.FLOP.FFID + '航班延误' + message.FLOP.DELY.DURA + '分钟;延误码:' + message.FLOP.DELY.CODE + ';延误信息:' + message.FLOP.DELY.content || message.FLOP.DELY.VALUE
let delyArray = message.FLOP.DELY;
let delyMessage = delyArray[delyArray.length - 1];
return message.FLOP.FFID + '航班延误' + (parseInt(delyMessage.DURA.substr(0, 2)) * 60 + parseInt(delyMessage.DURA.substr(2, 3))) + '分钟;延误码:' + delyMessage.CODE + '; 延误信息:' + (delyMessage.content || delyMessage.VALUE)
}
public flopActt(message, airports) {
return message.FLOP.FFID + '航班实际时间:' + dateFormatter(message.FLOP.ACTT);
}
public flopGtdt(message, airports) {
return message.FLOP.FFID + '登机门分配为:' + message.FLOP.GTDT.GATE
if (Array.isArray(message.FLOP['GTDT']) && message.FLOP['GTDT'].length > 0) {
let gate = [];
for (let i = 0; i < message.FLOP['GTDT'].length; i++) {
gate.push(message.FLOP['GTDT'][i]['GATE']);
}
let set = new Set(gate);
return message.FLOP.FFID + '登机门分配为:' + Array.from(set).join(',');
} else if (Object.prototype.toString.call(message.FLOP['GTDT']) === '[object Object]') {
return message.FLOP.FFID + '登机门分配为:' + message.FLOP['GTDT']['GATE'];
} else {
return message.FLOP.FFID + '登机门分配为:';
}
}
public flopPsdt(message, airports) {
if (Array.isArray(message.FLOP['PSDT']) && message.FLOP['PSDT'].length > 0) {
@@ -140,7 +153,7 @@ export class AlertMessageHandle {
return message.FLOP.FFID + '航线更改为:' + rout.join(' - ');
}
public flopVipp(message, airports, citys) {
return message.FLOP.FFID + 'VIP旅客:' + message.FLOP.VIPP + '';
return message.FLOP.FFID + 'VIP旅客:' + (message.FLOP.VIPP || '');
}
public flopHnag() {
return '航班代理事件';
+33 -3
View File
@@ -1,4 +1,4 @@
export default function (dynamicData) {
export default function (dynamicData?) {
if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
@@ -30,13 +30,38 @@ export default function (dynamicData) {
}
let raw_data = dynamicData.raw_data,
let messageArray = dynamicData.message,
airlinesSelections = dynamicData.airlinesSelections,
flightTypeSelections = dynamicData.flightTypeSelections,
raw_data = dynamicData.raw_data,
col_lists = dynamicData.col_lists,
airports = dynamicData.airports,
citys = dynamicData.citys,
airlines = dynamicData.airlines,
flightStatus = dynamicData.flightStatus,
flightTypes = dynamicData.flightTypes
if (messageArray && Array.isArray(messageArray) && messageArray.length > 0) {
messageArray.forEach(message => {
let index = raw_data.findIndex(element => element['FLID'] === message.FLID);
if (index > -1) {
raw_data[index] = message;
} else {
raw_data.push(message);
}
if (airlinesSelections.findIndex(airline => airline.airlineCodeIata === message['ALCD']) === -1) {
let index = airlines.findIndex(val => val.airlineCodeIata === message['ALCD']);
airlinesSelections.push(airlines[index]);
}
if (flightTypeSelections.findIndex(flightType => flightType.flightTypeCode === message['FLTY']) === -1) {
let index = flightTypes.findIndex(val => val.flightTypeCode === message['FLTY']);
flightTypeSelections.push(flightTypes[index]);
}
})
}
/**
* 时间转换
* @param dataString
@@ -1101,5 +1126,10 @@ export default function (dynamicData) {
return (a['ORDER'] - b['ORDER']);
})
return combined_data;
return {
"raw_data": raw_data,
"airlinesSelections": airlinesSelections,
"flightTypeSelections": flightTypeSelections,
"combined_data": combined_data,
};
}
+35 -2
View File
@@ -30,13 +30,39 @@ onmessage = function (dynamicData) {
}
let raw_data = dynamicData.data.raw_data,
let messageArray = dynamicData.data.message,
airlinesSelections = dynamicData.data.airlinesSelections,
flightTypeSelections = dynamicData.data.flightTypeSelections,
raw_data = dynamicData.data.raw_data,
col_lists = dynamicData.data.col_lists,
airports = dynamicData.data.airports,
citys = dynamicData.data.citys,
airlines = dynamicData.data.airlines,
flightStatus = dynamicData.data.flightStatus,
flightTypes = dynamicData.data.flightTypes
if (messageArray && Array.isArray(messageArray) && messageArray.length > 0) {
messageArray.forEach(message => {
let index = raw_data.findIndex(element => element['FLID'] === message.FLID);
if (index > -1) {
raw_data[index] = message;
} else {
raw_data.push(message);
}
if (airlinesSelections.findIndex(airline => airline.airlineCodeIata === message['ALCD']) === -1) {
let index = airlines.findIndex(val => val.airlineCodeIata === message['ALCD']);
airlinesSelections.push(airlines[index]);
}
if (flightTypeSelections.findIndex(flightType => flightType.flightTypeCode === message['FLTY']) === -1) {
let index = flightTypes.findIndex(val => val.flightTypeCode === message['FLTY']);
flightTypeSelections.push(flightTypes[index]);
}
})
}
/**
* 时间转换
* @param dataString
@@ -1102,5 +1128,12 @@ onmessage = function (dynamicData) {
return (a['ORDER'] - b['ORDER']);
})
postMessage(combined_data);
postMessage(
{
"raw_data":raw_data,
"airlinesSelections":airlinesSelections,
"flightTypeSelections":flightTypeSelections,
"combined_data": combined_data,
}
);
}