diff --git a/src/app/pages/historical-data/historical-data.component.ts b/src/app/pages/historical-data/historical-data.component.ts index 146537c..8e6bc8c 100644 --- a/src/app/pages/historical-data/historical-data.component.ts +++ b/src/app/pages/historical-data/historical-data.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit,ViewChild,Renderer2 } from '@angular/core'; +import { Component, OnInit, ViewChild, Renderer2 } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { ToastService } from '../../components/toast/toast.service'; @@ -116,7 +116,7 @@ export class HistoricalDataComponent implements OnInit { } ) //获取航班动态信息 - this.httpCilent.post('/adminapi/hitFlightData/list',{ hstFLightTime: '2018-11-22' }).subscribe( + this.httpCilent.post('/adminapi/hitFlightData/list').subscribe( data => { this.raw_data = data.body; @@ -225,8 +225,53 @@ export class HistoricalDataComponent implements OnInit { * 刷新 */ refresh() { - const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '刷新成功!', 3000); - this.toastService.toast(toastCfg); + this.operateSpinServiceService.showSpin(); + this.SEARCH = ''; //手动输入条件 + this.FLT_POS = 1; //过滤还是定位 + this.SEL_COL = ''; //选择列名 + this.filterItems = { + ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + 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; + } + }) + } + ) + //获取航班动态信息 + this.httpCilent.post('/adminapi/hitFlightData/list').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/pages/main/main.component.html b/src/app/pages/main/main.component.html index b34be1a..9656e67 100644 --- a/src/app/pages/main/main.component.html +++ b/src/app/pages/main/main.component.html @@ -142,21 +142,21 @@ [ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}"> {{i+1}} - - - - - - - - {{airline_row['renderFlight']['FLID']}} diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index e0e2f43..e43009c 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -43,6 +43,7 @@ export class MainComponent implements OnInit { ).subscribe( (event: NavigationEnd) => { if (event.urlAfterRedirects === '/app/main') { + // this.operateSpinServiceService.showSpin(); this.httpCilent.get('/adminapi/settings/uisettings').subscribe( data => { data.body.forEach(element => { @@ -56,6 +57,7 @@ export class MainComponent implements OnInit { } }); this.changeDetectorRef.detectChanges(); + // this.operateSpinServiceService.hideSpin(); } ) } @@ -123,6 +125,7 @@ export class MainComponent implements OnInit { let data = JSON.parse(event as string); if (data.topic === 'schd') { let message = JSON.parse(data.message); + console.log(message); //是否可以开始处理动态消息 if (this.canHandleDynamicMessage) { this.dynamicMessageHandle(message); @@ -131,6 +134,7 @@ 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 { @@ -828,13 +832,17 @@ export class MainComponent implements OnInit { if (this.orderHandle.isArriFlight(flight)) { return false; } else { - if (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0) { - if (parseInt(flight['preFlight']['DELY'][0]['DURA']) - 30 > 0) { - return true; + try { + if (flight['reaFlight']['DELY'] && Array.isArray(flight['reaFlight']['DELY']) && flight['reaFlight']['DELY'].length > 0) { + if (parseInt(flight['preFlight']['DELY'][0]['DURA']) - 30 > 0) { + return true; + } else { + return false; + } } else { return false; } - } else { + } catch (error) { return false; } } diff --git a/src/app/pages/pages.component.ts b/src/app/pages/pages.component.ts index 6ff0b59..22dd0c2 100644 --- a/src/app/pages/pages.component.ts +++ b/src/app/pages/pages.component.ts @@ -205,8 +205,17 @@ export class PagesComponent implements OnInit { } ngOnInit() { - this.user_name = JSON.parse(sessionStorage.getItem('userInfo')).login_name; - this.role_type = JSON.parse(sessionStorage.getItem('userInfo')).real_name; + if (sessionStorage.getItem('userInfo')) { + this.user_name = JSON.parse(sessionStorage.getItem('userInfo')).login_name; + this.role_type = JSON.parse(sessionStorage.getItem('userInfo')).real_name; + } else { + let cookieMsg = ['SESSION', 'token'] + cookieMsg.forEach(element => { + this.delCookie(element) + }) + this.router.navigate(['/login']); + } + let activeRoute = this.router.url; this.selectActiveMenu(this.menuData, activeRoute); @@ -246,6 +255,10 @@ export class PagesComponent implements OnInit { confirmLogout() { this.httpClient.post('/logout').subscribe( data => { + let sessionStorageMsg = ['userInfo'] + sessionStorageMsg.forEach(element => { + sessionStorage.removeItem(element) + }) const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '退出系统成功!', 3000); this.toastService.toast(toastCfg); this.router.navigate(['/login']); @@ -253,4 +266,10 @@ export class PagesComponent implements OnInit { ) } + public delCookie($name) { + let myDate = new Date(); + myDate.setTime(-1000); + document.cookie = $name + "=''; expires=" + myDate.toUTCString(); + } + } diff --git a/src/index.html b/src/index.html index 7ae4255..fec1e36 100644 --- a/src/index.html +++ b/src/index.html @@ -36,7 +36,7 @@ } } - .spin-container { + /* .spin-container { position: fixed; top: 0; left: 0; @@ -86,18 +86,18 @@ border: 4px solid transparent; border-top-color: #e7ba08; animation: spin 1.5s linear infinite - } + } */ -
+ +