diff --git a/src/app/pages/historical-data/historical-data.component.ts b/src/app/pages/historical-data/historical-data.component.ts index 6b0ed17..b59d514 100644 --- a/src/app/pages/historical-data/historical-data.component.ts +++ b/src/app/pages/historical-data/historical-data.component.ts @@ -116,7 +116,7 @@ export class HistoricalDataComponent implements OnInit { data => { data.body.forEach(element => { if (element.groupCode === 'userSettingCol') { - this.col_lists = JSON.parse(element.settingContent).allCols; + this.col_lists = JSON.parse(element.settingContent).defaultData; this.render_col_lists = JSON.parse(element.settingContent).targetList; } }) @@ -252,7 +252,7 @@ export class HistoricalDataComponent implements OnInit { data => { data.body.forEach(element => { if (element.groupCode === 'userSettingCol') { - this.col_lists = JSON.parse(element.settingContent).allCols; + this.col_lists = JSON.parse(element.settingContent).defaultData; this.render_col_lists = JSON.parse(element.settingContent).targetList; } }) diff --git a/src/app/pages/main/detail-tab/detail-tab.component.scss b/src/app/pages/main/detail-tab/detail-tab.component.scss index 0987231..0c929bc 100644 --- a/src/app/pages/main/detail-tab/detail-tab.component.scss +++ b/src/app/pages/main/detail-tab/detail-tab.component.scss @@ -1,18 +1,19 @@ .tab-container{ padding: 10px; - height: 635px; - overflow: auto; - border: 1px solid #ccc; + // height: 635px; + // overflow: auto; + // border: 1px solid #ccc; .hr-line{ font-weight: bold; } .message-container{ - padding: 5px 10px 5px 10px; + padding: 5px 10px 5px 20px; p{ margin: 0; label{ - width: 120px; - text-align: right; + // width: 120px; + font-weight: bolder; + // text-align: right; } } } diff --git a/src/app/pages/main/main.component.html b/src/app/pages/main/main.component.html index f48111b..7f64275 100644 --- a/src/app/pages/main/main.component.html +++ b/src/app/pages/main/main.component.html @@ -166,14 +166,14 @@
- + - - + +
{{common_col.COL_CN}}{{airline_col.COL_CN}}{{common_col.COL_CN}}{{airline_col.COL_CN}}
@@ -181,15 +181,21 @@
- + + - - + - + + [ngStyle]="getColor(airline_col.COL_CODE,airline_row,airline_col.COL_WIDTH)" [title]="airline_row['renderFlight'][airline_col.COL_CODE]">{{airline_row['renderFlight'][airline_col.COL_CODE]}}
{{start+i+1}} + {{start+i+1}} {{airline_row['renderFlight']['FLID']}}{{airline_row['renderFlight']['FLID']}} {{airline_row['renderFlight'][airline_col.COL_CODE]}}
-
+
diff --git a/src/app/pages/main/main.component.scss b/src/app/pages/main/main.component.scss index 4d1581f..3343c6e 100644 --- a/src/app/pages/main/main.component.scss +++ b/src/app/pages/main/main.component.scss @@ -136,6 +136,14 @@ } } } + /deep/ .ant-tabs-content{ + height: calc(100% - 65px); + overflow-y: auto; + border: 1px solid #ccc; + } + nz-tabset{ + height: 100%; + } &::-webkit-scrollbar { width: 15px; height: 15px; diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index 0a8f941..e60c5c4 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -90,7 +90,7 @@ export class MainComponent implements OnInit { public wait_render_data: Array = []; public render_data: Array = []; //显示数据,即需要显示的数据 - public commonCol:Array; + public commonCol: Array; public col_lists: Array; //列数据 public render_col_lists: Array; @@ -109,6 +109,7 @@ export class MainComponent implements OnInit { @ViewChild('pageContent') pageContent; @ViewChild('searchFilter') searchFilter; @ViewChild('tableContainer') tableContainer; + @ViewChild('tabContainer') tabContainer; @ViewChild('tableHead') tableHead; @ViewChild('tableBody') tableBody; @ViewChild('tableContent') tableContent; @@ -121,8 +122,12 @@ export class MainComponent implements OnInit { ngOnInit() { + console.log(Object.prototype.toString.call({})); this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px'); 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'); + } window.onresize = function () { this.calcVisibleCount(); }.bind(this) @@ -268,11 +273,11 @@ export class MainComponent implements OnInit { this.start = Math.floor(scrollTop / this.trItemHeight); this.end = this.start + this.visibleCount; this.render_data = this.wait_render_data.slice(this.start, this.end); - setTimeout(()=>{ - $(".table-body tbody>tr").eq(0).find('td').each((index,element)=>{ - $(".table-head table colgroup").eq(0).find('col').eq(index).attr('width',$(element).innerWidth()+'px') + setTimeout(() => { + $(".table-body tbody>tr").eq(0).find('td').each((index, element) => { + $(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px'); }) - },500) + }, 500) this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.operateSpinServiceService.hideSpin(); @@ -295,15 +300,15 @@ export class MainComponent implements OnInit { const scrollTop = this.tableBody.nativeElement.scrollTop; $(".table-head").scrollLeft($('.table-body').scrollLeft()); const fixedScrollTop = scrollTop - scrollTop % this.trItemHeight; - this.tableContent.nativeElement.style.webkitTransform = `translateY(${fixedScrollTop - 42}px)`; + this.tableContent.nativeElement.style.webkitTransform = `translateY(${fixedScrollTop}px)`; this.start = Math.floor(scrollTop / this.trItemHeight); this.end = this.start + this.visibleCount; this.render_data = this.wait_render_data.slice(this.start, this.end); - setTimeout(()=>{ - $(".table-body tbody>tr").eq(0).find('td').each((index,element)=>{ - $(".table-head table colgroup").eq(0).find('col').eq(index).attr('width',$(element).innerWidth()+'px') + setTimeout(() => { + $(".table-body tbody>tr").eq(0).find('td').each((index, element) => { + $(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px'); }) - },500) + }, 500) } /** @@ -312,6 +317,9 @@ export class MainComponent implements OnInit { calcVisibleCount() { this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px'); 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'); + } this.visibleCount = Math.ceil(this.tableBody.nativeElement.clientHeight / this.trItemHeight); const scrollTop = this.tableBody.nativeElement.scrollTop; const fixedScrollTop = scrollTop - scrollTop % this.trItemHeight; @@ -319,11 +327,11 @@ export class MainComponent implements OnInit { this.start = Math.floor(scrollTop / this.trItemHeight); this.end = this.start + this.visibleCount; this.render_data = this.wait_render_data.slice(this.start, this.end); - setTimeout(()=>{ - $(".table-body tbody>tr").eq(0).find('td').each((index,element)=>{ - $(".table-head table colgroup").eq(0).find('col').eq(index).attr('width',$(element).innerWidth()+'px') + setTimeout(() => { + $(".table-body tbody>tr").eq(0).find('td').each((index, element) => { + $(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px'); }) - },500) + }, 500) } /** @@ -410,26 +418,36 @@ export class MainComponent implements OnInit { * 动态消息处理方法 * @param message */ + startposi: number dynamicMessageHandle(message) { + this.startposi = new Date().getTime(); 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); } + console.log(new Date().getTime() - this.startposi + '消息更新替换到原始数据所花时间'); //查找链接航班并将其组合成一条数据 + this.startposi = new Date().getTime(); let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data); + console.log(new Date().getTime() - this.startposi + '找链接航班所花时间') let combined_data = []; this.combined_data = []; + this.startposi = new Date().getTime() combined_linked_data.forEach(element => { let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists); this.combined_data.push(flights_item); }); + console.log(new Date().getTime() - this.startposi + '转换结束所花时间') + this.startposi = new Date().getTime(); this.combined_data.forEach(item => { combined_data.push(this.dataHandle.basicDataTransHandle(item, this.airports, this.citys, this.airlines, this.flightStatus, this.flightTypes)); }) + console.log(new Date().getTime() - this.startposi + '基础数据转换结束所花时间'); this.combined_data = combined_data; + this.startposi = new Date().getTime(); this.combined_data.forEach(element => { element['ORDER'] = this.orderHandle.sequence(element); }) @@ -437,6 +455,10 @@ export class MainComponent implements OnInit { return (a['ORDER'] - b['ORDER']); }) + console.log(new Date().getTime() - this.startposi + '排序所花时间'); + + this.selectChange('dynamic'); + 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]); @@ -447,7 +469,7 @@ export class MainComponent implements OnInit { this.flightTypeSelections.push(this.flightTypes[index]); } - this.selectChange('dynamic'); + // let dynamicHandleData = this.dataHandle.dynamicMessageHandle( // message, @@ -503,7 +525,7 @@ export class MainComponent implements OnInit { 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](); + let alertText = this.alertMessage[alertType](message, this.airports); const toastCfg = new ToastConfig(ToastType.SUCCESS, '', alertText, 600000); this.toastService.toast(toastCfg); } @@ -553,6 +575,7 @@ export class MainComponent implements OnInit { * 下拉框选择筛选 */ selectChange(type) { + this.startposi = new Date().getTime() if (type === 'filter') { this.operateSpinServiceService.showSpin(); } @@ -760,11 +783,11 @@ export class MainComponent implements OnInit { } else { this.wait_render_data = filter_data; this.render_data = this.wait_render_data.slice(this.start, this.end); - setTimeout(()=>{ - $(".table-body tbody>tr").eq(0).find('td').each((index,element)=>{ - $(".table-head table colgroup").eq(0).find('col').eq(index).attr('width',$(element).innerWidth()+'px') + setTimeout(() => { + $(".table-body tbody>tr").eq(0).find('td').each((index, element) => { + $(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px'); }) - },500) + }, 500) // this.render_data = filter_data; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.operateSpinServiceService.hideSpin(); @@ -812,13 +835,16 @@ export class MainComponent implements OnInit { }) } } + console.log(new Date().getTime() - this.startposi + '判断是否满足过滤条件所花时间'); this.wait_render_data = filterData; + this.startposi = new Date().getTime(); this.render_data = this.wait_render_data.slice(this.start, this.end); - setTimeout(()=>{ - $(".table-body tbody>tr").eq(0).find('td').each((index,element)=>{ - $(".table-head table colgroup").eq(0).find('col').eq(index).attr('width',$(element).innerWidth()+'px') + console.log(new Date().getTime() - this.startposi + '渲染结束所花时间'); + setTimeout(() => { + $(".table-body tbody>tr").eq(0).find('td').each((index, element) => { + $(".table-head table thead tr").eq(0).find('th').eq(index).attr('width', $(element).innerWidth() + 'px'); }) - },500) + }, 500) // this.render_data = filterData; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.operateSpinServiceService.hideSpin(); @@ -916,13 +942,14 @@ export class MainComponent implements OnInit { 'BOTM': this.cellColorHandle.botm.bind(this.cellColorHandle), 'GCTM': this.cellColorHandle.gctm.bind(this.cellColorHandle) } - getColor(col_CODE, flight) { + getColor(col_CODE, flight, col_WIDTH) { 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]); + styles['min-width'] = col_WIDTH; return styles; } else { - return null; + return { 'min-width': col_WIDTH }; } } @@ -1150,17 +1177,24 @@ export class MainComponent implements OnInit { * 复选框勾选事件 */ checkboxChange() { + let tabClose = true for (const key in this.checkboxGroup) { if (this.checkboxGroup.hasOwnProperty(key)) { if (this.checkboxGroup[key]) { - this.tabClose = false; + tabClose = false; break; } else { - this.tabClose = true; + tabClose = true; continue; } } } + this.tabClose = tabClose; + if (!this.tabClose) { + setTimeout(() => { + this.renderer2.setStyle(this.tabContainer.nativeElement, 'height', this.pageContent.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 35 + 'px'); + }, 10) + } } /** diff --git a/src/app/pages/main/related-tab/related-tab.component.scss b/src/app/pages/main/related-tab/related-tab.component.scss index bf98646..95a43e0 100644 --- a/src/app/pages/main/related-tab/related-tab.component.scss +++ b/src/app/pages/main/related-tab/related-tab.component.scss @@ -1,8 +1,8 @@ .tab-container { padding: 10px 10px; - height: 635px; - overflow: auto; - border: 1px solid #ccc; + // height: 635px; + // overflow: auto; + // border: 1px solid #ccc; .fieldset-card { fieldset { padding: 5px 10px 20px 10px; diff --git a/src/app/services/http-client.service.ts b/src/app/services/http-client.service.ts index 159d190..4319033 100644 --- a/src/app/services/http-client.service.ts +++ b/src/app/services/http-client.service.ts @@ -21,7 +21,7 @@ export class HttpClientService { private toastService: ToastService, ) { } - + header: HttpHeaders = new HttpHeaders().set('x-requested-with', 'XMLHttpRequest') /** * request @@ -29,7 +29,7 @@ export class HttpClientService { * @return any */ request(method: string, url: string, options?): Observable { - return this.commonProcess(this.httpClient.request(method, url, options)); + return this.commonProcess(this.httpClient.request(method, url, { headers: this.header })); } @@ -40,7 +40,7 @@ export class HttpClientService { * @param options */ delete(url: string, options?): Observable { - return this.commonProcess(this.httpClient.delete(url, options)); + return this.commonProcess(this.httpClient.delete(url, { headers: this.header })); } /** @@ -58,9 +58,9 @@ export class HttpClientService { paramsString.push([key, params[key]].join('=')) } } - return this.commonProcess(this.httpClient.get(encodeURI(url + paramsString.join('&') + '&t=' + t), options)); + return this.commonProcess(this.httpClient.get(encodeURI(url + paramsString.join('&') + '&t=' + t), { headers: this.header })); } else { - return this.commonProcess(this.httpClient.get(url + 't=' + t, options)); + return this.commonProcess(this.httpClient.get(url + 't=' + t, { headers: this.header })); } } @@ -70,7 +70,7 @@ export class HttpClientService { * @param options */ head(url: string, options?): Observable { - return this.commonProcess(this.httpClient.head(url, options)); + return this.commonProcess(this.httpClient.head(url, { headers: this.header })); } /** @@ -79,7 +79,7 @@ export class HttpClientService { * @param options */ options(url: string, options?): Observable { - return this.commonProcess(this.httpClient.options(url, options)); + return this.commonProcess(this.httpClient.options(url, { headers: this.header })); } /** @@ -88,7 +88,7 @@ export class HttpClientService { * @param options */ patch(url: string, body?, options?): Observable { - return this.commonProcess(this.httpClient.patch(url, body, options)); + return this.commonProcess(this.httpClient.patch(url, body, { headers: this.header })); } @@ -99,7 +99,7 @@ export class HttpClientService { * @param options */ post(url: string, body?, options?): Observable { - return this.commonProcess(this.httpClient.post(url, body, options)); + return this.commonProcess(this.httpClient.post(url, body, { headers: this.header })); } /** @@ -108,7 +108,7 @@ export class HttpClientService { * @param options */ put(url: string, body?, options?): Observable { - return this.commonProcess(this.httpClient.put(url, body, options)); + return this.commonProcess(this.httpClient.put(url, body, { headers: this.header })); } /** diff --git a/src/app/utils/alert-message-handle.ts b/src/app/utils/alert-message-handle.ts index 11e4cef..1d9d8c7 100644 --- a/src/app/utils/alert-message-handle.ts +++ b/src/app/utils/alert-message-handle.ts @@ -1,89 +1,159 @@ -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':'', - } +import dateFormatter from './date-formatter'; +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 flopCncl(message, airports) { + return message.FLOP.FFID + '航班取消'; } - public flopFret(){ - return '航班返航事件' + public flopFret(message, airports) { + if (message.FLOP.FRET.REID === 'G') { + 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; + } else { + return message.FLOP.FFID + '航班从空中或地面返回,返回原因:' + message.FLOP.FRET.content || message.FLOP.FRET.VALUE; + } } - public flopFdiv(){ - return '航班备降事件' + public flopFdiv(message, airports) { + let airportName = ''; + let index = airports.findIndex(airport => airport.airportCodeIata === message.FLOP.FDIV.DDES); + if (index > -1) { + airportName = airports[index].airportNameChn; + } + if (message.FLOP.FDIV.DDIR === 'FROM') { + 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; + } else { + return message.FLOP.FFID + '航班备降,备降原因:' + message.FLOP.FDIV.content || message.FLOP.FDIV.VALUE; + } } - public flopFdel(){ - return '航班删除事件' + public flopFdel(message, airports) { + return message.FLOP.FFID + '航班被删除了' } - public flopDely(){ - return '航班延误事件' + public flopDely(message, airports) { + return message.FLOP.FFID + '航班延误' + message.FLOP.DELY.DURA + '分钟;延误码:' + message.FLOP.DELY.CODE + ';延误信息:' + message.FLOP.DELY.content || message.FLOP.DELY.VALUE } - public flopActt(){ - return '航班实际时间事件' + public flopActt(message, airports) { + return message.FLOP.FFID + '航班实际时间:' + dateFormatter(message.FLOP.ACTT); } - public flopGtdt(){ - return '航班登机门事件' + public flopGtdt(message, airports) { + return message.FLOP.FFID + '登机门分配为:' + message.FLOP.GTDT.GATE } - public flopPsdt(){ - return '航班机位变更事件' + public flopPsdt(message, airports) { + if (Array.isArray(message.FLOP['PSDT']) && message.FLOP['PSDT'].length > 0) { + let psst = []; + for (let i = 0; i < message.FLOP['PSDT'].length; i++) { + psst.push(message.FLOP['PSDT'][i]['PSST']); + } + let set = new Set(psst); + return message.FLOP.FFID + '计划机位变更为:' + Array.from(set).join(','); + } else if (Object.prototype.toString.call(message.FLOP['PSDT']) === '[object Object]') { + return message.FLOP.FFID + '计划机位变更为:' + message.FLOP['PSDT']['PSST']; + } else { + return message.FLOP.FFID + '计划机位变更为:'; + } } - public flopEstt(){ - return '航班预计时间事件' + public flopEstt(message, airports) { + return message.FLOP.FFID + '预计时间变更为' + dateFormatter(message.FLOP.ESTT); } - public flopPadt(){ - return '航班站起飞时间事件' + public flopPadt(message, airports) { + return message.FLOP.FFID + '航班前站实际起飞时间:' + dateFormatter(message.FLOP.PADT); } - public flopCkdt(){ - return '航班值机柜台事件' + public flopCkdt(message, airports) { + if (Array.isArray(message.FLOP['CKDT']) && message.FLOP['CKDT'].length > 0) { + let chkc = []; + for (let i = 0; i < message.FLOP['CKDT'].length; i++) { + chkc.push(message.FLOP['CKDT'][i]['CHKC']); + } + let set = new Set(chkc); + return message.FLOP.FFID + '航班值机柜台分配为:' + Array.from(set).join(','); + } else if (Object.prototype.toString.call(message.FLOP['CKDT']) === '[object Object]') { + return message.FLOP.FFID + '航班值机柜台分配为:' + message.FLOP['CKDT']['CHKC']; + } else { + return message.FLOP.FFID + '航班值机柜台分配为:'; + } } - public flopBotm(){ - return '航班登机开始事件' + public flopBotm(message, airports) { + return message.FLOP.FFID + '登机开始时间:' + dateFormatter(message.FLOP.BOTM); } - public flopCldt(){ - return '航班行李转盘事件' + public flopCldt(message, airports) { + if (Array.isArray(message.FLOP['CLDT']) && message.FLOP['CLDT'].length > 0) { + let belt = []; + for (let i = 0; i < message.FLOP['CLDT'].length; i++) { + belt.push(message.FLOP['CLDT'][i]['BELT']); + } + let set = new Set(belt); + return message.FLOP.FFID + '行李转盘分配为:' + Array.from(set).join(','); + } else if (Object.prototype.toString.call(message.FLOP['CLDT']) === '[object Object]') { + return message.FLOP.FFID + '行李转盘分配为:' + message.FLOP['CLDT']['BELT']; + } else { + return message.FLOP.FFID + '行李转盘分配为:'; + } } - public flopRout(){ - return '航班航线事件' + public flopRout(message, airports, citys) { + let mvin = message.FLOP.FFID.split('-')[2]; + let rout = []; + + if (Array.isArray(message.FLOP['ROUT']) && message.FLOP['ROUT'] > 0) { + for (let i = 0; i < message.FLOP['ROUT'].length; i++) { + let airportIndex = airports.findIndex(val => val.airportCodeIata === message.FLOP['ROUT'][i]['APCD']); + let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId); + rout.push(citys[cityIndex].cityNameChn); + } + } else if (Object.prototype.toString.call(message.FLOP['ROUT']) === '[object Object]') { + let airportIndex = airports.findIndex(val => val.airportCodeIata === message.FLOP['ROUT']['APCD']); + let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId); + rout.push(citys[cityIndex].cityNameChn); + } + if (mvin === 'A') { + rout.push('成都'); + } else if (mvin === 'D') { + rout.unshift('成都'); + } + return message.FLOP.FFID + '航线更改为:' + rout.join(' - '); } - public flopVipp(){ - return '航班VIP事件' + public flopVipp(message, airports, citys) { + return message.FLOP.FFID + 'VIP旅客:' + message.FLOP.VIPP + '人'; } - public flopHnag(){ + public flopHnag() { return '航班代理事件' } - public flopFlbg(){ - return '航班首末件行李到达事件' + public flopFlbg(message,airports,citys) { + return message.FLOP.FFID + '首末件行李到达时间消息'; } - public flopReno(){ - return '航班飞机号变更事件' + public flopReno(message,airports,citys) { + return message.FLOP.FFID + '更换飞机号:' + message.FLOP.RENO; } - public flopAbtm(){ - return '航班靠桥撤桥事件' + public flopAbtm(message,airports,citys) { + return message.FLOP.FFID + '靠桥撤桥消息'; } - public flopChdt(){ - return '航班上下轮档事件' + public flopChdt(message,airports,citys) { + return message.FLOP.FFID + '上下轮档消息'; } - public flopTrml(){ - return '航班航站楼事件' + public flopTrml(message,airports,citys) { + return message.FLOP.FFID + '航站楼:' + message.FLOP.TRML; } } \ No newline at end of file diff --git a/src/app/utils/cell-color-handle.ts b/src/app/utils/cell-color-handle.ts index b202a3a..0282364 100644 --- a/src/app/utils/cell-color-handle.ts +++ b/src/app/utils/cell-color-handle.ts @@ -14,7 +14,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return null; + return {}; } } else if (this.orderHandle.isDeptFlight(flight)) { if (flight['reaFlight']['RENO'] && flight['reaFlight']['RENO'].indexOf('(') > 0) { @@ -23,7 +23,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return null; + return {}; } } else { if ((flight['preFlight']['RENO'] && flight['preFlight']['RENO'].indexOf('(') > 0) || (flight['reaFlight']['RENO'] && flight['reaFlight']['RENO'].indexOf('(') > 0)) { @@ -32,7 +32,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return null; + return {}; } } } @@ -45,7 +45,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR }; } else { - return null; + return {}; } } else { if (flight['reaFlight']['ACTT']) { @@ -54,7 +54,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR }; } else { - return null; + return {}; } } } @@ -67,7 +67,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR }; } else { - return null; + return {}; } } else { if (flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) { @@ -76,7 +76,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR }; } else { - return null; + return {}; } } @@ -90,7 +90,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR }; } else { - return null; + return {}; } } else { if (flight['reaFlight']['SODT'] && !flight['reaFlight']['ESTT'] && !flight['reaFlight']['ACTT']) { @@ -99,7 +99,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR }; } else { - return null; + return {}; } } } @@ -112,7 +112,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return null; + return {}; } } else if (this.orderHandle.isDeptFlight(flight)) { if (flight['reaFlight']['PADT'] && flight['reaFlight']['PADT'].indexOf('(') > 0) { @@ -121,7 +121,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return null; + return {}; } } else { if ((flight['preFlight']['PADT'] && flight['preFlight']['PADT'].indexOf('(') > 0) || (flight['reaFlight']['PADT'] && flight['reaFlight']['PADT'].indexOf('(') > 0)) { @@ -130,13 +130,13 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return null; + return {}; } } } public psst(flight, colorSetting) { - + return {}; } public cotm(flight, colorSetting) { @@ -146,7 +146,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return false; + return {}; } } @@ -157,7 +157,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return false; + return {}; } } @@ -168,7 +168,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return false; + return {}; } } @@ -179,7 +179,7 @@ export class CellColorHandle { 'color': colorSetting.COL_COLOR } } else { - return false; + return {}; } } } \ No newline at end of file diff --git a/src/app/utils/flights-data-handle.ts b/src/app/utils/flights-data-handle.ts index 047d5cd..5bb3ff9 100644 --- a/src/app/utils/flights-data-handle.ts +++ b/src/app/utils/flights-data-handle.ts @@ -25,7 +25,7 @@ export class FlightsDataHandle { 'ERUT': this.transferHandle.erutFormatter.bind(this.transferHandle), 'FLIN': this.transferHandle.flinFormatter.bind(this.transferHandle), 'SODT': this.transferHandle.sodtFormatter.bind(this.transferHandle), - 'GATE': this.transferHandle.gateFormatter.bind(this.transferHandle), + 'GTDT': this.transferHandle.gateFormatter.bind(this.transferHandle), 'PADT': this.transferHandle.padtFormatter.bind(this.transferHandle), 'FLDT':this.transferHandle.fldtFormatter.bind(this.transferHandle) } diff --git a/src/app/utils/transfer-render-handle.ts b/src/app/utils/transfer-render-handle.ts index c17f205..cc5e66c 100644 --- a/src/app/utils/transfer-render-handle.ts +++ b/src/app/utils/transfer-render-handle.ts @@ -5,6 +5,8 @@ export class TransferRenderHandle { if (flight['GTDT']) { if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) { return timeFormatter(flight['GTDT'][0]['GCTM']); + } else if (Object.prototype.toString.call(flight['GTDT']) === '[object Object]') { + return timeFormatter(flight['GTDT']['GCTM']); } else { return ''; } @@ -28,8 +30,10 @@ export class TransferRenderHandle { } let set = new Set(abdg); return Array.from(set).join(','); + } else if (Object.prototype.toString.call(flight['ABTM']) === '[object Object]') { + return flight['ABTM']['ABDG']; } else { - return '' + return ''; } } else { return ''; @@ -43,6 +47,13 @@ export class TransferRenderHandle { return timeFormatter(flight['ABTM'][i]['AOTM']); } } + } else if (Object.prototype.toString.call(flight['ABTM']) === '[object Object]') { + if (flight['ABTM']['ABOP'] === 'A') { + return timeFormatter(flight['ABTM']['AOTM']); + } else { + return ''; + } + } else { return ''; } @@ -58,6 +69,13 @@ export class TransferRenderHandle { return timeFormatter(flight['ABTM'][i]['AOTM']); } } + } else if (Object.prototype.toString.call(flight['ABTM']) === '[object Object]') { + if (flight['ABTM']['ABOP'] === 'D') { + return timeFormatter(flight['ABTM']['AOTM']); + } else { + return ''; + } + } else { return ''; } @@ -74,6 +92,8 @@ export class TransferRenderHandle { } let set = new Set(belt); return Array.from(set).join(','); + } else if (Object.prototype.toString.call(flight['CLDT']) === '[object Object]') { + return flight['CLDT']['BELT']; } else { return ''; } @@ -90,6 +110,8 @@ export class TransferRenderHandle { } let set = new Set(chkc); return Array.from(set).join(','); + } else if (Object.prototype.toString.call(flight['CKDT']) === '[object Object]') { + return flight['CKDT']['CHKC']; } else { return ''; } @@ -101,6 +123,8 @@ export class TransferRenderHandle { if (flight['CKDT']) { if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) { return timeFormatter(flight['CKDT'][0]['CCTM']); + } else if (Object.prototype.toString.call(flight['CKDT']) === '[object Object]') { + return timeFormatter(flight['CKDT']['CCTM']); } else { return ''; } @@ -112,6 +136,8 @@ export class TransferRenderHandle { if (flight['CKDT']) { if (Array.isArray(flight['CKDT']) && flight['CKDT'].length > 0) { return timeFormatter(flight['CKDT'][0]['COTM']); + } else if (Object.prototype.toString.call(flight['CKDT']) === '[object Object]') { + return timeFormatter(flight['CKDT']['COTM']); } else { return ''; } @@ -127,6 +153,12 @@ export class TransferRenderHandle { return timeFormatter(flight['CHOT'][i]['CHTM']); } } + } else if (Object.prototype.toString.call(flight['CHOT']) === '[object Object]') { + if (flight['CHOT']['CHID'] === 'ON') { + return timeFormatter(flight['CHOT']['CHTM']); + } else { + return ''; + } } else { return ''; } @@ -142,6 +174,12 @@ export class TransferRenderHandle { return timeFormatter(flight['CHOT'][i]['CHTM']); } } + } else if (Object.prototype.toString.call(flight['CHOT']) === '[object Object]') { + if (flight['CHOT']['CHID'] === 'OFF') { + return timeFormatter(flight['CHOT']['CHTM']); + } else { + return ''; + } } else { return ''; } @@ -159,12 +197,14 @@ export class TransferRenderHandle { public chutFormatter(flight) { if (flight['CHDT']) { if (Array.isArray(flight['CHDT']) && flight['CHDT'].length > 0) { - let chdt = []; + let chut = []; for (let i = 0; i < flight['CHDT'].length; i++) { - chdt.push(flight['CHDT'][i]['CHUT']); + chut.push(flight['CHDT'][i]['CHUT']); } - let set = new Set(chdt); + let set = new Set(chut); return Array.from(set).join(','); + } else if (Object.prototype.toString.call(flight['CHDT']) === '[object Object]') { + return flight['CHDT']['CHUT']; } else { return ''; } @@ -182,12 +222,14 @@ export class TransferRenderHandle { public psstFormatter(flight) { if (flight['PSDT']) { if (Array.isArray(flight['PSDT']) && flight['PSDT'].length > 0) { - let chkc = []; + let psst = []; for (let i = 0; i < flight['PSDT'].length; i++) { - chkc.push(flight['PSDT'][i]['PSST']); + psst.push(flight['PSDT'][i]['PSST']); } - let set = new Set(chkc); + let set = new Set(psst); return Array.from(set).join(','); + } else if (Object.prototype.toString.call(flight['PSDT']) === '[object Object]') { + return flight['PSDT']['PSST']; } else { return ''; } @@ -221,6 +263,8 @@ export class TransferRenderHandle { erut.push(flight['ERUT'][i]['APCD']); } return erut.join(' - '); + } else if (Object.prototype.toString.call(flight['ERUT']) === '[object Object]') { + return flight['ERUT']['APCD']; } else { return ''; } @@ -257,6 +301,8 @@ export class TransferRenderHandle { } let set = new Set(gate); return Array.from(set).join(','); + } else if (Object.prototype.toString.call(flight['GTDT']) === '[object Object]') { + return flight['GTDT']['GATE']; } else { return ''; } @@ -271,7 +317,7 @@ export class TransferRenderHandle { return ''; } } - public fldtFormatter(flight){ + public fldtFormatter(flight) { if (flight['SODT']) { return dateWithNotimeFormatter(flight['SODT']); } else {