From 4582b465ee62d1d9b79cb66a4b41d151f9037640 Mon Sep 17 00:00:00 2001 From: zhouyuejun <505127606@qq.com> Date: Wed, 21 Nov 2018 18:55:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=88=AA=E7=8F=AD=E4=BF=A1=E6=81=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/login/login.component.ts | 35 +- src/app/pages/basic-data-service.ts | 19 +- src/app/pages/main/main.component.html | 7 +- src/app/pages/main/main.component.ts | 361 +++++++++++++++------ src/app/pipes/data-formatter.pipe.ts | 75 ----- src/app/pipes/pipes.module.ts | 6 - src/app/pipes/screening-flight.pipe.ts | 29 -- src/app/services/http-client.service.ts | 96 +----- src/app/utils/abdg-formatter.ts | 20 ++ src/app/utils/actt-formatter.ts | 11 + src/app/utils/aotm_a-formatter.ts | 24 ++ src/app/utils/aotm_d-formatter.ts | 24 ++ src/app/utils/arri-dept.ts | 9 - src/app/utils/belt-formatter.ts | 20 ++ src/app/utils/botm-formatter.ts | 13 + src/app/utils/cctm-formatter.ts | 15 + src/app/utils/chkc-formatter.ts | 19 ++ src/app/utils/chtm_off-formatter.ts | 24 ++ src/app/utils/chtm_on-formatter.ts | 24 ++ src/app/utils/chut-formatter.ts | 19 ++ src/app/utils/cotm-formatter.ts | 15 + src/app/utils/data-formatter.ts | 25 +- src/app/utils/erut-formatter.ts | 18 + src/app/utils/estt-formatter.ts | 11 + src/app/utils/flight-type.ts | 11 - src/app/utils/flin-formatter.ts | 16 + src/app/utils/gate-formatter.ts | 21 ++ src/app/utils/gctm-formatter.ts | 16 + src/app/utils/lacl-formatter.ts | 11 + src/app/utils/mvin-formatter.ts | 14 + src/app/utils/padt-formatter.ts | 11 + src/app/utils/psst-formatter.ts | 19 ++ src/app/utils/route-type.ts | 11 - src/app/utils/sodt-formatter.ts | 11 + src/app/utils/time-formatter.ts | 36 ++ src/assets/mock-data/airline-col_code.json | 167 ++++++++-- 36 files changed, 862 insertions(+), 401 deletions(-) delete mode 100644 src/app/pipes/data-formatter.pipe.ts delete mode 100644 src/app/pipes/screening-flight.pipe.ts create mode 100644 src/app/utils/abdg-formatter.ts create mode 100644 src/app/utils/actt-formatter.ts create mode 100644 src/app/utils/aotm_a-formatter.ts create mode 100644 src/app/utils/aotm_d-formatter.ts delete mode 100644 src/app/utils/arri-dept.ts create mode 100644 src/app/utils/belt-formatter.ts create mode 100644 src/app/utils/botm-formatter.ts create mode 100644 src/app/utils/cctm-formatter.ts create mode 100644 src/app/utils/chkc-formatter.ts create mode 100644 src/app/utils/chtm_off-formatter.ts create mode 100644 src/app/utils/chtm_on-formatter.ts create mode 100644 src/app/utils/chut-formatter.ts create mode 100644 src/app/utils/cotm-formatter.ts create mode 100644 src/app/utils/erut-formatter.ts create mode 100644 src/app/utils/estt-formatter.ts delete mode 100644 src/app/utils/flight-type.ts create mode 100644 src/app/utils/flin-formatter.ts create mode 100644 src/app/utils/gate-formatter.ts create mode 100644 src/app/utils/gctm-formatter.ts create mode 100644 src/app/utils/lacl-formatter.ts create mode 100644 src/app/utils/mvin-formatter.ts create mode 100644 src/app/utils/padt-formatter.ts create mode 100644 src/app/utils/psst-formatter.ts delete mode 100644 src/app/utils/route-type.ts create mode 100644 src/app/utils/sodt-formatter.ts create mode 100644 src/app/utils/time-formatter.ts diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 3a7efa8..caf6e01 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -7,6 +7,7 @@ import { ToastService } from '../components/toast/toast.service'; import { ToastConfig, ToastType } from '../components/toast/toast-model'; import { HttpClientService } from '../services/http-client.service'; +import { HttpHeaders } from '@angular/common/http'; @Component({ selector: 'app-login', @@ -19,34 +20,30 @@ export class LoginComponent implements OnInit { private formBuilder: FormBuilder, private router: Router, private route: ActivatedRoute, - private httpClient:HttpClientService, + private httpClient: HttpClientService, private toastService: ToastService, ) { } loginForm: FormGroup = this.formBuilder.group({ - 'username': ['admin', [Validators.required, Validators.minLength(5), Validators.maxLength(15)]], - 'password': ['admin', [Validators.required, Validators.minLength(5), Validators.maxLength(15)]] + 'username': ['', [Validators.required, Validators.minLength(5), Validators.maxLength(15)]], + 'password': ['', [Validators.required, Validators.minLength(5), Validators.maxLength(15)]] }) ngOnInit() { } _submit() { - // this.httpClient.post('/login',this.loginForm.value).subscribe( - // data=>{ - // console.log(data) - // } - // ) - - - let date = new Date() - // date.setTime(date.getTime() + 10 * 60 * 1000) - //为了测试方便,把用户登录缓存时间加长 - date.setTime(date.getTime() + 10 * 60 * 1000000000000) - document.cookie = 'token=cnlpYWRtaW4lM0FyeWlhZG1pbg==;path=/;expires=' + date.toUTCString() - - const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '登录成功!', 3000); - this.toastService.toast(toastCfg); - this.router.navigate(['../app'], { relativeTo: this.route }) + this.httpClient.post('/login', this.loginForm.value).subscribe( + data => { + if(data.is_success){ + const toastCfg = new ToastConfig(ToastType.SUCCESS, '', '登录成功!', 3000); + this.toastService.toast(toastCfg); + this.router.navigate(['../app'], { relativeTo: this.route }) + }else{ + const toastCfg = new ToastConfig(ToastType.ERROR, '', '登录失败!', 3000); + this.toastService.toast(toastCfg); + } + } + ) } } diff --git a/src/app/pages/basic-data-service.ts b/src/app/pages/basic-data-service.ts index 9b9a0bd..50cee09 100644 --- a/src/app/pages/basic-data-service.ts +++ b/src/app/pages/basic-data-service.ts @@ -4,6 +4,8 @@ import { Subject, forkJoin, zip } from 'rxjs' @Injectable() export class BasicDataService { + public flightStatus:Array; + public flightStatus_subject = new Subject(); public checkin_group: Array; public checkin_group_subject = new Subject(); public gate: Array; @@ -36,7 +38,7 @@ export class BasicDataService { ) { } loadBasicData() { - console.log('---') + let flightStatusHttp = this.httpClient.get('/adminapi/basicdata/sysFlightStatus'); let checkinGroupHttp = this.httpClient.get('/adminapi/basicdata/checkinGroups'); let gateHttp = this.httpClient.get('/adminapi/basicdata/ormsGates'); let terminalHttp = this.httpClient.get('/adminapi/basicdata/ormsTerminals'); @@ -51,6 +53,7 @@ export class BasicDataService { let terminalAreaHttp = this.httpClient.get('/adminapi/basicdata/ormsTerminalareas'); let airlineHttp = this.httpClient.get('/adminapi/basicdata/sysAirlines'); zip( + flightStatusHttp, checkinGroupHttp, gateHttp, terminalHttp, @@ -66,6 +69,7 @@ export class BasicDataService { airlineHttp ).subscribe( ([ + flightStatusRes, checkinGroupRes, gateRes, terminalRes, @@ -80,12 +84,15 @@ export class BasicDataService { terminalAreaRes, airlineRes ]) => { + console.log('---') + this.flightStatus = flightStatusRes.body; + this.flightStatus_subject.next(flightStatusRes.body); this.checkin_group = checkinGroupRes.body; this.checkin_group_subject.next(checkinGroupRes.body); this.gate = gateRes.body; this.gate_subject.next(gateRes.body); this.terminal = terminalRes.body; - this.terminal_area_subject.next(terminalRes.body); + this.terminal_subject.next(terminalRes.body); this.chut = chutRes.body; this.chut_subject.next(chutRes.body); this.stand = standRes.body; @@ -94,10 +101,6 @@ export class BasicDataService { this.carousel_subject.next(carouselRes.body); this.checkin_desk = checkinDeskRes.body; this.checkin_desk_subject.next(checkinDeskRes.body); - this.airport = airportRes.body; - this.airport_subject.next(airportRes.body); - this.city = cityRes.body; - this.city_subject.next(cityRes.body); this.aircraft_type = aircraftTypeRes.body; this.aircraft_type_subject.next(aircraftTypeRes.body); this.aircraft = aircraftRes.body; @@ -106,6 +109,10 @@ export class BasicDataService { this.terminal_area_subject.next(terminalAreaRes.body); this.airline = airlineRes.body; this.airline_subject.next(airlineRes.body); + this.city = cityRes.body; + this.city_subject.next(cityRes.body); + this.airport = airportRes.body; + this.airport_subject.next(airportRes.body); } ) } diff --git a/src/app/pages/main/main.component.html b/src/app/pages/main/main.component.html index a8aff26..f378930 100644 --- a/src/app/pages/main/main.component.html +++ b/src/app/pages/main/main.component.html @@ -3,8 +3,9 @@
- +
@@ -75,8 +77,7 @@
diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index 2107d14..b420765 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -5,10 +5,31 @@ import { HttpClientService } from '../../services/http-client.service'; import { BasicDataService } from '../basic-data-service' import dateFormatter from '../../utils/data-formatter'; -import routeType from '../../utils/route-type'; -import flightType from '../../utils/flight-type'; -import arriDept from '../../utils/arri-dept'; -import { HttpParams } from '@angular/common/http'; +import timeFormatter from '../../utils/time-formatter'; + +import gctmFormatter from '../../utils/gctm-formatter'; +import botmFormatter from '../../utils/botm-formatter'; +import abdgFormatter from '../../utils/abdg-formatter'; +import aotm_aFormatter from '../../utils/aotm_a-formatter'; +import aotm_dFormatter from '../../utils/aotm_d-formatter'; +import beltFormatter from '../../utils/belt-formatter'; +import chkcFormatter from '../../utils/chkc-formatter'; +import cctmFormatter from '../../utils/cctm-formatter'; +import cotmFormatter from '../../utils/cotm-formatter'; +import chtmOnFormatter from '../../utils/chtm_on-formatter'; +import chtmOffFormatter from '../../utils/chtm_off-formatter'; +import laclFormatter from '../../utils/lacl-formatter'; +import chutFormatter from '../../utils/chut-formatter'; +import acttFormatter from '../../utils/actt-formatter'; +import psstFormatter from '../../utils/psst-formatter'; +import esttFormatter from '../../utils/estt-formatter'; +import mvinFormatter from '../../utils/mvin-formatter'; +import erutFormatter from '../../utils/erut-formatter'; +import flinFormatter from '../../utils/flin-formatter'; +import sodtFormatter from '../../utils/sodt-formatter'; +import gateFormatter from '../../utils/gate-formatter'; +import padtFormatter from '../../utils/padt-formatter'; + import * as $ from 'jquery'; @Component({ @@ -25,19 +46,10 @@ export class MainComponent implements OnInit { ) { } //各项基础数据 - public checkin_group: Array; - public gate: Array; - public terminal: Array; - public chut: Array; - public stand: Array; - public carousel: Array; - public checkin_desk: Array; - public airport: Array; - public city: Array; - public aircraft_type: Array; - public aircraft: Array; - public terminal_area: Array; - public airline: Array; + public flightStatus: Array; + public airports: Array; + public citys: Array;; + public airlines: Array; public raw_data: Array = []; //原始数据,即航班计划 public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 @@ -48,24 +60,32 @@ export class MainComponent implements OnInit { public row_state: any = { renderFlight: {} }; public formatter = { - 'MVIN': { - 'A': '到达', - 'D': '出发', - 'DF': '其他' - }, - 'FLIN': { - 'D': '国内', - 'I': '国际', - 'M': '混合', - 'R': '地区', - 'DF': '其他' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter + 'GCTM': gctmFormatter, + 'BOTM': botmFormatter, + 'ABDG': abdgFormatter, + 'AOTM_A': aotm_aFormatter, + 'AOTM_D': aotm_dFormatter, + 'BELT': beltFormatter, + 'CHKC': chkcFormatter, + 'CCTM': cctmFormatter, + 'COTM': cotmFormatter, + 'CHTM_ON': chtmOnFormatter, + 'CHTM_OFF': chtmOffFormatter, + 'LACL': laclFormatter, + 'CHUT': chutFormatter, + 'ACTT': acttFormatter, + 'PSST': psstFormatter, + 'ESTT': esttFormatter, + 'MVIN': mvinFormatter, + 'ERUT': erutFormatter, + 'FLIN': flinFormatter, + 'SODT': sodtFormatter, + 'GATE': gateFormatter, + 'PADT': padtFormatter } ngOnInit() { + // this.getBasicData() this.changeDetectorRef.detach(); /* 获取显示列 */ this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe( @@ -85,8 +105,6 @@ export class MainComponent implements OnInit { }); let combined_linked_data = this.raw_data; - // this.combined_data = this.raw_data - //查找链接航班并将其组合成一条数据 for (let i = 0; i < combined_linked_data.length; i++) { if (combined_linked_data[i]['MVIN'] === 'D') { @@ -111,7 +129,7 @@ export class MainComponent implements OnInit { for (let i = 0; i < this.col_lists.length; i++) { let key = this.col_lists[i]['COL_CODE'] - render_flight[key] = typeof (this.formatter[key]) === 'function' ? this.formatter[key](row_flights['preFlight'][key], 1) : this.formatter[key] ? this.formatter[key][row_flights['preFlight'][key]] : row_flights['preFlight'][key]; + render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](row_flights['preFlight']) : row_flights['preFlight'][key]; } row_flights['renderFlight'] = render_flight; @@ -119,7 +137,7 @@ export class MainComponent implements OnInit { row_flights['reaFlight'] = element; for (let i = 0; i < this.col_lists.length; i++) { let key = this.col_lists[i]['COL_CODE'] - render_flight[key] = typeof (this.formatter[key]) === 'function' ? this.formatter[key](row_flights['reaFlight'][key], 1) : this.formatter[key] ? this.formatter[key][row_flights['reaFlight'][key]] : row_flights['reaFlight'][key]; + render_flight[key] = this.formatter.hasOwnProperty(key) ? this.formatter[key](row_flights['reaFlight']) : row_flights['reaFlight'][key]; } row_flights['renderFlight'] = render_flight; @@ -132,19 +150,47 @@ export class MainComponent implements OnInit { for (let i = 0; i < this.col_lists.length; i++) { let key = this.col_lists[i]['COL_CODE'] if (this.formatter.hasOwnProperty(key)) { - if (typeof (this.formatter[key]) === 'function') { - render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key](row_flights['preFlight'][key], 1)) : (this.formatter[key](row_flights['preFlight'][key], 1) + '/' + this.formatter[key](row_flights['reaFlight'][key], 1)); - render_pre_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1); - render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1); + let preHasValue = this.formatter[key](row_flights['preFlight']); + let reaHasValue = this.formatter[key](row_flights['reaFlight']); + if (preHasValue && !reaHasValue) { + render_flight[key] = preHasValue; + } else if (!preHasValue && reaHasValue) { + render_flight[key] = reaHasValue; + } else if (preHasValue && reaHasValue) { + if (preHasValue === reaHasValue) { + render_flight[key] = preHasValue + } else { + if (key === 'ERUT') { + render_flight[key] = preHasValue.split(' - ').slice(0, -1).join(' - ') + ' - ' + reaHasValue; + } else { + render_flight[key] = preHasValue + ' / ' + reaHasValue; + } + // render_flight[key] = preHasValue + ' / ' + reaHasValue; + } } else { - render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key][row_flights['preFlight'][key]]) : (this.formatter[key][row_flights['preFlight'][key]] + '/' + this.formatter[key][row_flights['reaFlight'][key]]); - render_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]]; - render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]]; + render_flight[key] = ''; } + render_pre_flight[key] = preHasValue; + render_rea_flight[key] = reaHasValue; } else { - render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (row_flights['preFlight'][key]) : (row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key]); - render_pre_flight[key] = row_flights['preFlight'][key]; - render_rea_flight[key] = row_flights['reaFlight'][key]; + let preHasValue = row_flights['preFlight'][key]; + let reaHasValue = row_flights['reaFlight'][key] + if (preHasValue && !reaHasValue) { + render_flight[key] = preHasValue; + } else if (!preHasValue && reaHasValue) { + render_flight[key] = reaHasValue; + } else if (preHasValue && reaHasValue) { + if (preHasValue === reaHasValue) { + render_flight[key] = preHasValue + } else { + render_flight[key] = preHasValue + ' / ' + reaHasValue; + } + } else { + render_flight[key] = ''; + } + // render_flight[key] = (row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key]); + render_pre_flight[key] = preHasValue; + render_rea_flight[key] = reaHasValue; } } row_flights['renderFlight'] = render_flight; @@ -154,7 +200,32 @@ export class MainComponent implements OnInit { this.combined_data.push(row_flights) }) - this.doSequence(this.combined_data); + //从基础数据服务中拿出部分基础数据 + this.flightStatus = this.basicDataService.flightStatus; + this.airlines = this.basicDataService.airline; + this.citys = this.basicDataService.city; + this.airports = this.basicDataService.airport; + + if (this.airports && this.airports.length > 0) { + this.basicDataTransHandle(); + } else { + this.basicDataService.flightStatus_subject.subscribe( + val => this.flightStatus = val + ); + this.basicDataService.airline_subject.subscribe( + val => this.airlines = val + ); + this.basicDataService.city_subject.subscribe( + val => this.citys = val + ); + this.basicDataService.airport_subject.subscribe( + val => { + this.airports = val; + this.basicDataTransHandle(); + } + ); + } + } ) @@ -172,59 +243,138 @@ export class MainComponent implements OnInit { /** * 获取基础数据 */ - getBasicData() { - this.checkin_group = this.basicDataService.checkin_group; - this.basicDataService.checkin_group_subject.subscribe( - val => this.checkin_group = val - ); - this.gate = this.basicDataService.gate; - this.basicDataService.gate_subject.subscribe( - val => this.gate = val - ); - this.terminal = this.basicDataService.terminal; - this.basicDataService.terminal_subject.subscribe( - val => this.terminal = val - ); - this.chut = this.basicDataService.chut; - this.basicDataService.chut_subject.subscribe( - val => this.chut = val - ); - this.stand = this.basicDataService.stand; - this.basicDataService.stand_subject.subscribe( - val => this.stand = val - ); - this.carousel = this.basicDataService.carousel; - this.basicDataService.carousel_subject.subscribe( - val => this.carousel = val - ); - this.checkin_desk = this.basicDataService.checkin_desk; - this.basicDataService.checkin_desk_subject.subscribe( - val => this.checkin_desk = val - ); - this.airport = this.basicDataService.airport; - this.basicDataService.airport_subject.subscribe( - val => this.airport = val - ); - this.city = this.basicDataService.city; - this.basicDataService.city_subject.subscribe( - val => this.city = val - ); - this.aircraft_type = this.basicDataService.aircraft_type; - this.basicDataService.aircraft_type_subject.subscribe( - val => this.aircraft_type = val - ); - this.aircraft = this.basicDataService.aircraft; - this.basicDataService.aircraft_subject.subscribe( - val => this.aircraft = val - ); - this.terminal_area = this.basicDataService.terminal_area; - this.basicDataService.terminal_area_subject.subscribe( - val => this.terminal_area = val - ); - this.airline = this.basicDataService.airline; - this.basicDataService.airline_subject.subscribe( - val => this.airline = val - ); + // getBasicData() { + // this.checkin_group = this.basicDataService.checkin_group; + // this.basicDataService.checkin_group_subject.subscribe( + // val => this.checkin_group = val + // ); + // this.gate = this.basicDataService.gate; + // this.basicDataService.gate_subject.subscribe( + // val => this.gate = val + // ); + // this.terminals = this.basicDataService.terminal; + // this.basicDataService.terminal_subject.subscribe( + // val => { + // this.terminals = val; + // this.changeDetectorRef.detectChanges(); + // } + // ); + // this.chut = this.basicDataService.chut; + // this.basicDataService.chut_subject.subscribe( + // val => this.chut = val + // ); + // this.stand = this.basicDataService.stand; + // this.basicDataService.stand_subject.subscribe( + // val => this.stand = val + // ); + // this.carousel = this.basicDataService.carousel; + // this.basicDataService.carousel_subject.subscribe( + // val => this.carousel = val + // ); + // this.checkin_desk = this.basicDataService.checkin_desk; + // this.basicDataService.checkin_desk_subject.subscribe( + // val => this.checkin_desk = val + // ); + // this.airports = this.basicDataService.airport; + // this.basicDataService.airport_subject.subscribe( + // val => this.airports = val + // ); + // this.citys = this.basicDataService.city; + // this.basicDataService.city_subject.subscribe( + // val => this.citys = val + // ); + // this.aircraft_type = this.basicDataService.aircraft_type; + // this.basicDataService.aircraft_type_subject.subscribe( + // val => this.aircraft_type = val + // ); + // this.aircraft = this.basicDataService.aircraft; + // this.basicDataService.aircraft_subject.subscribe( + // val => this.aircraft = val + // ); + // this.terminal_area = this.basicDataService.terminal_area; + // this.basicDataService.terminal_area_subject.subscribe( + // val => this.terminal_area = val + // ); + // this.airlines = this.basicDataService.airline; + // this.basicDataService.airline_subject.subscribe( + // val => { + // this.airlines = val; + // this.changeDetectorRef.detectChanges(); + // } + // ); + // this.changeDetectorRef.detectChanges(); + // } + + basicDataTransHandle() { + this.combined_data.forEach(item => { + if (this.isArriFlight(item) || this.isDeptFlight(item)) { + //航线处理 + let erutCodeArray = item['renderFlight']['ERUT'].split(' - '); + let erutChnArray = [] + for (let i = 0; i < erutCodeArray.length; i++) { + let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]); + let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId); + erutChnArray.push(this.citys[cityIndex].cityNameChn); + } + item['renderFlight']['ERUT'] = erutChnArray.join(' - '); + //航空公司处理 + let airlineIndex = this.airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']); + item['renderFlight']['ALCD'] = this.airlines[airlineIndex].airlineName; + //运营状态处理 + item['renderFlight']['FTSS'] = this.flightStatus.find(val => val.sttc === item['renderFlight']['FTSS']).stdc + } else { + //航线处理 + let erutLinkCodeArray = item['renderFlight']['ERUT'].split(' - '); + let erutLinkChnArray = [] + for (let i = 0; i < erutLinkCodeArray.length; i++) { + let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]); + let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId); + erutLinkChnArray.push(this.citys[cityIndex].cityNameChn); + } + item['renderFlight']['ERUT'] = erutLinkChnArray.join(' - '); + //航空公司处理 + let airlineLinkIndex = this.airlines.findIndex(val => val.airlineCode === item['renderFlight']['ALCD']); + item['renderFlight']['ALCD'] = this.airlines[airlineLinkIndex].airlineName; + //运营状态处理 + let ftssLinkCodeArray = item['renderFlight']['FTSS'].split(' / '); + let ftssChnArray = []; + for (let i = 0; i < ftssLinkCodeArray.length; i++) { + ftssChnArray.push(this.flightStatus.find(val => val.sttc === ftssLinkCodeArray[i]).stdc) + } + item['renderFlight']['FTSS'] = ftssChnArray.join(' / '); + + //航线处理 + let erutPreCodeArray = item['renderPreFlight']['ERUT'].split(' - '); + let erutPreChnArray = [] + for (let i = 0; i < erutPreCodeArray.length; i++) { + let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]); + let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId); + erutPreChnArray.push(this.citys[cityIndex].cityNameChn); + } + item['renderPreFlight']['ERUT'] = erutPreChnArray.join(' - '); + //航空公司处理 + let airlinePreIndex = this.airlines.findIndex(val => val.airlineCode === item['renderPreFlight']['ALCD']); + item['renderPreFlight']['ALCD'] = this.airlines[airlinePreIndex].airlineName; + //运营状态处理 + item['renderPreFlight']['FTSS'] = this.flightStatus.find(val => val.sttc === item['renderPreFlight']['FTSS']).stdc + + //航线处理 + let erutReaCodeArray = item['renderReaFlight']['ERUT'].split(' - '); + let erutReaChnArray = [] + for (let i = 0; i < erutReaCodeArray.length; i++) { + let airportIndex = this.airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]); + let cityIndex = this.citys.findIndex(val => this.airports[airportIndex].cityId === val.cityId); + erutReaChnArray.push(this.citys[cityIndex].cityNameChn); + } + item['renderReaFlight']['ERUT'] = erutReaChnArray.join(' - '); + //航空公司处理 + let airlineReaIndex = this.airlines.findIndex(val => val.airlineCode === item['renderReaFlight']['ALCD']); + item['renderReaFlight']['ALCD'] = this.airlines[airlineReaIndex].airlineName; + //运营状态处理 + item['renderReaFlight']['FTSS'] = this.flightStatus.find(val => val.sttc === item['renderReaFlight']['FTSS']).stdc + } + }); + this.doSequence(this.combined_data); } @@ -272,7 +422,7 @@ export class MainComponent implements OnInit { if (this.FLT_POS === 1) { this.selectChange() } else { - this.selectChange() + // this.selectChange() this.inputPosition(this.render_data) } } @@ -364,7 +514,6 @@ export class MainComponent implements OnInit { } else { this.render_data = filter_data; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - // this.inputPosition(this.render_data); this.changeDetectorRef.detectChanges(); } } @@ -773,7 +922,7 @@ export class MainComponent implements OnInit { */ public isBoading(flight) { if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { + if (flight['reaFlight']['BOTM'] && !(flight['reaFlight']['GTDT']['GCTM'])) { return true; } else { return false; @@ -791,10 +940,10 @@ export class MainComponent implements OnInit { */ public isOverBoading(flight) { if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { + if (flight['reaFlight']['GTDT'] && flight['reaFlight']['GTDT']['GCTM']) { return true; + } else { + return false; } } else { return false; diff --git a/src/app/pipes/data-formatter.pipe.ts b/src/app/pipes/data-formatter.pipe.ts deleted file mode 100644 index 4205a71..0000000 --- a/src/app/pipes/data-formatter.pipe.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; -import dataFormatter from '../utils/data-formatter' -import routeType from '../utils/route-type'; -import flightType from '../utils/flight-type'; -import arriDept from '../utils/arri-dept'; - -@Pipe({ - name: 'dataFormatter' -}) -export class DataFormatterPipe implements PipeTransform { - - transform(col_code: string,args:any): any { - - if(args['isLinked']){ - if(col_code==='MVIN'){ - return arriDept(args['linkFlight'][col_code]) + ' / ' + arriDept(args[col_code]) - }else if(col_code==='FLIN'){ - return routeType(args['linkFlight'][col_code]) + ' / ' + routeType(args[col_code]) - }else if(col_code==='FLTY'){ - return flightType(args['linkFlight'][col_code]) + ' / ' + flightType(args[col_code]) - }else{ - return this.dateTransform(args['linkFlight'][col_code]) + ' / ' + this.dateTransform(args[col_code]) - } - }else{ - if(col_code==='MVIN'){ - return arriDept(args[col_code]) - }else if(col_code==='FLIN'){ - return routeType(args[col_code]) - }else if(col_code==='FLTY'){ - return flightType(args[col_code]) - }else{ - return this.dateTransform(args[col_code]) - } - } - } - - dateTransform(dataString){ - const monthToNumber = { - JAN: '01', - FEB: '02', - MAR: '03', - APR: '04', - MAY: '05', - JUN: '06', - JUL: '07', - AUG: '08', - SEP: '09', - OCT: '10', - NOV: '11', - DEC: '12', - } - - - if (!dataString || dataString.length < 11) { - return dataString?dataString:''; - } - if (!dataString.substring(7)) { - return dataString?dataString:''; - } - if(!monthToNumber.hasOwnProperty(dataString.substring(2, 5).toUpperCase())){ - return dataString?dataString:''; - } - // console.log(monthToNumber.hasOwnProperty(dataString.substring(2, 5).toUpperCase())) - - - let year = "20" + dataString.substring(5, 7); - let month = monthToNumber[dataString.substring(2, 5).toUpperCase()]; - let day = dataString.substring(0, 2); - let hour = dataString.substring(7, 9); - let min = dataString.substring(9, 11); - - return hour + ':' + min - } - -} diff --git a/src/app/pipes/pipes.module.ts b/src/app/pipes/pipes.module.ts index 4c7b251..a3b30c3 100644 --- a/src/app/pipes/pipes.module.ts +++ b/src/app/pipes/pipes.module.ts @@ -1,16 +1,10 @@ import { NgModule } from '@angular/core'; -import { DataFormatterPipe } from './data-formatter.pipe'; -import { ScreeningFlightPipe } from './screening-flight.pipe'; @NgModule({ imports: [], declarations: [ - DataFormatterPipe, - ScreeningFlightPipe ], exports: [ - DataFormatterPipe, - ScreeningFlightPipe ] }) diff --git a/src/app/pipes/screening-flight.pipe.ts b/src/app/pipes/screening-flight.pipe.ts deleted file mode 100644 index fde6088..0000000 --- a/src/app/pipes/screening-flight.pipe.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -@Pipe({ - name:'screeningFlight' -}) - -export class ScreeningFlightPipe implements PipeTransform{ - transform(items:Array,args:any){ - console.log(args) - var searchCtrl = ( data: any ) => { - var all = false; - if ( typeof data === 'object' ) { - for ( var z in data ) { - if ( all = searchCtrl( data[z] ) ) { - break; - }; - }; - } else { - if ( typeof data === 'number' ) { - all = data === args; - } else { - all = data.toString().match( new RegExp( args, 'i' ) ); - }; - }; - return all; - }; - return items.filter(searchCtrl); - } -} \ No newline at end of file diff --git a/src/app/services/http-client.service.ts b/src/app/services/http-client.service.ts index 77b5252..effe946 100644 --- a/src/app/services/http-client.service.ts +++ b/src/app/services/http-client.service.ts @@ -21,20 +21,8 @@ export class HttpClientService { * * @return any */ - request(method: string, url: string, options?: { - body?: any; - headers?: HttpHeaders | { - [header: string]: string | string[]; - }; - params?: HttpParams | { - [param: string]: string | string[]; - }; - observe?: HttpObserve; - reportProgress?: boolean; - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; - withCredentials?: boolean; - }): Observable { - return this.commonProcess(this.httpClient.request(method, url, options = {})); + request(method: string, url: string, options?): Observable { + return this.commonProcess(this.httpClient.request(method, url, options)); } @@ -44,15 +32,8 @@ export class HttpClientService { * @param url * @param options */ - delete(url: string, options: { - headers?: HttpHeaders | { [header: string]: string | string[] }, - observe?: HttpObserve, - params?: HttpParams | { [param: string]: string | string[] }, - reportProgress?: boolean, - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text', - withCredentials?: boolean, - } = {}): Observable { - return this.commonProcess(this.httpClient.delete(url, options = {})); + delete(url: string, options?): Observable { + return this.commonProcess(this.httpClient.delete(url, options)); } /** @@ -60,25 +41,18 @@ export class HttpClientService { * @param url * @param options */ - get(url: string,params?:object, options?: { - headers?: HttpHeaders | { [header: string]: string | string[] }, - observe?: HttpObserve, - params?: HttpParams | { [param: string]: string | string[] }, - reportProgress?: boolean, - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text', - withCredentials?: boolean, - } ): Observable { + get(url: string, params?: object, options?): Observable { let paramsString = []; url = url + '?' let t = Math.random(); - if (params&¶ms) { + if (params && params) { for (const key in params) { if (params[key] !== '') { paramsString.push([key, params[key]].join('=')) } } return this.commonProcess(this.httpClient.get(encodeURI(url + paramsString.join('&') + '&t=' + t), options = {})); - }else{ + } else { return this.commonProcess(this.httpClient.get(url + 't=' + t, options = {})); } } @@ -88,15 +62,8 @@ export class HttpClientService { * @param url * @param options */ - head(url: string, options: { - headers?: HttpHeaders | { [header: string]: string | string[] }, - observe?: HttpObserve, - params?: HttpParams | { [param: string]: string | string[] }, - reportProgress?: boolean, - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text', - withCredentials?: boolean, - } = {}): Observable { - return this.commonProcess(this.httpClient.head(url, options = {})); + head(url: string, options?): Observable { + return this.commonProcess(this.httpClient.head(url, options)); } /** @@ -104,15 +71,8 @@ export class HttpClientService { * @param url * @param options */ - options(url: string, options: { - headers?: HttpHeaders | { [header: string]: string | string[] }, - observe?: HttpObserve, - params?: HttpParams | { [param: string]: string | string[] }, - reportProgress?: boolean, - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text', - withCredentials?: boolean, - } = {}): Observable { - return this.commonProcess(this.httpClient.options(url, options = {})); + options(url: string, options?): Observable { + return this.commonProcess(this.httpClient.options(url, options)); } /** @@ -120,32 +80,19 @@ export class HttpClientService { * @param url * @param options */ - patch(url: string, body: any | null, options: { - headers?: HttpHeaders | { [header: string]: string | string[] }, - observe?: HttpObserve, - params?: HttpParams | { [param: string]: string | string[] }, - reportProgress?: boolean, - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text', - withCredentials?: boolean, - } = {}): Observable { - return this.commonProcess(this.httpClient.patch(url, body, options = {})); + patch(url: string, body, options?): Observable { + return this.commonProcess(this.httpClient.patch(url, body, options)); } /** * post * @param url + * @param body * @param options */ - post(url: string, body: any | null, options: { - headers?: HttpHeaders | { [header: string]: string | string[] }, - observe?: HttpObserve, - params?: HttpParams | { [param: string]: string | string[] }, - reportProgress?: boolean, - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text', - withCredentials?: boolean, - } = {}): Observable { - return this.commonProcess(this.httpClient.post(url, body, options = {})); + post(url: string, body, options?): Observable { + return this.commonProcess(this.httpClient.post(url, body, options)); } /** @@ -153,15 +100,8 @@ export class HttpClientService { * @param url * @param options */ - put(url: string, body: any | null, options: { - headers?: HttpHeaders | { [header: string]: string | string[] }, - observe?: HttpObserve, - params?: HttpParams | { [param: string]: string | string[] }, - reportProgress?: boolean, - responseType?: 'arraybuffer' | 'blob' | 'json' | 'text', - withCredentials?: boolean, - } = {}): Observable { - return this.commonProcess(this.httpClient.put(url, body, options = {})); + put(url: string, body, options?): Observable { + return this.commonProcess(this.httpClient.put(url, body, options)); } /** diff --git a/src/app/utils/abdg-formatter.ts b/src/app/utils/abdg-formatter.ts new file mode 100644 index 0000000..f27b866 --- /dev/null +++ b/src/app/utils/abdg-formatter.ts @@ -0,0 +1,20 @@ +/** + * 登机桥显示转换 + */ + +export default function (flight) { + if(flight['ABTM']){ + if(Array.isArray(flight['ABTM'])&&flight['ABTM'].length>0){ + let abdg = []; + for (let i = 0; i < flight['ABTM'].length; i++) { + abdg.push(flight['ABTM'][i]['ABDG']); + } + let set = new Set(abdg); + return Array.from(set).join(','); + }else{ + return flight['ABTM']['ABDG'] + } + }else{ + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/actt-formatter.ts b/src/app/utils/actt-formatter.ts new file mode 100644 index 0000000..ccbdaaf --- /dev/null +++ b/src/app/utils/actt-formatter.ts @@ -0,0 +1,11 @@ +/** + * 实际到达/出发时间显示转换 + */ +import timeFormatter from './time-formatter'; +export default function (flight) { + if (flight['ACTT']) { + return timeFormatter(flight['ACTT']); + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/aotm_a-formatter.ts b/src/app/utils/aotm_a-formatter.ts new file mode 100644 index 0000000..484a6d4 --- /dev/null +++ b/src/app/utils/aotm_a-formatter.ts @@ -0,0 +1,24 @@ +/** + * 登机桥靠桥时间显示转换 + */ +import timeFormatter from './time-formatter'; + +export default function (flight) { + if (flight['ABTM']) { + if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) { + for (let i = 0; i < flight['ABTM'].length; i++) { + if (flight['ABTM'][i]['ABOP'] === 'A') { + return timeFormatter(flight['ABTM'][i]['AOTM']); + } + } + } else { + if (flight['ABTM']['ABOP'] === 'A') { + return timeFormatter(flight['ABTM']['AOTM']); + } else { + return ''; + } + } + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/aotm_d-formatter.ts b/src/app/utils/aotm_d-formatter.ts new file mode 100644 index 0000000..af452d6 --- /dev/null +++ b/src/app/utils/aotm_d-formatter.ts @@ -0,0 +1,24 @@ +/** + * 登机桥撤桥时间显示转换 + */ +import timeFormatter from './time-formatter'; + +export default function (flight) { + if (flight['ABTM']) { + if (Array.isArray(flight['ABTM']) && flight['ABTM'].length > 0) { + for (let i = 0; i < flight['ABTM'].length; i++) { + if (flight['ABTM'][i]['ABOP'] === 'D') { + return timeFormatter(flight['ABTM'][i]['AOTM']); + } + } + } else { + if (flight['ABTM']['ABOP'] === 'D') { + return timeFormatter(flight['ABTM']['AOTM']); + } else { + return ''; + } + } + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/arri-dept.ts b/src/app/utils/arri-dept.ts deleted file mode 100644 index e8ec127..0000000 --- a/src/app/utils/arri-dept.ts +++ /dev/null @@ -1,9 +0,0 @@ -export default function (type: string) { - if (type === 'D') { - return '离港'; - } else if (type === 'A') { - return '到达'; - }else { - return type; - } -} \ No newline at end of file diff --git a/src/app/utils/belt-formatter.ts b/src/app/utils/belt-formatter.ts new file mode 100644 index 0000000..ff755c6 --- /dev/null +++ b/src/app/utils/belt-formatter.ts @@ -0,0 +1,20 @@ +/** + * 转盘号显示转换 + */ + +export default function (flight) { + if(flight['CLDT']){ + if(Array.isArray(flight['CLDT'])&&flight['CLDT'].length>0){ + let belt = []; + for (let i = 0; i < flight['CLDT'].length; i++) { + belt.push(flight['CLDT'][i]['BELT']); + } + let set = new Set(belt); + return Array.from(set).join(','); + }else{ + return flight['CLDT']['BELT'] + } + }else{ + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/botm-formatter.ts b/src/app/utils/botm-formatter.ts new file mode 100644 index 0000000..bebec9a --- /dev/null +++ b/src/app/utils/botm-formatter.ts @@ -0,0 +1,13 @@ +/** + * 登机结束时间显示转换 + */ +import timeFormatter from './time-formatter'; + +export default function (flight) { + if (flight['BOTM']) { + return timeFormatter(flight['BOTM']); + } else { + return ''; + } + +} \ No newline at end of file diff --git a/src/app/utils/cctm-formatter.ts b/src/app/utils/cctm-formatter.ts new file mode 100644 index 0000000..f5df47c --- /dev/null +++ b/src/app/utils/cctm-formatter.ts @@ -0,0 +1,15 @@ +/** + * 值机结束时间显示转换 + */ +import timeFormatter from './time-formatter'; +export default function(flight){ + if(flight['CKDT']){ + if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){ + return timeFormatter(flight['CKDT'][0]['CCTM']); + }else{ + return timeFormatter(flight['CKDT']['CCTM']); + } + }else{ + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/chkc-formatter.ts b/src/app/utils/chkc-formatter.ts new file mode 100644 index 0000000..2162694 --- /dev/null +++ b/src/app/utils/chkc-formatter.ts @@ -0,0 +1,19 @@ +/** + * 值机柜台显示转换 + */ +export default function(flight){ + if(flight['CKDT']){ + if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){ + let chkc = []; + for (let i = 0; i < flight['CKDT'].length; i++) { + chkc.push(flight['CKDT'][i]['CHKC']); + } + let set = new Set(chkc); + return Array.from(set).join(','); + }else{ + return flight['CKDT']['CHKC'] + } + }else{ + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/chtm_off-formatter.ts b/src/app/utils/chtm_off-formatter.ts new file mode 100644 index 0000000..98e6d27 --- /dev/null +++ b/src/app/utils/chtm_off-formatter.ts @@ -0,0 +1,24 @@ +/** + * 下轮档时间显示转换 + */ +import timeFormatter from './time-formatter'; + +export default function (flight) { + if (flight['CHOT']) { + if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) { + for (let i = 0; i < flight['CHOT'].length; i++) { + if (flight['CHOT'][i]['CHID'] === 'OFF') { + return timeFormatter(flight['CHOT'][i]['CHTM']); + } + } + } else { + if (flight['CHOT']['CHID'] === 'OFF') { + return timeFormatter(flight['CHOT']['CHTM']); + } else { + return ''; + } + } + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/chtm_on-formatter.ts b/src/app/utils/chtm_on-formatter.ts new file mode 100644 index 0000000..78fd217 --- /dev/null +++ b/src/app/utils/chtm_on-formatter.ts @@ -0,0 +1,24 @@ +/** + * 上轮档时间显示转换 + */ +import timeFormatter from './time-formatter'; + +export default function (flight) { + if (flight['CHOT']) { + if (Array.isArray(flight['CHOT']) && flight['CHOT'].length > 0) { + for (let i = 0; i < flight['CHOT'].length; i++) { + if (flight['CHOT'][i]['CHID'] === 'ON') { + return timeFormatter(flight['CHOT'][i]['CHTM']); + } + } + } else { + if (flight['CHOT']['CHID'] === 'ON') { + return timeFormatter(flight['CHOT']['CHTM']); + } else { + return ''; + } + } + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/chut-formatter.ts b/src/app/utils/chut-formatter.ts new file mode 100644 index 0000000..d029db0 --- /dev/null +++ b/src/app/utils/chut-formatter.ts @@ -0,0 +1,19 @@ +/** + * 行李传送带号显示转换 + */ +export default function (flight) { + if(flight['CHDT']){ + if(Array.isArray(flight['CHDT'])&&flight['CHDT'].length>0){ + let chdt = []; + for (let i = 0; i < flight['CHDT'].length; i++) { + chdt.push(flight['CHDT'][i]['CHUT']); + } + let set = new Set(chdt); + return Array.from(set).join(','); + }else{ + return flight['CHDT']['CHUT'] + } + }else{ + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/cotm-formatter.ts b/src/app/utils/cotm-formatter.ts new file mode 100644 index 0000000..b6dc041 --- /dev/null +++ b/src/app/utils/cotm-formatter.ts @@ -0,0 +1,15 @@ +/** + * 值机结束时间显示转换 + */ +import timeFormatter from './time-formatter'; +export default function(flight){ + if(flight['CKDT']){ + if(Array.isArray(flight['CKDT'])&&flight['CKDT'].length>0){ + return timeFormatter(flight['CKDT'][0]['COTM']); + }else{ + return timeFormatter(flight['CKDT']['COTM']); + } + }else{ + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/data-formatter.ts b/src/app/utils/data-formatter.ts index 6d79901..c206e5e 100644 --- a/src/app/utils/data-formatter.ts +++ b/src/app/utils/data-formatter.ts @@ -1,11 +1,8 @@ /** - * 菜单点击事件 - * @param dataString 需要转换成时间的字符串 + * 日期时间转换 + * @param dataString 需要转换成日期时间的字符串 */ - - - -export default function (dataString,type?) { +export default function (dataString) { const monthToNumber = { JAN: '01', FEB: '02', @@ -21,13 +18,13 @@ export default function (dataString,type?) { DEC: '12', } if (!dataString || dataString.length < 11) { - return dataString?dataString:''; + return dataString ? dataString : ''; } if (!dataString.substring(7)) { - return dataString?dataString:''; + return dataString ? dataString : ''; } - if(!monthToNumber.hasOwnProperty(dataString.substring(2, 5).toUpperCase())){ - return dataString?dataString:''; + if (!monthToNumber.hasOwnProperty(dataString.substring(2, 5).toUpperCase())) { + return dataString ? dataString : ''; } let year = "20" + dataString.substring(5, 7); @@ -35,11 +32,5 @@ export default function (dataString,type?) { let day = dataString.substring(0, 2); let hour = dataString.substring(7, 9); let min = dataString.substring(9, 11); - - if(type){ - return hour + ':' + min - }else{ - return year + '-' + month + '-' + day + ' ' + hour + ':' + min - } - + return year + '-' + month + '-' + day + ' ' + hour + ':' + min } \ No newline at end of file diff --git a/src/app/utils/erut-formatter.ts b/src/app/utils/erut-formatter.ts new file mode 100644 index 0000000..6c96f22 --- /dev/null +++ b/src/app/utils/erut-formatter.ts @@ -0,0 +1,18 @@ +/** + * 航线显示转换 + */ +export default function(flight){ + if(flight['ERUT']){ + if(Array.isArray(flight['ERUT'])&&flight['ERUT'].length>0){ + let erut = []; + for (let i = 0; i < flight['ERUT'].length; i++) { + erut.push(flight['ERUT'][i]['APCD']); + } + return erut.join(' - '); + }else{ + return flight['ERUT']['APCD'] + } + }else{ + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/estt-formatter.ts b/src/app/utils/estt-formatter.ts new file mode 100644 index 0000000..164c1dc --- /dev/null +++ b/src/app/utils/estt-formatter.ts @@ -0,0 +1,11 @@ +/** + * 预计到达/出发时间显示转换 + */ +import timeFormatter from './time-formatter'; +export default function (flight) { + if (flight['ESTT']) { + return timeFormatter(flight['ESTT']); + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/flight-type.ts b/src/app/utils/flight-type.ts deleted file mode 100644 index 3371546..0000000 --- a/src/app/utils/flight-type.ts +++ /dev/null @@ -1,11 +0,0 @@ -export default function (type: string) { - if (type === 'D') { - return '国内'; - } else if (type === 'I') { - return '国际'; - } else if (type === 'M') { - return '混合'; - } else { - return '其他'; - } -} \ No newline at end of file diff --git a/src/app/utils/flin-formatter.ts b/src/app/utils/flin-formatter.ts new file mode 100644 index 0000000..fd4cc8d --- /dev/null +++ b/src/app/utils/flin-formatter.ts @@ -0,0 +1,16 @@ +/** + * 航线类别显示转换 + */ +const flinChn = { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区' +} +export default function (flight) { + if (flight['FLIN']) { + return flinChn[flight['FLIN']]; + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/gate-formatter.ts b/src/app/utils/gate-formatter.ts new file mode 100644 index 0000000..b087e87 --- /dev/null +++ b/src/app/utils/gate-formatter.ts @@ -0,0 +1,21 @@ +/** + * 登机门显示转换 + */ +import timeFormatter from './time-formatter'; + +export default function (flight) { + if (flight['GTDT']) { + if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) { + let gate = []; + for (let i = 0; i < flight['GTDT'].length; i++) { + gate.push(flight['GTDT'][i]['GATE']); + } + let set = new Set(gate); + return Array.from(set).join(','); + } else { + return flight['GTDT']['GATE']; + } + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/gctm-formatter.ts b/src/app/utils/gctm-formatter.ts new file mode 100644 index 0000000..aa36525 --- /dev/null +++ b/src/app/utils/gctm-formatter.ts @@ -0,0 +1,16 @@ +/** + * 登机结束时间显示转换 + */ +import timeFormatter from './time-formatter'; + +export default function (flight) { + if (flight['GTDT']) { + if (Array.isArray(flight['GTDT']) && flight['GTDT'].length > 0) { + return timeFormatter(flight['GTDT'][0]['GCTM']); + } else { + return timeFormatter(flight['GTDT']['GCTM']); + } + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/lacl-formatter.ts b/src/app/utils/lacl-formatter.ts new file mode 100644 index 0000000..853c717 --- /dev/null +++ b/src/app/utils/lacl-formatter.ts @@ -0,0 +1,11 @@ +/** + * 最后通知时间显示转换 + */ +import timeFormatter from './time-formatter'; +export default function (flight) { + if (flight['LACL']) { + return timeFormatter(flight['LACL']); + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/mvin-formatter.ts b/src/app/utils/mvin-formatter.ts new file mode 100644 index 0000000..192c7e7 --- /dev/null +++ b/src/app/utils/mvin-formatter.ts @@ -0,0 +1,14 @@ +/** + * 到达/出发显示转换 + */ +export default function (flight) { + if (flight['MVIN']) { + if (flight['MVIN'] === 'A') { + return '到达'; + } else if (flight['MVIN'] === 'D') { + return '出发'; + } + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/padt-formatter.ts b/src/app/utils/padt-formatter.ts new file mode 100644 index 0000000..cd33970 --- /dev/null +++ b/src/app/utils/padt-formatter.ts @@ -0,0 +1,11 @@ +/** + * 前站起飞时间显示转换 + */ +import timeFormatter from './time-formatter'; +export default function (flight) { + if (flight['PADT']) { + return timeFormatter(flight['PADT']); + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/psst-formatter.ts b/src/app/utils/psst-formatter.ts new file mode 100644 index 0000000..0df4ade --- /dev/null +++ b/src/app/utils/psst-formatter.ts @@ -0,0 +1,19 @@ +/** + * 计划停机位显示转换 + */ +export default function(flight){ + if(flight['PSDT']){ + if(Array.isArray(flight['PSDT'])&&flight['PSDT'].length>0){ + let chkc = []; + for (let i = 0; i < flight['PSDT'].length; i++) { + chkc.push(flight['PSDT'][i]['PSST']); + } + let set = new Set(chkc); + return Array.from(set).join(','); + }else{ + return flight['PSDT']['PSST'] + } + }else{ + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/route-type.ts b/src/app/utils/route-type.ts deleted file mode 100644 index b0cf176..0000000 --- a/src/app/utils/route-type.ts +++ /dev/null @@ -1,11 +0,0 @@ -export default function (type: string) { - if (type === 'D') { - return '国内'; - } else if (type === 'I') { - return '国际'; - } else if (type === 'M') { - return '混合'; - } else { - return type; - } -} \ No newline at end of file diff --git a/src/app/utils/sodt-formatter.ts b/src/app/utils/sodt-formatter.ts new file mode 100644 index 0000000..0fd33a6 --- /dev/null +++ b/src/app/utils/sodt-formatter.ts @@ -0,0 +1,11 @@ +/** + * 计划到达/出发时间显示转换 + */ +import timeFormatter from './time-formatter'; +export default function (flight) { + if (flight['SODT']) { + return timeFormatter(flight['SODT']); + } else { + return ''; + } +} \ No newline at end of file diff --git a/src/app/utils/time-formatter.ts b/src/app/utils/time-formatter.ts new file mode 100644 index 0000000..560883a --- /dev/null +++ b/src/app/utils/time-formatter.ts @@ -0,0 +1,36 @@ +/** + * 时间转换显示 + * @param dataString 需要转换成时间的字符串 + */ +export default function (dataString) { + const monthToNumber = { + JAN: '01', + FEB: '02', + MAR: '03', + APR: '04', + MAY: '05', + JUN: '06', + JUL: '07', + AUG: '08', + SEP: '09', + OCT: '10', + NOV: '11', + DEC: '12', + } + if (!dataString || dataString.length < 11) { + return dataString ? dataString : ''; + } + if (!dataString.substring(7)) { + return dataString ? dataString : ''; + } + if (!monthToNumber.hasOwnProperty(dataString.substring(2, 5).toUpperCase())) { + return dataString ? dataString : ''; + } + + let year = "20" + dataString.substring(5, 7); + let month = monthToNumber[dataString.substring(2, 5).toUpperCase()]; + let day = dataString.substring(0, 2); + let hour = dataString.substring(7, 9); + let min = dataString.substring(9, 11); + return hour + ':' + min +} \ No newline at end of file diff --git a/src/assets/mock-data/airline-col_code.json b/src/assets/mock-data/airline-col_code.json index 6a09ea1..b0f3fed 100644 --- a/src/assets/mock-data/airline-col_code.json +++ b/src/assets/mock-data/airline-col_code.json @@ -1,57 +1,162 @@ [ + { + "COL_CODE":"ACFT", + "COL_CN":"机型", + "COL_ORDER":"22" + }, + { + "COL_CODE":"GCTM", + "COL_CN":"登机结束", + "COL_ORDER":"8" + }, + { + "COL_CODE":"BOTM", + "COL_CN":"登机开始", + "COL_ORDER":"21" + }, + { + "COL_CODE":"ABDG", + "COL_CN":"登机桥", + "COL_ORDER":"14" + }, + { + "COL_CODE":"AOTM_A", + "COL_CN":"靠桥时间", + "COL_ORDER":"26" + }, + { + "COL_CODE":"AOTM_D", + "COL_CN":"撤桥时间", + "COL_ORDER":"19" + }, + { + "COL_CODE":"BELT", + "COL_CN":"转盘", + "COL_ORDER":"30" + }, + { + "COL_CODE":"CHKC", + "COL_CN":"值机柜台", + "COL_ORDER":"17" + }, + { + "COL_CODE":"CCTM", + "COL_CN":"值机结束", + "COL_ORDER":"23" + }, + { + "COL_CODE":"COTM", + "COL_CN":"值机开始", + "COL_ORDER":"10" + }, + { + "COL_CODE":"CHTM_ON", + "COL_CN":"上轮档时间", + "COL_ORDER":"11" + }, + { + "COL_CODE":"CHTM_OFF", + "COL_CN":"下轮档时间", + "COL_ORDER":"12" + }, + { + "COL_CODE":"LACL", + "COL_CN":"最后通知时间", + "COL_ORDER":"13" + }, + { + "COL_CODE":"CHUT", + "COL_CN":"行李传送带", + "COL_ORDER":"4" + }, + { + "COL_CODE":"RENO", + "COL_CN":"飞机号", + "COL_ORDER":"15" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"航空公司", + "COL_ORDER":"16" + }, + { + "COL_CODE":"ACTT", + "COL_CN":"实际到达/出发", + "COL_ORDER":"8" + }, + { + "COL_CODE":"PSST", + "COL_CN":"计划机位", + "COL_ORDER":"18" + }, + { + "COL_CODE":"ESTT", + "COL_CN":"预计到达/出发", + "COL_ORDER":"6" + }, + { + "COL_CODE":"MVIN", + "COL_CN":"到达/出发", + "COL_ORDER":"20" + }, + { + "COL_CODE":"ERUT", + "COL_CN":"航线", + "COL_ORDER":"3" + }, { "COL_CODE":"FLNO", "COL_CN":"航班号", "COL_ORDER":"1" }, { - "COL_CODE":"ALCD", - "COL_CN":"航空公司", - "COL_ORDER":"8" + "COL_CODE":"FTSS", + "COL_CN":"运营状态", + "COL_ORDER":"9" }, { "COL_CODE":"FLIN", "COL_CN":"航线类别", - "COL_ORDER":"4" + "COL_ORDER":"24" }, { - "COL_CODE":"FLTY", - "COL_CN":"航班类别", - "COL_ORDER":"5" - }, - { - "COL_CODE":"MVIN", - "COL_CN":"航向指示", - "COL_ORDER":"9" - }, - { - "COL_CODE":"TRML", - "COL_CN":"候机楼", - "COL_ORDER":"7" - }, - { - "COL_CODE":"RENO", - "COL_CN":"飞机号", - "COL_ORDER":"3" + "COL_CODE":"IMPA", + "COL_CN":"重要提示", + "COL_ORDER":"25" }, { "COL_CODE":"SODT", "COL_CN":"计划到达/出发", - "COL_ORDER":"13" + "COL_ORDER":"5" }, { - "COL_CODE":"ESTT", - "COL_CN":"预计到达/出发", - "COL_ORDER":"14" + "COL_CODE":"TRML", + "COL_CN":"航站楼", + "COL_ORDER":"27" }, { - "COL_CODE":"ACTT", - "COL_CN":"实际到达/出发", - "COL_ORDER":"15" + "COL_CODE":"FLTY", + "COL_CN":"航班类别", + "COL_ORDER":"28" + }, + { + "COL_CODE":"GATE", + "COL_CN":"登机门", + "COL_ORDER":"29" + }, + { + "COL_CODE":"PADT", + "COL_CN":"前站起飞时间", + "COL_ORDER":"7" + }, + { + "COL_CODE":"CSFT", + "COL_CN":"共享航班号", + "COL_ORDER":"31" }, { "COL_CODE":"STND", - "COL_CN":"停机位", - "COL_ORDER":"16" + "COL_CN":"当前机位", + "COL_ORDER":"32" } ] \ No newline at end of file