From 9815df7b0f9720a120fb96405d1aa55265cdcd58 Mon Sep 17 00:00:00 2001 From: zhouyuejun <505127606@qq.com> Date: Mon, 24 Dec 2018 17:18:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=B7=E6=96=B0=E5=8F=8A?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=88=AA=E7=8F=ADID=E6=96=B9=E4=BE=BF?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/main/main.component.html | 2 + src/app/pages/main/main.component.ts | 63 +++++++++++++++++++++++-- src/app/services/http-client.service.ts | 4 -- src/app/utils/flights-data-handle.ts | 5 ++ 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/src/app/pages/main/main.component.html b/src/app/pages/main/main.component.html index b5363e0..b34be1a 100644 --- a/src/app/pages/main/main.component.html +++ b/src/app/pages/main/main.component.html @@ -133,6 +133,7 @@ 序号 重要提示 + 航班ID {{airline_col.COL_CN}} @@ -158,6 +159,7 @@ + {{airline_row['renderFlight']['FLID']}} {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index 287c394..e0e2f43 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -307,7 +307,7 @@ export class MainComponent implements OnInit { 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); + const toastCfg = new ToastConfig(ToastType.SUCCESS, '', alertText, 600000); this.toastService.toast(toastCfg); } } @@ -354,8 +354,65 @@ export class MainComponent implements OnInit { * 刷新 */ refresh() { - const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '刷新成功!', 3000); - this.toastService.toast(toastCfg); + this.operateSpinServiceService.showSpin(); + this.canHandleDynamicMessage = false; + this.canHandleDynamicAlert = false; + this.SEARCH = ''; //手动输入条件 + this.LASTSEARCH = ''; + this.FLT_POS = 1; //过滤还是定位 + this.SEL_COL = ''; //选择列名 + this.LAST_SEL_COL = ''; + this.filterItems = { + ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + FTSS: '', //运营状态 + TRML: '', //航站楼 + Abnormal_state: '', //异常状态 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 + } + + /** 用户设置 */ + this.httpCilent.get('/adminapi/settings/uisettings').subscribe( + data => { + 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); + } else if (element.groupCode === 'userSettingMsgAlert') { + this.airline_message_alert = JSON.parse(element.settingContent).targetList; + } + }); + } + ) + //获取航班动态信息 + this.httpCilent.get('/msgexchangeapi/all/flights').subscribe( + data => { + this.raw_data = data.body; + + //查找链接航班并将其组合成一条数据 + this.combined_data = []; + let combined_linked_data = this.dataHandle.findLinkFlights(this.raw_data); + combined_linked_data.forEach(element => { + let flights_item = this.dataHandle.flightsRenderTransfer(element, this.col_lists); + this.combined_data.push(flights_item); + }); + + let combined_data = [] + this.combined_data.forEach(item => { + 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); + const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '刷新成功!', 3000); + this.toastService.toast(toastCfg); + } + ) } diff --git a/src/app/services/http-client.service.ts b/src/app/services/http-client.service.ts index 03062a1..3f7aa4e 100644 --- a/src/app/services/http-client.service.ts +++ b/src/app/services/http-client.service.ts @@ -109,16 +109,12 @@ export class HttpClientService { * @param observable */ commonProcess(observable: Observable): Observable { - // this.spinService.spin(true); return Observable.create((observer) => { observable.subscribe(res => { - // this.spinService.spin(false); observer.next(res); }, (err) => { - // this.spinService.spin(false); observer.error(err); }, () => { - // this.spinService.spin(false); observer.complete(); }); }); diff --git a/src/app/utils/flights-data-handle.ts b/src/app/utils/flights-data-handle.ts index 1e44957..3bfee42 100644 --- a/src/app/utils/flights-data-handle.ts +++ b/src/app/utils/flights-data-handle.ts @@ -81,18 +81,23 @@ export class FlightsDataHandle { flights_item = Object.assign({}, item) if (flights_item['preFlight'] && !flights_item['reaFlight']) { + render_flight['FLID'] = flights_item['preFlight']['FLID'] for (let i = 0; i < col_lists.length; i++) { let key = col_lists[i]['COL_CODE']; render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](flights_item['preFlight']) : flights_item['preFlight'][key]; } flights_item['renderFlight'] = render_flight; } else if (!flights_item['preFlight'] && flights_item['reaFlight']) { + render_flight['FLID'] = flights_item['reaFlight']['FLID'] for (let i = 0; i < col_lists.length; i++) { let key = col_lists[i]['COL_CODE'] render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](flights_item['reaFlight']) : flights_item['reaFlight'][key]; } flights_item['renderFlight'] = render_flight; } else { + render_flight['FLID'] = flights_item['preFlight']['FLID'] + ' / ' + flights_item['reaFlight']['FLID']; + render_pre_flight['FLID'] = flights_item['preFlight']['FLID']; + render_rea_flight['FLID'] = flights_item['reaFlight']['FLID']; for (let i = 0; i < col_lists.length; i++) { let preHasValue, reaHasValue; let key = col_lists[i]['COL_CODE'];