From 65ff66f2bbe7cff88be9a122fef3432cded53372 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Fri, 16 Nov 2018 14:14:07 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E5=BC=95=E7=94=A8jQuery=E4=B8=8E?= =?UTF-8?q?=E5=80=BC=E6=9C=BA=E5=B2=9B=E8=BF=87=E6=BB=A4=E5=8F=8A=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE=E7=A1=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkin-group.component.html | 10 +- .../checkin-group.component.scss | 11 +- .../checkin-group/checkin-group.component.ts | 491 +++++++++++------- 3 files changed, 318 insertions(+), 194 deletions(-) diff --git a/src/app/pages/basic-data/checkin-group/checkin-group.component.html b/src/app/pages/basic-data/checkin-group/checkin-group.component.html index bb70a50..19e7f40 100644 --- a/src/app/pages/basic-data/checkin-group/checkin-group.component.html +++ b/src/app/pages/basic-data/checkin-group/checkin-group.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} + [ngClass]="{'selected':row_state['renderFlight']===airline_row['renderFlight']}"> {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/checkin-group/checkin-group.component.ts b/src/app/pages/basic-data/checkin-group/checkin-group.component.ts index b46a891..7e67f39 100644 --- a/src/app/pages/basic-data/checkin-group/checkin-group.component.ts +++ b/src/app/pages/basic-data/checkin-group/checkin-group.component.ts @@ -26,21 +26,6 @@ public col_lists: Array; //列数据 public row_state: any = { renderFlight: {} }; -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 @@ -101,11 +86,12 @@ ngOnInit() { 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]; } - row_flights['renderFlight'] = render_flight;if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; + row_flights['renderFlight'] = render_flight; + if (element['isLinked']) { + row_flights['preFlight'] = element['linkFlight']; + delete element['linkFlight']; + delete element['isLinked']; + row_flights['reaFlight'] = element; for (let i = 0; i < this.col_lists.length; i++) { let key = this.col_lists[i]['COL_CODE'] @@ -131,7 +117,9 @@ ngOnInit() { } this.combined_data.push(row_flights) }) - this.doSequence(this.combined_data); + // this.doSequence(this.combined_data); + this.render_data = this.combined_data + this.changeDetectorRef.detectChanges(); } ) /** @@ -145,94 +133,12 @@ ngOnInit() { tableCont.addEventListener('scroll',scrollHandle) } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 - } - /** * 执行排序并渲染 */ -doSequence(sequenceData) { +/* doSequence(sequenceData) { sequenceData.forEach(element => { - element['ORDER'] = this.sequence(element); + element['ORDER'] = '+' + element['order'] }) sequenceData.sort(function (a, b) { @@ -242,7 +148,7 @@ doSequence(sequenceData) { this.render_data = sequenceData; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); -} +} */ /** * 过滤及定位 @@ -268,7 +174,7 @@ selectChange() { }) //下拉框筛选 filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { + if (item) { let is_satis = true; for (const key in filterItems) { if (filterItems.hasOwnProperty(key) && filterItems[key]) { @@ -283,7 +189,7 @@ selectChange() { } } return is_satis; - } else if (this.isDeptFlight(item)) { + } else if (item) { let is_satis = true; for (const key in filterItems) { if (filterItems.hasOwnProperty(key) && filterItems[key]) { @@ -367,7 +273,6 @@ inputFilter(filterData) { } } }) - } else { filterData = filterData.filter(item => { let is_satis = false; @@ -469,209 +374,6 @@ inputPosition(filterData) { let tr = $(".selected"); let objTr = tr[0]; $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); -} -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } - - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } - - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } - - - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - + } } From 91774fcc139083f2c21111a8ba05a620a567164b Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 09:16:50 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E7=99=BB=E6=9C=BA=E9=97=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE?= =?UTF-8?q?=E7=A1=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/basic-data/gate/gate.component.html | 22 +- .../pages/basic-data/gate/gate.component.scss | 11 +- .../pages/basic-data/gate/gate.component.ts | 648 +++++++----------- 3 files changed, 258 insertions(+), 423 deletions(-) diff --git a/src/app/pages/basic-data/gate/gate.component.html b/src/app/pages/basic-data/gate/gate.component.html index ffc1ea7..e822514 100644 --- a/src/app/pages/basic-data/gate/gate.component.html +++ b/src/app/pages/basic-data/gate/gate.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/gate/gate.component.scss b/src/app/pages/basic-data/gate/gate.component.scss index cf17098..2b946a6 100644 --- a/src/app/pages/basic-data/gate/gate.component.scss +++ b/src/app/pages/basic-data/gate/gate.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,14 +32,18 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } + } + th{ + background-color: #ddd; } th,td{ // border: none; diff --git a/src/app/pages/basic-data/gate/gate.component.ts b/src/app/pages/basic-data/gate/gate.component.ts index 13da7c3..67ffe4a 100644 --- a/src/app/pages/basic-data/gate/gate.component.ts +++ b/src/app/pages/basic-data/gate/gate.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ selector: 'app-gate', templateUrl: './gate.component.html', @@ -22,23 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public gate_lists: Array; //列数据 -public row_state: number; - - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -66,7 +52,6 @@ public formatter = { 'ACTT': dateFormatter } - selectRow(i) { this.row_state = i; this.changeDetectorRef.detectChanges(); @@ -112,11 +97,12 @@ ngOnInit() { let key = this.gate_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]; } - row_flights['renderFlight'] = render_flight;if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; + row_flights['renderFlight'] = render_flight; + if (element['isLinked']) { + row_flights['preFlight'] = element['linkFlight']; + delete element['linkFlight']; + delete element['isLinked']; + row_flights['reaFlight'] = element; for (let i = 0; i < this.gate_lists.length; i++) { let key = this.gate_lists[i]['COL_CODE'] @@ -140,430 +126,266 @@ ngOnInit() { row_flights['renderPreFlight'] = render_pre_flight; row_flights['renderReaFlight'] = render_rea_flight; } - this.combined_data.push(row_flights) + this.combined_data.push(row_flights); }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - // element['ORDER'] = '+' + element['order'] - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - + // this.doSequence(this.combined_data); this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } +/** + * 执行排序并渲染 + */ +/* doSequence(sequenceData) { + sequenceData.forEach(element => { + element['ORDER'] = this.sequence(element); + }) - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 + sequenceData.sort(function (a, b) { + return (a['ORDER'] - b['ORDER']); + }) + + this.render_data = sequenceData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + this.changeDetectorRef.detectChanges(); +} */ + +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } - + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); +} } From b86a91598fb6932dadf3ba739f461f190abb757a Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 09:24:20 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E8=88=AA=E7=AB=99=E6=A5=BC=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE?= =?UTF-8?q?=E7=A1=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terminal/terminal.component.html | 14 +- .../terminal/terminal.component.scss | 11 +- .../basic-data/terminal/terminal.component.ts | 636 +++++++----------- 3 files changed, 246 insertions(+), 415 deletions(-) diff --git a/src/app/pages/basic-data/terminal/terminal.component.html b/src/app/pages/basic-data/terminal/terminal.component.html index 84b0bd0..3ae079d 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.html +++ b/src/app/pages/basic-data/terminal/terminal.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/terminal/terminal.component.scss b/src/app/pages/basic-data/terminal/terminal.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.scss +++ b/src/app/pages/basic-data/terminal/terminal.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/terminal/terminal.component.ts b/src/app/pages/basic-data/terminal/terminal.component.ts index 3d1a44e..7d8e397 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.ts +++ b/src/app/pages/basic-data/terminal/terminal.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ selector: 'app-terminal', templateUrl: './terminal.component.html', @@ -22,23 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public terminal_lists: Array; //列数据 -public row_state: number; - - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -130,428 +116,264 @@ ngOnInit() { } this.combined_data.push(row_flights) }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - // element['ORDER'] = '+' + element['order'] - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - + //this.doSequence(this.combined_data); this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } +/** + * 执行排序并渲染 + */ +/* doSequence(sequenceData) { + sequenceData.forEach(element => { + element['ORDER'] = this.sequence(element); + }) - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 + sequenceData.sort(function (a, b) { + return (a['ORDER'] - b['ORDER']); + }) + + this.render_data = sequenceData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + this.changeDetectorRef.detectChanges(); +} */ + +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } - - - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + + } } From c0c805b49dae3592b670dd09e28a11bb64b91b08 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 09:31:00 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E8=A1=8C=E6=9D=8E=E4=BC=A0=E9=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E7=B2=BE=E7=A1=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/basic-data/chut/chut.component.html | 10 +- .../pages/basic-data/chut/chut.component.scss | 11 +- .../pages/basic-data/chut/chut.component.ts | 634 +++++++----------- 3 files changed, 241 insertions(+), 414 deletions(-) diff --git a/src/app/pages/basic-data/chut/chut.component.html b/src/app/pages/basic-data/chut/chut.component.html index d3ebc35..2a09e88 100644 --- a/src/app/pages/basic-data/chut/chut.component.html +++ b/src/app/pages/basic-data/chut/chut.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/carousel/carousel.component.scss b/src/app/pages/basic-data/carousel/carousel.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.scss +++ b/src/app/pages/basic-data/carousel/carousel.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/carousel/carousel.component.ts b/src/app/pages/basic-data/carousel/carousel.component.ts index c83334d..fb95031 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.ts +++ b/src/app/pages/basic-data/carousel/carousel.component.ts @@ -2,6 +2,9 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; + @Component({ selector: 'app-carousel', templateUrl: './carousel.component.html', @@ -22,22 +25,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public carousel_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -65,7 +53,6 @@ public formatter = { 'ACTT': dateFormatter } - selectRow(i) { this.row_state = i; this.changeDetectorRef.detectChanges(); @@ -111,11 +98,12 @@ ngOnInit() { let key = this.carousel_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]; } - row_flights['renderFlight'] = render_flight;if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; + row_flights['renderFlight'] = render_flight; + if (element['isLinked']) { + row_flights['preFlight'] = element['linkFlight']; + delete element['linkFlight']; + delete element['isLinked']; + row_flights['reaFlight'] = element; for (let i = 0; i < this.carousel_lists.length; i++) { let key = this.carousel_lists[i]['COL_CODE'] @@ -141,428 +129,264 @@ ngOnInit() { } this.combined_data.push(row_flights) }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - // element['ORDER'] = '+' + element['order'] - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - + // this.doSequence(this.combined_data); this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } +/** + * 执行排序并渲染 + */ +/* doSequence(sequenceData) { + sequenceData.forEach(element => { + element['ORDER'] = this.sequence(element); + }) - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 + sequenceData.sort(function (a, b) { + return (a['ORDER'] - b['ORDER']); + }) + + this.render_data = sequenceData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + this.changeDetectorRef.detectChanges(); +} */ + +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } - - - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + + } } diff --git a/src/app/pages/basic-data/chut/chut.component.html b/src/app/pages/basic-data/chut/chut.component.html index 2a09e88..0a36e05 100644 --- a/src/app/pages/basic-data/chut/chut.component.html +++ b/src/app/pages/basic-data/chut/chut.component.html @@ -30,6 +30,8 @@ 序号 + {{airline_col.COL_CN}} @@ -37,6 +39,8 @@ {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} From c7fa745eb94cbd14e036b15d18fc7639eb5c4c3f Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 09:59:36 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E6=9C=BA=E4=BD=8D=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-data/stand/stand.component.html | 26 +- .../basic-data/stand/stand.component.scss | 11 +- .../pages/basic-data/stand/stand.component.ts | 647 +++++++----------- 3 files changed, 261 insertions(+), 423 deletions(-) diff --git a/src/app/pages/basic-data/stand/stand.component.html b/src/app/pages/basic-data/stand/stand.component.html index f209ff6..161727d 100644 --- a/src/app/pages/basic-data/stand/stand.component.html +++ b/src/app/pages/basic-data/stand/stand.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/stand/stand.component.scss b/src/app/pages/basic-data/stand/stand.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/stand/stand.component.scss +++ b/src/app/pages/basic-data/stand/stand.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/stand/stand.component.ts b/src/app/pages/basic-data/stand/stand.component.ts index 439579e..0682a68 100644 --- a/src/app/pages/basic-data/stand/stand.component.ts +++ b/src/app/pages/basic-data/stand/stand.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ selector: 'app-stand', templateUrl: './stand.component.html', @@ -22,22 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public stand_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -72,7 +59,6 @@ public formatter = { 'ACTT': dateFormatter } - selectRow(i) { this.row_state = i; this.changeDetectorRef.detectChanges(); @@ -118,11 +104,12 @@ ngOnInit() { let key = this.stand_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]; } - row_flights['renderFlight'] = render_flight;if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; + row_flights['renderFlight'] = render_flight; + if (element['isLinked']) { + row_flights['preFlight'] = element['linkFlight']; + delete element['linkFlight']; + delete element['isLinked']; + row_flights['reaFlight'] = element; for (let i = 0; i < this.stand_lists.length; i++) { let key = this.stand_lists[i]['COL_CODE'] @@ -148,428 +135,264 @@ ngOnInit() { } this.combined_data.push(row_flights) }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - // element['ORDER'] = '+' + element['order'] - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - + // this.doSequence(this.combined_data); this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } +/** + * 执行排序并渲染 + */ +/* doSequence(sequenceData) { + sequenceData.forEach(element => { + element['ORDER'] = this.sequence(element); + }) - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 + sequenceData.sort(function (a, b) { + return (a['ORDER'] - b['ORDER']); + }) + + this.render_data = sequenceData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + this.changeDetectorRef.detectChanges(); +} */ + +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } - - - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + + } } From ec027d0545cde4c68c4954a816c932417107a879 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 10:09:00 +0800 Subject: [PATCH 09/20] =?UTF-8?q?=E5=80=BC=E6=9C=BA=E6=9F=9C=E5=8F=B0?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E7=B2=BE=E7=A1=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkin-desk/checkin-desk.component.html | 26 +- .../checkin-desk/checkin-desk.component.scss | 11 +- .../checkin-desk/checkin-desk.component.ts | 637 +++++++----------- 3 files changed, 256 insertions(+), 418 deletions(-) diff --git a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html index ef96a78..f4074dd 100644 --- a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html +++ b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.scss b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.scss +++ b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts index 26e53e5..7495c74 100644 --- a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts +++ b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ selector: 'app-checkin-desk', templateUrl: './checkin-desk.component.html', @@ -22,22 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public checkindesk_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -145,430 +132,266 @@ ngOnInit() { row_flights['renderPreFlight'] = render_pre_flight; row_flights['renderReaFlight'] = render_rea_flight; } - this.combined_data.push(row_flights) + this.combined_data.push(row_flights); }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - // element['ORDER'] = '+' + element['order'] - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - + //this.doSequence(this.combined_data); this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } +/** + * 执行排序并渲染 + */ +/* doSequence(sequenceData) { + sequenceData.forEach(element => { + element['ORDER'] = this.sequence(element); + }) - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 + sequenceData.sort(function (a, b) { + return (a['ORDER'] - b['ORDER']); + }) + + this.render_data = sequenceData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + this.changeDetectorRef.detectChanges(); +} */ + +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } - - - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + + } } From df070ecbba94e4a7672bb0be4dd15d127674f470 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 10:27:28 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E5=B8=83=E5=B1=80=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=81=E6=9C=BA=E5=9C=BA=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-data/airport/airport.component.html | 34 +- .../basic-data/airport/airport.component.scss | 11 +- .../basic-data/airport/airport.component.ts | 618 ++++++------------ 3 files changed, 247 insertions(+), 416 deletions(-) diff --git a/src/app/pages/basic-data/airport/airport.component.html b/src/app/pages/basic-data/airport/airport.component.html index f45adb8..06c137b 100644 --- a/src/app/pages/basic-data/airport/airport.component.html +++ b/src/app/pages/basic-data/airport/airport.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/airport/airport.component.scss b/src/app/pages/basic-data/airport/airport.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/airport/airport.component.scss +++ b/src/app/pages/basic-data/airport/airport.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/airport/airport.component.ts b/src/app/pages/basic-data/airport/airport.component.ts index b58fdcc..4faa289 100644 --- a/src/app/pages/basic-data/airport/airport.component.ts +++ b/src/app/pages/basic-data/airport/airport.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ selector: 'app-airport', templateUrl: './airport.component.html', @@ -22,22 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public airport_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -140,427 +127,246 @@ ngOnInit() { } this.combined_data.push(row_flights) }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -/* Enter键触发事件过滤条件数据 */ -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; + +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } - + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } } From d73ce5f2d70098f6b7e6738c03027cb108bb5506 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 10:45:49 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=81=E6=9C=BA=E5=9E=8B=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aircraft-type.component.html | 30 +- .../aircraft-type.component.scss | 11 +- .../aircraft-type/aircraft-type.component.ts | 622 ++++++------------ 3 files changed, 244 insertions(+), 419 deletions(-) diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html index 534ecf7..1667fcd 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.scss b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.scss +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts index 5f6b88d..5a8403c 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ selector: 'app-aircraft-type', templateUrl: './aircraft-type.component.html', @@ -22,22 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public aircrafttype_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -140,428 +127,245 @@ ngOnInit() { } this.combined_data.push(row_flights) }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); +} +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 -} - -/* Enter键触发事件过滤条件数据 */ -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } - - - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + + } } From 3f62792264a99a9810319dae6d092ae58809b467 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 11:16:26 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=81=E9=A3=9E=E6=9C=BA=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aircraft-type.component.html | 48 +- .../aircraft-type/aircraft-type.component.ts | 66 +- .../aircraft/aircraft.component.html | 52 +- .../aircraft/aircraft.component.scss | 11 +- .../basic-data/aircraft/aircraft.component.ts | 681 +++++++----------- src/assets/mock-data/aircraft-code.json | 41 +- src/assets/mock-data/aircraft-data.json | 42 +- src/assets/mock-data/aircraft-type-code.json | 43 +- src/assets/mock-data/aircraft-type-data.json | 42 +- 9 files changed, 431 insertions(+), 595 deletions(-) diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html index 1667fcd..99bebd6 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html @@ -3,7 +3,7 @@
-
@@ -51,14 +43,19 @@ 序号 - + 机型组 + CAA码 + IATA码 + ICAO码 --> {{airline_col.COL_CN}} @@ -67,13 +64,18 @@ [ngClass]="{'selected':row_state['renderFlight']===airline_row['renderFlight']}"> {{i+1}} + {{airline_col.aircraftTypeCodeCaa}} + {{airline_col.aircraftTypeCodeIata}} + {{airline_col.aircraftTypeCodeIcao}} --> {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts index 5a8403c..8da9868 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts @@ -5,10 +5,10 @@ import dateFormatter from '../../../utils/data-formatter'; import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ - selector: 'app-aircraft-type', - templateUrl: './aircraft-type.component.html', - styleUrls: ['./aircraft-type.component.scss'] -}) + selector: 'app-aircraft-type', + templateUrl: './aircraft-type.component.html', + styleUrls: ['./aircraft-type.component.scss'] + }) export class AircraftTypeComponent implements OnInit { constructor( @@ -32,19 +32,14 @@ FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 public filterItems = { - HK: '', //航空公司 - JX: '', //机型 + ZZU: '', //机型组 } public formatter = { - 'HK': { - 'GH': '海南航空公司', - 'CH': '国外航空公司' - }, - 'JX': { - 'A': 'A306', - 'B': 'B252', - "C": 'C256' + 'ZZU': { + 'E': 'E-类飞机机型', + 'T': 'T-类飞机机型', + 'G': 'G-类飞机机型' }, 'SODT': dateFormatter, 'ESTT': dateFormatter, @@ -103,35 +98,35 @@ ngOnInit() { delete element['isLinked']; row_flights['reaFlight'] = element; - for (let i = 0; i < this.aircrafttype_lists.length; i++) { - let key = this.aircrafttype_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); + for (let i = 0; i < this.aircrafttype_lists.length; i++) { + let key = this.aircrafttype_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); + } 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]]; + } } 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] = (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]; } - } 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]; } + row_flights['renderFlight'] = render_flight; + row_flights['renderPreFlight'] = render_pre_flight; + row_flights['renderReaFlight'] = render_rea_flight; } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) + this.combined_data.push(row_flights) }) this.render_data = this.combined_data this.changeDetectorRef.detectChanges(); } ) - /** + /** * 固定表头 */ var tableCont = document.querySelector('#table-container'); @@ -141,6 +136,7 @@ ngOnInit() { } tableCont.addEventListener('scroll',scrollHandle); } + /** * 过滤及定位 * @param filterItems @@ -366,6 +362,6 @@ inputPosition(filterData) { let tr = $(".selected"); let objTr = tr[0]; $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - + } } diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.html b/src/app/pages/basic-data/aircraft/aircraft.component.html index c8047f0..ac5d3d0 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.html +++ b/src/app/pages/basic-data/aircraft/aircraft.component.html @@ -3,7 +3,7 @@
- - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.scss b/src/app/pages/basic-data/aircraft/aircraft.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.scss +++ b/src/app/pages/basic-data/aircraft/aircraft.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.ts b/src/app/pages/basic-data/aircraft/aircraft.component.ts index 64bfb1f..54ecf56 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.ts +++ b/src/app/pages/basic-data/aircraft/aircraft.component.ts @@ -2,12 +2,14 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ - selector: 'app-aircraft', - templateUrl: './aircraft.component.html', - styleUrls: ['./aircraft.component.scss'] -}) -export class AircraftComponent implements OnInit { + selector: 'app-aircraft', + templateUrl: './aircraft.component.html', + styleUrls: ['./aircraft.component.scss'] + }) + export class AircraftComponent implements OnInit { constructor( private httpCilent: HttpClientService, @@ -22,22 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public aircraft_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -45,21 +32,25 @@ FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 public filterItems = { - ZZU: '', //机型组 + HK: '', //航空公司 + JX: '', //机型 } public formatter = { - 'ZZU': { - 'E': 'E-类飞机机型', - 'T': 'T-类飞机机型', - 'G': 'G-类飞机机型' + 'HK': { + 'GH': '海南航空公司', + 'CH': '国外航空公司' + }, + 'JX': { + 'A': 'A306', + 'B': 'B252', + "C": 'C256' }, 'SODT': dateFormatter, 'ESTT': dateFormatter, 'ACTT': dateFormatter } - selectRow(i) { this.row_state = i; this.changeDetectorRef.detectChanges(); @@ -112,452 +103,270 @@ ngOnInit() { delete element['isLinked']; row_flights['reaFlight'] = element; - for (let i = 0; i < this.aircraft_lists.length; i++) { - let key = this.aircraft_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); - } 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]]; - } + for (let i = 0; i < this.aircraft_lists.length; i++) { + let key = this.aircraft_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); } 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]; + 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]]; } + } 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]; } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; } - this.combined_data.push(row_flights) + row_flights['renderFlight'] = render_flight; + row_flights['renderPreFlight'] = render_pre_flight; + row_flights['renderReaFlight'] = render_rea_flight; + } + this.combined_data.push(row_flights) }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } + } else { + continue; + } + } + }); + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } - - - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } + this.changeDetectorRef.detectChanges(); + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } } diff --git a/src/assets/mock-data/aircraft-code.json b/src/assets/mock-data/aircraft-code.json index fb4f699..86164c2 100644 --- a/src/assets/mock-data/aircraft-code.json +++ b/src/assets/mock-data/aircraft-code.json @@ -1,67 +1,42 @@ [ { "COL_CODE":"FLNO", - "COL_CN":"机型代码", + "COL_CN":"飞机号", "COL_ORDER":"1" }, { "COL_CODE":"ALCD", - "COL_CN":"机型名称", + "COL_CN":"最大乘客数", "COL_ORDER":"2" }, { "COL_CODE":"HZ", - "COL_CN":"飞机长度", + "COL_CN":"最大货物重量", "COL_ORDER":"3" }, { "COL_CODE":"ZY", - "COL_CN":"翼展", + "COL_CN":"最大起飞重量", "COL_ORDER":"4" }, { "COL_CODE":"LQ", - "COL_CN":"机身高度", + "COL_CN":"最大廊桥数", "COL_ORDER":"5" }, { "COL_CODE":"ZJ", - "COL_CN":"最大乘客数", + "COL_CN":"机主航空公司", "COL_ORDER":"6" }, { "COL_CODE":"HK", - "COL_CN":"最大货物重量", + "COL_CN":"航空公司", "COL_ORDER":"7" }, { "COL_CODE":"JX", - "COL_CN":"最大起飞重量", + "COL_CN":"机型", "COL_ORDER":"8" - }, - { - "COL_CODE":"ZDLQS", - "COL_CN":"最大廊桥数", - "COL_ORDER":"9" - }, - { - "COL_CODE":"ZZU", - "COL_CN":"机型组", - "COL_ORDER":"10" - }, - { - "COL_CODE":"CAA", - "COL_CN":"CAA码", - "COL_ORDER":"11" - }, - { - "COL_CODE":"IATA", - "COL_CN":"IATA码", - "COL_ORDER":"12" - }, - { - "COL_CODE":"ICAO", - "COL_CN":"ICAO码", - "COL_ORDER":"13" } ] \ No newline at end of file diff --git a/src/assets/mock-data/aircraft-data.json b/src/assets/mock-data/aircraft-data.json index 6329c37..fb6c9f4 100644 --- a/src/assets/mock-data/aircraft-data.json +++ b/src/assets/mock-data/aircraft-data.json @@ -1,7 +1,7 @@ [ { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"B\"}", "offset": 1988, "partition": 0, "highWaterOffset": 3975, @@ -9,7 +9,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"T\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"CH\", \"JX\": \"C\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -17,7 +17,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"G\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"CH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -25,7 +25,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"T\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"C\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -33,7 +33,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"CH\", \"JX\": \"B\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -41,7 +41,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"G\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -49,7 +49,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"CH\", \"JX\": \"B\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -57,7 +57,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"G\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"C\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -65,7 +65,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -73,7 +73,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -81,7 +81,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -89,7 +89,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -97,7 +97,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -105,7 +105,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -113,7 +113,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -121,7 +121,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -129,7 +129,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -137,7 +137,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -145,7 +145,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -153,7 +153,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -161,7 +161,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, diff --git a/src/assets/mock-data/aircraft-type-code.json b/src/assets/mock-data/aircraft-type-code.json index 86164c2..5c2c8c4 100644 --- a/src/assets/mock-data/aircraft-type-code.json +++ b/src/assets/mock-data/aircraft-type-code.json @@ -1,42 +1,67 @@ [ { "COL_CODE":"FLNO", - "COL_CN":"飞机号", + "COL_CN":"机型代码", "COL_ORDER":"1" }, { "COL_CODE":"ALCD", - "COL_CN":"最大乘客数", + "COL_CN":"机型名称", "COL_ORDER":"2" }, { "COL_CODE":"HZ", - "COL_CN":"最大货物重量", + "COL_CN":"飞机长度", "COL_ORDER":"3" }, { "COL_CODE":"ZY", - "COL_CN":"最大起飞重量", + "COL_CN":"翼展", "COL_ORDER":"4" }, { "COL_CODE":"LQ", - "COL_CN":"最大廊桥数", + "COL_CN":"机身高度", "COL_ORDER":"5" }, { "COL_CODE":"ZJ", - "COL_CN":"机主航空公司", + "COL_CN":"最大乘客数", "COL_ORDER":"6" }, { "COL_CODE":"HK", - "COL_CN":"航空公司", + "COL_CN":"最大货物重量", "COL_ORDER":"7" }, { "COL_CODE":"JX", - "COL_CN":"机型", + "COL_CN":"最大起飞重量", "COL_ORDER":"8" + }, + { + "COL_CODE":"ZDLQS", + "COL_CN":"最大廊桥数", + "COL_ORDER":"9" + }, + { + "COL_CODE":"ZZU", + "COL_CN":"机型组", + "COL_ORDER":"10" + }, + { + "COL_CODE":"CAA", + "COL_CN":"CAA码", + "COL_ORDER":"11" + }, + { + "COL_CODE":"IATA", + "COL_CN":"IATA码", + "COL_ORDER":"12" + }, + { + "COL_CODE":"ICAO", + "COL_CN":"ICAO码", + "COL_ORDER":"13" } -] \ No newline at end of file +] diff --git a/src/assets/mock-data/aircraft-type-data.json b/src/assets/mock-data/aircraft-type-data.json index fb6c9f4..6329c37 100644 --- a/src/assets/mock-data/aircraft-type-data.json +++ b/src/assets/mock-data/aircraft-type-data.json @@ -1,7 +1,7 @@ [ { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"B\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1988, "partition": 0, "highWaterOffset": 3975, @@ -9,7 +9,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"CH\", \"JX\": \"C\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"T\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -17,7 +17,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"CH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"G\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -25,7 +25,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"C\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"T\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -33,7 +33,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"CH\", \"JX\": \"B\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -41,7 +41,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"G\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -49,7 +49,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"CH\", \"JX\": \"B\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -57,7 +57,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"C\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"G\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -65,7 +65,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -73,7 +73,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -81,7 +81,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -89,7 +89,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -97,7 +97,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -105,7 +105,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -113,7 +113,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -121,7 +121,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -129,7 +129,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -137,7 +137,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -145,7 +145,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -153,7 +153,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -161,7 +161,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"GH\", \"JX\": \"A\"}", + "value": "{\"ALCD\": \"ADFKJDNL\", \"FLNO\": \"AN28\", \"HZ\": \"12.68\", \"ZY\": \"0.0\", \"LQ\": \"236\", \"ZJ\": \"9999\", \"HK\": \"88888\",\"JX\": \"2222000\",\"ZDLQS\": \"666\",\"ZZU\": \"E\",\"CAA\": \"CAA000\",\"IATA\": \"AN8552\",\"ICAO\": \"AN285\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, From af3a5f7fdb826693ed6359f33088452f5b92efc2 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 11:28:18 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E3=80=81=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E3=80=81=E8=88=AA=E7=AB=99=E6=A5=BC=E5=8C=BA=E5=9F=9F=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE?= =?UTF-8?q?=E7=A1=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/basic-data/gate/gate.component.scss | 2 +- .../terminal-area.component.html | 14 +- .../terminal-area.component.scss | 11 +- .../terminal-area/terminal-area.component.ts | 621 ++++++------------ 4 files changed, 231 insertions(+), 417 deletions(-) diff --git a/src/app/pages/basic-data/gate/gate.component.scss b/src/app/pages/basic-data/gate/gate.component.scss index 2b946a6..dba3c39 100644 --- a/src/app/pages/basic-data/gate/gate.component.scss +++ b/src/app/pages/basic-data/gate/gate.component.scss @@ -42,7 +42,7 @@ background: rgb(181, 215, 255); } } - th{ + th{ background-color: #ddd; } th,td{ diff --git a/src/app/pages/basic-data/terminal-area/terminal-area.component.html b/src/app/pages/basic-data/terminal-area/terminal-area.component.html index 7bd5a54..18d9615 100644 --- a/src/app/pages/basic-data/terminal-area/terminal-area.component.html +++ b/src/app/pages/basic-data/terminal-area/terminal-area.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/terminal-area/terminal-area.component.scss b/src/app/pages/basic-data/terminal-area/terminal-area.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/terminal-area/terminal-area.component.scss +++ b/src/app/pages/basic-data/terminal-area/terminal-area.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/terminal-area/terminal-area.component.ts b/src/app/pages/basic-data/terminal-area/terminal-area.component.ts index db86f50..1e7871a 100644 --- a/src/app/pages/basic-data/terminal-area/terminal-area.component.ts +++ b/src/app/pages/basic-data/terminal-area/terminal-area.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ selector: 'app-terminal-area', templateUrl: './terminal-area.component.html', @@ -22,22 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public terminalarea_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -130,428 +117,246 @@ ngOnInit() { } this.combined_data.push(row_flights) }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); + + } + /** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 -} - -/* Enter键触发事件过滤条件数据 */ -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } - + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } } From 07635bb6d858ca3835c2a1d710b1094a68997df4 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 11:51:37 +0800 Subject: [PATCH 14/20] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E3=80=81=E6=A0=B7=E5=BC=8F=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=81=E8=88=AA=E7=A9=BA=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E7=B2=BE=E7=A1=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-data/airline/airline.component.html | 41 +- .../basic-data/airline/airline.component.scss | 11 +- .../basic-data/airline/airline.component.ts | 652 +++++++----------- src/assets/mock-data/airline-code-data.json | 42 +- 4 files changed, 302 insertions(+), 444 deletions(-) diff --git a/src/app/pages/basic-data/airline/airline.component.html b/src/app/pages/basic-data/airline/airline.component.html index cb03a25..fca1e01 100644 --- a/src/app/pages/basic-data/airline/airline.component.html +++ b/src/app/pages/basic-data/airline/airline.component.html @@ -14,7 +14,7 @@ 查找定位 - +
{{airline_col.COL_CN}} - + {{i+1}} + {{airline_row['renderFlight'][airline_col.COL_CODE]}} diff --git a/src/app/pages/basic-data/airline/airline.component.scss b/src/app/pages/basic-data/airline/airline.component.scss index cf17098..dba3c39 100644 --- a/src/app/pages/basic-data/airline/airline.component.scss +++ b/src/app/pages/basic-data/airline/airline.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/airline/airline.component.ts b/src/app/pages/basic-data/airline/airline.component.ts index 2f80add..4a26cea 100644 --- a/src/app/pages/basic-data/airline/airline.component.ts +++ b/src/app/pages/basic-data/airline/airline.component.ts @@ -2,6 +2,9 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; + @Component({ selector: 'app-airline', templateUrl: './airline.component.html', @@ -22,22 +25,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public airline_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -45,16 +33,26 @@ FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 public filterItems = { - + JT: '', //航空集团 + HZ: '', //航班代理 } public formatter = { + 'JT': { + 'GH': '国内航空集团', + 'CH': '国际航空集团', + "QH": '其他航空集团' + }, + 'HZ': { + 'GZ': '广州', + 'XG': '香港华明', + "QT": '其他城市' + }, 'SODT': dateFormatter, 'ESTT': dateFormatter, 'ACTT': dateFormatter } - selectRow(i) { this.row_state = i; this.changeDetectorRef.detectChanges(); @@ -87,7 +85,7 @@ ngOnInit() { this.raw_data.push(JSON.parse(element.value)); }); - let combined_linked_data = this.raw_data + let combined_linked_data = this.raw_data; combined_linked_data.forEach(element => { let row_flights = {}; @@ -129,430 +127,266 @@ ngOnInit() { row_flights['renderPreFlight'] = render_pre_flight; row_flights['renderReaFlight'] = render_rea_flight; } - this.combined_data.push(row_flights) + this.combined_data.push(row_flights); }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - + //this.doSequence(this.combined_data); this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } +/** + * 执行排序并渲染 + */ +/* doSequence(sequenceData) { + sequenceData.forEach(element => { + element['ORDER'] = this.sequence(element); + }) - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 + sequenceData.sort(function (a, b) { + return (a['ORDER'] - b['ORDER']); + }) + + this.render_data = sequenceData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; + this.changeDetectorRef.detectChanges(); +} */ + +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -/* Enter键触发事件过滤条件数据 */ -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } - + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } } diff --git a/src/assets/mock-data/airline-code-data.json b/src/assets/mock-data/airline-code-data.json index acacc9d..4fc6091 100644 --- a/src/assets/mock-data/airline-code-data.json +++ b/src/assets/mock-data/airline-code-data.json @@ -1,7 +1,7 @@ [ { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"GH\"}", "offset": 1988, "partition": 0, "highWaterOffset": 3975, @@ -9,7 +9,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"GH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -17,7 +17,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -25,7 +25,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"QH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -33,7 +33,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -41,7 +41,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"QH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -49,7 +49,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"GZ\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"QH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -57,7 +57,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"QH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -65,7 +65,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"GZ\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"QH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -73,7 +73,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -81,7 +81,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -89,7 +89,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"GZ\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"QH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -97,7 +97,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -105,7 +105,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"GZ\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -113,7 +113,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -121,7 +121,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -129,7 +129,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"GZ\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -137,7 +137,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -145,7 +145,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"XG\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -153,7 +153,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"GZ\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, @@ -161,7 +161,7 @@ }, { "topic": "schd", - "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"GZ\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"CH\"}", "offset": 1989, "partition": 0, "highWaterOffset": 3975, From 15eaf78882b27ceb65d4f3ec7ec1a66b64b684ca Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 13:32:59 +0800 Subject: [PATCH 15/20] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E3=80=81=E6=A0=B7=E5=BC=8F=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=81=E5=9F=8E=E5=B8=82=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8F=8A=E6=9F=A5=E6=89=BE=E5=AE=9A=E4=BD=8D=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/basic-data/city/city.component.html | 20 +- .../pages/basic-data/city/city.component.scss | 11 +- .../pages/basic-data/city/city.component.ts | 621 ++++++------------ 3 files changed, 234 insertions(+), 418 deletions(-) diff --git a/src/app/pages/basic-data/city/city.component.html b/src/app/pages/basic-data/city/city.component.html index f74993a..91d69c8 100644 --- a/src/app/pages/basic-data/city/city.component.html +++ b/src/app/pages/basic-data/city/city.component.html @@ -14,7 +14,7 @@ 查找定位 - +
- +
+ - + + diff --git a/src/app/pages/basic-data/city/city.component.scss b/src/app/pages/basic-data/city/city.component.scss index fb75750..511cff0 100644 --- a/src/app/pages/basic-data/city/city.component.scss +++ b/src/app/pages/basic-data/city/city.component.scss @@ -1,6 +1,7 @@ .main-page { width: 100%; - height: calc(100% - 66px); + height: 100%; + overflow-y: scroll; padding: 15px 10px; background-color: #fff; .page-content { @@ -31,15 +32,19 @@ // border: 1px solid #ccc; width: 100%; height: 700px; - overflow: scroll; + overflow: auto; + box-shadow: 0 0 1px .5px #ddd; table{ width: max-content; tr{ cursor: pointer; - &.active{ + &.selected{ background: rgb(181, 215, 255); } } + th{ + background-color: #ddd; + } th,td{ // border: none; text-align: center; diff --git a/src/app/pages/basic-data/city/city.component.ts b/src/app/pages/basic-data/city/city.component.ts index 953eb14..61f79ed 100644 --- a/src/app/pages/basic-data/city/city.component.ts +++ b/src/app/pages/basic-data/city/city.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; import dateFormatter from '../../../utils/data-formatter'; +import { HttpParams } from '@angular/common/http'; +import * as $ from 'jquery'; @Component({ selector: 'app-city', templateUrl: './city.component.html', @@ -22,22 +24,7 @@ public render_data: Array = []; //显示数据,即需要显示的数 public city_lists: Array; //列数据 -public row_state: number; - -public TOP_1 = 1000000000000; -public TOP_2 = 2000000000000; -public TOP_3 = 3000000000000; -public TOP_4 = 4000000000000; -public TOP_5 = 5000000000000; -public TOP_6 = 6000000000000; -public TOP_7 = 7000000000000; -public TOP_8 = 8000000000000; -public TOP_9 = 9000000000000; -public TOP_10 = 10000000000000; -public TOP_11 = 11000000000000; -public TOP_12 = 12000000000000; -public TOP_13 = 13000000000000; -public TOP_14 = 14000000000000; +public row_state: any = { renderFlight: {} }; // 搜索条件 SEARCH = ''; //手动输入条件 @@ -59,7 +46,6 @@ public formatter = { 'ACTT': dateFormatter } - selectRow(i) { this.row_state = i; this.changeDetectorRef.detectChanges(); @@ -136,428 +122,245 @@ ngOnInit() { } this.combined_data.push(row_flights) }) - - //排序 - this.combined_data.forEach(element => { - element['ORDER'] = this.sequence(element) - }) - - this.combined_data.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); } ) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); +} +/** + * 过滤及定位 + * @param filterItems + * @return + */ +//输入框回车事件 +inputEnter() { + if (this.FLT_POS === 1) { + this.selectChange() + } else { + this.selectChange() + this.inputPosition(this.render_data) + } } -public sequence(flight) { - let dateTag: number = 10; - let dateToCompare = new Date().getTime(); - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDelayed(flight)) { - if (this.isLinked(flight)) { - if (this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_1; - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_2; - } - } - else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_3; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_4; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isFlying(flight) && !this.getActualDatetime(flight['preFlight'])) { - if (this.getEstimatedDatetime(flight['preFlight'])) { - dateToCompare = new Date(dateFormatter(this.getEstimatedDatetime(flight['preFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - dateTag = this.TOP_5; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isLinked(flight) && this.getActualDatetime(flight['preFlight']) && !this.getActualDatetime(flight['reaFlight'])) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_6; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isDeptFlight(flight) && !this.startBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_7; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isArriFlight(flight) && this.isDone(flight)) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_8; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && this.isOverBoading(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_9; - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && !this.isDone(flight) && !this.isFlying(flight)) { - if (this.isLinked(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_10; - } else if (this.isArriFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - dateTag = this.TOP_11; - } - return dateToCompare + dateTag; - } - if (!this.isCancled(flight) && this.isDone(flight) && (this.isLinked(flight) || this.isDeptFlight(flight))) { - dateToCompare = new Date(dateFormatter(this.getActualDatetime(flight['reaFlight']))).getTime(); - dateTag = this.TOP_12; - return dateToCompare + dateTag; - } - if (this.isCancled(flight)) { - if (this.isDeptFlight(flight)) { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['reaFlight']))).getTime(); - } else { - dateToCompare = new Date(dateFormatter(this.getScheduledDatetime(flight['preFlight']))).getTime(); - } - - dateTag = this.TOP_13; - return dateToCompare + dateTag; - } - return this.TOP_14 -} - -/* Enter键触发事件过滤条件数据 */ -inputFliter() { - let filterItems = this.filterItems; - let combined_data = this.combined_data; +//下拉框选择筛选 +selectChange() { let filter_data = []; - - let sel_col = this.SEL_COL; - - if (this.FLT_POS === 1) { //过滤 - //手动输入框筛选 - if(sel_col){ - combined_data.forEach(item=>{ - if(item['renderFlight'][sel_col]){ - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + let filterItems = this.filterItems; + this.combined_data.forEach(item => { + filter_data.push(Object.assign({}, item)); + }) + //下拉框筛选 + filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - }else{ - if(!this.SEARCH){ - filter_data.push(Object.assign({}, item)) + + } + } + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; + } else { + let pre_satis = true; + let rea_satis = true; + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['preFlight'][key] === filterItems[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterItems) { + if (filterItems.hasOwnProperty(key) && filterItems[key]) { + if (item['reaFlight'][key] === filterItems[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item['renderFlight'] = item['renderPreFlight']; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item['renderFlight'] = item['renderReaFlight']; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } + } + }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } 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(); + } +} + +//输入框筛选 +inputFilter(filterData) { + if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item['renderFlight'][sel_col]) { + if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; + } + } else { + if (this.SEARCH) { + return false; + } else { + return true; } } }) - }else{ - combined_data.forEach(item => { + + } else { + filterData = filterData.filter(item => { + let is_satis = false; for (const key in item['renderFlight']) { if (item['renderFlight'].hasOwnProperty(key)) { if (item['renderFlight'][key]) { if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - filter_data.push(Object.assign({}, item)) + is_satis = true; break; + } else { + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } } + return is_satis; }) } - - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (this.isArriFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else if (this.isDeptFlight(item)) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if(pre_satis&&!rea_satis){ - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - }else if(!pre_satis&&rea_satis){ - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - }else if(pre_satis&&rea_satis){ - return pre_satis&&rea_satis; - }else{ - return false; - } - } - }) - - this.render_data = filter_data; - - } else { //定位 - } - + this.render_data = filterData; + this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; this.changeDetectorRef.detectChanges(); } -/** - * 获取航班实际时间 - * @param flight - * @return - */ - public getActualDatetime(flight) { - return flight['ACTT']; - } +positionArray: Array = []; +positionArrayIndex: number = 0; +//输入框定位 +inputPosition(filterData) { + let transArray = [] + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element['renderFlight'][sel_col]) { + if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + } + } else { + if (!this.SEARCH) { + transArray.push(element) + } + } + }); + } else { + filterData.forEach(element => { + for (const key in element['renderFlight']) { + if (element['renderFlight'].hasOwnProperty(key)) { + if (element['renderFlight'][key]) { + if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - /** - * 获取航班预计时间 - * @param flight - * @return - */ - public getEstimatedDatetime(flight) { - return flight['ESTT'] - } + } else { + continue; + } + } + }); + } - /** - * 获取航班计划时间 - * @param flight - * @return - */ - public getScheduledDatetime(flight) { - return flight['SODT'] - } + if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; + } + } else { + alert('没有搜索到相关数据'); + } + this.changeDetectorRef.detectChanges(); - /** - * 判断航班是否是链接航班 - * @param flight - * @return - */ - public isLinked(flight) { - if (flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - } - - /** - * 判断航班是否是纯离港航班 - * @param flight - * @return - */ - public isDeptFlight(flight) { - if (!flight['preFlight'] && flight['reaFlight']) { - return true - } else { - return false - } - - } - - /** - * 判断航班是否是纯到港航班 - * @param flight - * @return - */ - public isArriFlight(flight) { - if (flight['preFlight'] && !flight['reaFlight']) { - return true; - } else { - return false; - } - } - - /** - * 判断航班是否已经前站起飞 - * @param flight - * @return - */ - public isFlying(flight) { - if (this.isArriFlight(flight) || this.isLinked(flight)) { - if (flight['preFlight']['PADT']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否取消 - * @param flight - * @return - */ - public isCancled(flight) { - if (this.isArriFlight(flight)) { - if (flight['preFlight']['CNCL']) { - return true; - } else { - return false; - } - } else if (this.isDeptFlight(flight)) { - if (flight['reaFlight']['CNCL']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - /** - * 判断航班是否延误(只针对纯离港航班或链接航班中的离港航班) - * @param flight - * @return - */ - public isDelayed(flight) { - if (this.isDeptFlight(flight) || this.isLinked(flight)) { - if (flight['reaFlight']['DELY']) { - return true - } else { - return false - } - } else { - return false; - } - } - - /** - * 判断航班是否已经执行完成 - * @param flight - * @return - */ - public isDone(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!this.getActualDatetime(flight['reaFlight'])) { - return false; - } else { - return true; - } - } else if (this.isArriFlight(flight)) { - if (!this.getActualDatetime(flight['preFlight'])) { - return false; - } else { - return true; - } - } else { - return false; - } - } - - /** - * 判断航班是否开始登机 - * @param flight - * @return - */ - public startBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['reaFlight']['BOTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - - } - - /** - * 判断航班是否正在登机中 - * @param flight - * @return - */ - public isBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (flight['reaFlight']['BOTM'] && !flight['reaFlight']['GCTM']) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - - /** - * 判断航班是否登机结束 - * @param flight - * @return - */ - public isOverBoading(flight) { - if (this.isLinked(flight) || this.isDeptFlight(flight)) { - if (!flight['GCTM']) { - return false; - } else { - return true; - } - } else { - return false; - } - } - + let tr = $(".selected"); + let objTr = tr[0]; + $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); + } } From 4b14981b36c93ef654863bce5321d4f1eeb4aff6 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 21 Nov 2018 18:18:50 +0800 Subject: [PATCH 16/20] =?UTF-8?q?=E8=88=AA=E7=A9=BA=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-data/airline/airline.component.html | 47 ++- .../basic-data/airline/airline.component.ts | 295 +++--------------- 2 files changed, 70 insertions(+), 272 deletions(-) diff --git a/src/app/pages/basic-data/airline/airline.component.html b/src/app/pages/basic-data/airline/airline.component.html index fca1e01..5fde90d 100644 --- a/src/app/pages/basic-data/airline/airline.component.html +++ b/src/app/pages/basic-data/airline/airline.component.html @@ -14,7 +14,7 @@ 查找定位 - +
-
+ + - + - - + + + + + + + + + +
序号 {{airline_col.COL_CN}}
{{i+1}} {{airline_row['renderFlight'][airline_col.COL_CODE]}}
{{airline_col.COL_CN}}上级母公司
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}{{airline.airlineCode}}{{airline.airlineName}}{{airline.briefNameChn}}{{airline.airlineNameEng}}{{airline.briefNameEng}}{{airline.airlineCodeIata}}{{airline.airlineCodeCaa}}{{airline.airlineCodeIcao}}{{airline.parentAirlineId}}
diff --git a/src/app/pages/basic-data/airline/airline.component.ts b/src/app/pages/basic-data/airline/airline.component.ts index 4a26cea..114b9a2 100644 --- a/src/app/pages/basic-data/airline/airline.component.ts +++ b/src/app/pages/basic-data/airline/airline.component.ts @@ -1,139 +1,42 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; - @Component({ - selector: 'app-airline', - templateUrl: './airline.component.html', - styleUrls: ['./airline.component.scss'] + selector: 'app-airline', + templateUrl: './airline.component.html', + styleUrls: ['./airline.component.scss'] }) export class AirlineComponent implements OnInit { - constructor( - private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef -) { } + constructor( + private httpCilent: HttpClientService, + private basicDataService: BasicDataService + ) { } -public raw_data: Array = []; //原始数据,即航班计划 + // 搜索条件 + SEARCH = ''; //手动输入条件 + FLT_POS = 1; //过滤还是定位 + SEL_COL = ''; //选择列名 -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public airline_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - -// 搜索条件 -SEARCH = ''; //手动输入条件 -FLT_POS = 1; //过滤还是定位 -SEL_COL = ''; //选择列名 - -public filterItems = { - JT: '', //航空集团 - HZ: '', //航班代理 -} - -public formatter = { - 'JT': { - 'GH': '国内航空集团', - 'CH': '国际航空集团', - "QH": '其他航空集团' - }, - 'HZ': { - 'GZ': '广州', - 'XG': '香港华明', - "QT": '其他城市' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null + airlines:Array; + public row_state: any = { renderFlight: {} }; + public render_data: Array = []; //显示数据,即需要显示的数据 + public return_data: Array = []; //下拉框显示数据 + //下拉框 + public filterItems = { + airlineName:'', + briefNameChn:'', } -} - -ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/airline-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.airline_lists = data; - } - ) - /* 获取航空公司信息 */ - this.httpCilent.get('/assets/mock-data/airline-code-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data; - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.airline_lists.length; i++) { - let key = this.airline_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.airline_lists.length; i++) { - let key = this.airline_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights); - }) - //this.doSequence(this.combined_data); - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) + ngOnInit() { + this.airlines = this.basicDataService.airline; + this.basicDataService.airline_subject.subscribe( + data=>{ + this.airlines = data; + this.render_data = this.airlines; + } + ) /** * 固定表头 */ @@ -143,128 +46,36 @@ ngOnInit() { this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; } tableCont.addEventListener('scroll',scrollHandle); -} + } -/** - * 执行排序并渲染 - */ -/* doSequence(sequenceData) { - sequenceData.forEach(element => { - element['ORDER'] = this.sequence(element); - }) - - sequenceData.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - - this.render_data = sequenceData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} */ - -/** - * 过滤及定位 - * @param filterItems - * @return - */ //输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { - this.selectChange() + this.inputFilter(this.airlines) } else { - this.selectChange() - this.inputPosition(this.render_data) + this.inputFilter(this.airlines) + // this.inputPosition(this.render_data) } } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { + this.return_data = this.airlines.filter(item=>{ let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in this.filterItems) {debugger + if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { + if (item[key] === this.filterItems[key]) { is_satis = true; continue; } else { is_satis = false; break; } - } } return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); - } + this.render_data = this.return_data; } //输入框筛选 @@ -273,8 +84,8 @@ inputFilter(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -289,10 +100,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -318,7 +129,6 @@ inputFilter(filterData) { } this.render_data = filterData; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); } positionArray: Array = []; @@ -329,8 +139,8 @@ inputPosition(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -341,10 +151,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -381,12 +191,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } From 80fcf5b89e17b362c32336e193a980f18b50373f Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 21 Nov 2018 18:19:57 +0800 Subject: [PATCH 17/20] =?UTF-8?q?=E6=9C=BA=E5=9E=8B=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aircraft-type.component.html | 48 ++-- .../aircraft-type/aircraft-type.component.ts | 258 +++--------------- 2 files changed, 67 insertions(+), 239 deletions(-) diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html index 99bebd6..2dd8cfa 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.html @@ -14,7 +14,7 @@ 查找定位 - +
@@ -43,7 +44,7 @@ 序号 - - {{airline_col.COL_CN}} + ICAO码 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{aircraftType.aircraftTypeCode}} + {{aircraftType.aircraftTypeName}} + {{aircraftType.aircraftLength}} + {{aircraftType.aircraftWidth}} + {{aircraftType.aircraftHeight}} + {{aircraftType.maxPassengers}} + {{aircraftType.maxFreightWeight}} + {{aircraftType.maxTakeoffWeight}} + {{aircraftType.maxAirbridges}} + {{aircraftType.aircrafttypegroupId}} + {{aircraftType.aircraftTypeCodeCaa}} + {{aircraftType.aircraftTypeCodeIata}} + {{aircraftType.aircraftTypeCodeIcao}} + diff --git a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts index 8da9868..26adbb0 100644 --- a/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts +++ b/src/app/pages/basic-data/aircraft-type/aircraft-type.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,233 +12,70 @@ export class AircraftTypeComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public aircrafttype_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 +//下拉框 public filterItems = { - ZZU: '', //机型组 -} - -public formatter = { - 'ZZU': { - 'E': 'E-类飞机机型', - 'T': 'T-类飞机机型', - 'G': 'G-类飞机机型' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } + aircrafttypegroupId:'', } +aircraftTypes : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 +public return_data: Array = []; //下拉框显示数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/aircraft-type-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.aircrafttype_lists = data; + this.aircraftTypes = this.basicDataService.aircraft_type; + this.basicDataService.aircraft_type_subject.subscribe( + data=>{ + this.aircraftTypes = data; + this.render_data = this.aircraftTypes; } ) - /* 获取机型信息 */ - this.httpCilent.get('/assets/mock-data/aircraft-type-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.aircrafttype_lists.length; i++) { - let key = this.aircrafttype_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.aircrafttype_lists.length; i++) { - let key = this.aircrafttype_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 过滤及定位 - * @param filterItems - * @return - */ -//输入框回车事件 +///输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { - this.selectChange() + this.inputFilter(this.aircraftTypes) } else { - this.selectChange() - this.inputPosition(this.render_data) + this.inputFilter(this.aircraftTypes) + // this.inputPosition(this.render_data) } } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { + this.return_data = this.aircraftTypes.filter(item=>{ let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in this.filterItems) { + if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { + if (item[key] === this.filterItems[key]) { is_satis = true; continue; } else { is_satis = false; break; } - } } return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); - } + this.render_data = this.return_data; } //输入框筛选 @@ -248,8 +84,8 @@ inputFilter(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -264,10 +100,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -293,7 +129,6 @@ inputFilter(filterData) { } this.render_data = filterData; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); } positionArray: Array = []; @@ -304,8 +139,8 @@ inputPosition(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -316,10 +151,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -356,12 +191,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } From 93f9dc094023770b39526bc33cd86246cc9ce2d3 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 21 Nov 2018 18:22:08 +0800 Subject: [PATCH 18/20] =?UTF-8?q?=E6=9C=BA=E5=9C=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-data/airport/airport.component.html | 51 ++-- .../basic-data/airport/airport.component.ts | 262 +++------------- .../carousel/carousel.component.html | 41 +-- .../basic-data/carousel/carousel.component.ts | 283 +++-------------- .../pages/basic-data/gate/gate.component.html | 136 ++++----- .../pages/basic-data/gate/gate.component.ts | 283 +++-------------- .../basic-data/stand/stand.component.html | 50 +-- .../pages/basic-data/stand/stand.component.ts | 288 +++--------------- 8 files changed, 312 insertions(+), 1082 deletions(-) diff --git a/src/app/pages/basic-data/airport/airport.component.html b/src/app/pages/basic-data/airport/airport.component.html index 06c137b..a406903 100644 --- a/src/app/pages/basic-data/airport/airport.component.html +++ b/src/app/pages/basic-data/airport/airport.component.html @@ -14,7 +14,7 @@ 查找定位 - +
+
- - - + +
@@ -52,7 +54,7 @@ 序号 - - {{airline_col.COL_CN}} + 所在城市 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{airport.airportCode}} + {{airport.airportNameChn}} + {{airport.briefNameChn}} + {{airport.airportNameEng}} + {{airport.briefNameEng}} + {{airport.airportCodeIata}} + {{airport.airportCodeCaa}} + {{airport.airportCodeIcao}} + {{airport.airportGroupId}} + {{airport.cityId}} + diff --git a/src/app/pages/basic-data/airport/airport.component.ts b/src/app/pages/basic-data/airport/airport.component.ts index 4faa289..d2530d8 100644 --- a/src/app/pages/basic-data/airport/airport.component.ts +++ b/src/app/pages/basic-data/airport/airport.component.ts @@ -1,9 +1,8 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; +import { BasicDataService } from '../../basic-data-service' @Component({ selector: 'app-airport', templateUrl: './airport.component.html', @@ -13,238 +12,71 @@ export class AirportComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public airport_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 +//下拉框 public filterItems = { - JT: '', //机场集团 - CS: '', //所在城市 + airportGroupId:'', + cityId:'', } -public formatter = { - 'JT': { - 'GH': '国内区域', - 'CH': '国际区域' - }, - 'CS': { - 'GZ': '广州', - 'SH': '上海', - "BJ": '北京' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} +airports : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 +public return_data: Array = []; //下拉框显示数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/airport-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.airport_lists = data; + this.airports = this.basicDataService.airport; + this.basicDataService.airport_subject.subscribe( + data=>{ + this.airports = data; + this.render_data = this.airports; } ) - /* 获取机场信息 */ - this.httpCilent.get('/assets/mock-data/airport-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.airport_lists.length; i++) { - let key = this.airport_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.airport_lists.length; i++) { - let key = this.airport_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } - -/** - * 过滤及定位 - * @param filterItems - * @return - */ //输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { - this.selectChange() + this.inputFilter(this.airports) } else { - this.selectChange() - this.inputPosition(this.render_data) + this.inputFilter(this.airports) + // this.inputPosition(this.render_data) } } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { + this.return_data = this.airports.filter(item=>{ let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in this.filterItems) { + if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { + if (item[key] === this.filterItems[key]) { is_satis = true; continue; } else { is_satis = false; break; } - } } return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); - } + this.render_data = this.return_data; } //输入框筛选 @@ -253,8 +85,8 @@ inputFilter(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -269,10 +101,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -298,7 +130,6 @@ inputFilter(filterData) { } this.render_data = filterData; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); } positionArray: Array = []; @@ -309,8 +140,8 @@ inputPosition(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -321,10 +152,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -361,12 +192,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } diff --git a/src/app/pages/basic-data/carousel/carousel.component.html b/src/app/pages/basic-data/carousel/carousel.component.html index 83fa5ab..2fbc36f 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.html +++ b/src/app/pages/basic-data/carousel/carousel.component.html @@ -14,31 +14,33 @@ 查找定位 - +
- +
- - - + +
- - - - + +
@@ -50,22 +52,21 @@ 序号 - - {{airline_col.COL_CN}} + 资源状态 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{carousel.carouselCode}} + {{carousel.carouselName}} + {{carousel.terminalAreaCode}} + {{carousel.carouselStatus}} + diff --git a/src/app/pages/basic-data/carousel/carousel.component.ts b/src/app/pages/basic-data/carousel/carousel.component.ts index fb95031..48a2196 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.ts +++ b/src/app/pages/basic-data/carousel/carousel.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @@ -14,257 +13,69 @@ export class CarouselComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public carousel_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 - +//下拉框 public filterItems = { - HZ: '', //所属航站楼区域 - ZY: '', //资源状态 + terminalAreaCode:'', + carouselStatus:'', } - -public formatter = { - 'HZ': { - 'GH': '国内区域', - 'CH': '国际区域', - "QT": '其他区域' - }, - 'ZY': { - 'K': '可用', - 'R': '不可用', - "T": '其他' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} - +carousels:Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 +public return_data: Array = []; //下拉框显示数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/carousel-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.carousel_lists = data; + this.carousels = this.basicDataService.carousel; + this.basicDataService.carousel_subject.subscribe( + data=>{ + this.carousels = data; + this.render_data = this.carousels; } ) - /* 获取行李转盘信息 */ - this.httpCilent.get('/assets/mock-data/carousel-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.carousel_lists.length; i++) { - let key = this.carousel_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.carousel_lists.length; i++) { - let key = this.carousel_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - // this.doSequence(this.combined_data); - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 执行排序并渲染 - */ -/* doSequence(sequenceData) { - sequenceData.forEach(element => { - element['ORDER'] = this.sequence(element); - }) - - sequenceData.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - - this.render_data = sequenceData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} */ - -/** - * 过滤及定位 - * @param filterItems - * @return - */ //输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { - this.selectChange() + this.inputFilter(this.carousels) } else { - this.selectChange() - this.inputPosition(this.render_data) + this.inputFilter(this.carousels) + // this.inputPosition(this.render_data) } } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { + this.return_data = this.carousels.filter(item=>{ let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in this.filterItems) { + if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { + if (item[key] === this.filterItems[key]) { is_satis = true; continue; } else { is_satis = false; break; } - } } return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); - } + this.render_data = this.return_data; } //输入框筛选 @@ -273,8 +84,8 @@ inputFilter(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -289,10 +100,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -318,7 +129,6 @@ inputFilter(filterData) { } this.render_data = filterData; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); } positionArray: Array = []; @@ -329,8 +139,8 @@ inputPosition(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -341,10 +151,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -381,12 +191,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } diff --git a/src/app/pages/basic-data/gate/gate.component.html b/src/app/pages/basic-data/gate/gate.component.html index e822514..3db51de 100644 --- a/src/app/pages/basic-data/gate/gate.component.html +++ b/src/app/pages/basic-data/gate/gate.component.html @@ -1,75 +1,71 @@
-
-
-
-
- - +
+
+
+
+ - -
-
- - -
-
- -
+ + 过滤 + + + +
+
+ + +
+
+ +
+
+ + +
- - -
-
- - + + +
-
- -
-
- - - - - - - - - - - - - - - -
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
-
-
-
-
\ No newline at end of file + +
+
+ + + + + + + + + + + + + + + + + + + + + +
序号登机门代码登机门名称航站楼区域资源状态
{{i+1}}{{gate.gateCode}}{{gate.gateName}}{{gate.terminalAreaCode}}{{gate.gateStatus}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/gate/gate.component.ts b/src/app/pages/basic-data/gate/gate.component.ts index 67ffe4a..db59526 100644 --- a/src/app/pages/basic-data/gate/gate.component.ts +++ b/src/app/pages/basic-data/gate/gate.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,257 +12,71 @@ export class GateComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public gate_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 +//下拉框 public filterItems = { - HZ: '', //所属航站楼区域 - ZY: '', //资源状态 -} - -public formatter = { - 'HZ': { - 'GH': '国内区域', - 'CH': '国际区域', - "QT": '其他区域' - }, - 'ZY': { - 'K': '可用', - 'R': '不可用', - "T": '其他' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } + terminalAreaCode:'', + gateStatus:'', } +gates : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 +public return_data: Array = []; //下拉框显示数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/gate-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.gate_lists = data; + this.gates = this.basicDataService.gate; + this.basicDataService.gate_subject.subscribe( + data=>{ + this.gates = data; + this.render_data = this.gates; } ) - /* 获取登机门信息 */ - this.httpCilent.get('/assets/mock-data/gate-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.gate_lists.length; i++) { - let key = this.gate_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.gate_lists.length; i++) { - let key = this.gate_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights); - }) - // this.doSequence(this.combined_data); - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 执行排序并渲染 - */ -/* doSequence(sequenceData) { - sequenceData.forEach(element => { - element['ORDER'] = this.sequence(element); - }) - - sequenceData.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - - this.render_data = sequenceData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} */ - -/** - * 过滤及定位 - * @param filterItems - * @return - */ //输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { - this.selectChange() + this.inputFilter(this.gates) } else { - this.selectChange() - this.inputPosition(this.render_data) + this.inputFilter(this.gates) + // this.inputPosition(this.render_data) } } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { + this.return_data = this.gates.filter(item=>{ let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in this.filterItems) { + if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { + if (item[key] === this.filterItems[key]) { is_satis = true; continue; } else { is_satis = false; break; } - } } return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); - } + this.render_data = this.return_data; } //输入框筛选 @@ -272,8 +85,8 @@ inputFilter(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -288,10 +101,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -317,7 +130,6 @@ inputFilter(filterData) { } this.render_data = filterData; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); } positionArray: Array = []; @@ -328,8 +140,8 @@ inputPosition(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -340,10 +152,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -380,12 +192,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); -} - + } } diff --git a/src/app/pages/basic-data/stand/stand.component.html b/src/app/pages/basic-data/stand/stand.component.html index 161727d..bdd1785 100644 --- a/src/app/pages/basic-data/stand/stand.component.html +++ b/src/app/pages/basic-data/stand/stand.component.html @@ -14,7 +14,7 @@ 查找定位 - +
- - - + +
- - - - + +
@@ -60,24 +63,23 @@ 序号 - - {{airline_col.COL_CN}} + 航站楼区域 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{stand.standCode}} + {{stand.standName}} + {{stand.standType}} + {{stand.standStatus}} + {{stand.terminalAreaCode}} + diff --git a/src/app/pages/basic-data/stand/stand.component.ts b/src/app/pages/basic-data/stand/stand.component.ts index 0682a68..1a79f12 100644 --- a/src/app/pages/basic-data/stand/stand.component.ts +++ b/src/app/pages/basic-data/stand/stand.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,264 +12,71 @@ export class StandComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public stand_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 +//下拉框 public filterItems = { - ZY: '', //所属航站楼区域 - HZ: '', //机位类型 - ZYZT: '', //资源状态 -} - -public formatter = { - 'ZY': { - 'GH': '国内区域', - 'CH': '国际区域', - "QH": '其他区域' - }, - 'HZ': { - 'YJW': '远机位', - 'JJW': '近机位', - "GWJW": '过夜机位', - "ZJW": '专机位' - }, - 'ZYZT': { - 'K': '可用', - 'R': '不可用', - "T": '其他' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } + terminalAreaCode:'', + gateStatus:'', } +stands : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 +public return_data: Array = []; //下拉框显示数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/stand-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.stand_lists = data; + this.stands = this.basicDataService.stand; + this.basicDataService.stand_subject.subscribe( + data=>{ + this.stands = data; + this.render_data = this.stands; } ) - /* 获取机位信息 */ - this.httpCilent.get('/assets/mock-data/stand-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.stand_lists.length; i++) { - let key = this.stand_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.stand_lists.length; i++) { - let key = this.stand_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - // this.doSequence(this.combined_data); - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 执行排序并渲染 - */ -/* doSequence(sequenceData) { - sequenceData.forEach(element => { - element['ORDER'] = this.sequence(element); - }) - - sequenceData.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - - this.render_data = sequenceData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} */ - -/** - * 过滤及定位 - * @param filterItems - * @return - */ //输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { - this.selectChange() + this.inputFilter(this.stands) } else { - this.selectChange() - this.inputPosition(this.render_data) + this.inputFilter(this.stands) + // this.inputPosition(this.render_data) } } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { + this.return_data = this.stands.filter(item=>{ let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in this.filterItems) { + if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) { + if (item[key] === this.filterItems[key]) { is_satis = true; continue; } else { is_satis = false; break; } - } } return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; - } - } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); - } + this.render_data = this.return_data; } //输入框筛选 @@ -279,8 +85,8 @@ inputFilter(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -295,10 +101,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -324,7 +130,6 @@ inputFilter(filterData) { } this.render_data = filterData; this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); } positionArray: Array = []; @@ -335,8 +140,8 @@ inputPosition(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -347,10 +152,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -387,12 +192,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } From afa2130c8d656a9e91d44a99f4d9b8f4ed5b4e05 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 21 Nov 2018 18:24:06 +0800 Subject: [PATCH 19/20] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkin-group.component.html | 19 +- .../checkin-group/checkin-group.component.ts | 519 +++++++----------- 2 files changed, 210 insertions(+), 328 deletions(-) diff --git a/src/app/pages/basic-data/checkin-group/checkin-group.component.html b/src/app/pages/basic-data/checkin-group/checkin-group.component.html index e7d4cec..9eb8af7 100644 --- a/src/app/pages/basic-data/checkin-group/checkin-group.component.html +++ b/src/app/pages/basic-data/checkin-group/checkin-group.component.html @@ -14,12 +14,12 @@ 查找定位 - +
- +
@@ -30,18 +30,17 @@ 序号 - - {{airline_col.COL_CN}} + 值机岛代码 + 值机岛名称 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{checkinGroup.checkinGroupCode}} + {{checkinGroup.checkinGroupName}} + diff --git a/src/app/pages/basic-data/checkin-group/checkin-group.component.ts b/src/app/pages/basic-data/checkin-group/checkin-group.component.ts index 7e67f39..553b222 100644 --- a/src/app/pages/basic-data/checkin-group/checkin-group.component.ts +++ b/src/app/pages/basic-data/checkin-group/checkin-group.component.ts @@ -1,9 +1,8 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; +import { BasicDataService } from '../../basic-data-service' @Component({ selector: 'app-checkin-group', templateUrl: './checkin-group.component.html', @@ -13,367 +12,251 @@ export class CheckinGroupComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public col_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 -public filterItems = { - -} - -public formatter = { - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} - +checkinGroups : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/checkin-group.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.col_lists = data; + this.checkinGroups = this.basicDataService.checkin_group; + this.basicDataService.checkin_group_subject.subscribe( + data=>{ + this.checkinGroups = data; + this.render_data = this.checkinGroups; } ) - /* 获取值机岛信息 */ - this.httpCilent.get('/assets/mock-data/checkin-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = 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['preFlight'][key], 1) : this.formatter[key] ? this.formatter[key][row_flights['preFlight'][key]] : row_flights['preFlight'][key]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - 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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - // this.doSequence(this.combined_data); - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container') - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle) + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 执行排序并渲染 - */ -/* doSequence(sequenceData) { - sequenceData.forEach(element => { - element['ORDER'] = '+' + element['order'] - }) - - sequenceData.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - - this.render_data = sequenceData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} */ - -/** - * 过滤及定位 - * @param filterItems - * @return - */ +//刷新 +clearFiter(){ + $("#inputerInfo").val(""); //清空过滤或查找定位文本框 + this.ngOnInit(); +} //输入框回车事件 inputEnter() { - if (this.FLT_POS === 1) { - this.selectChange() - } else { - this.selectChange() - this.inputPosition(this.render_data) - } +if (this.FLT_POS === 1) { + this.selectChange() +} else { + this.selectChange() + this.inputPosition(this.render_data) +} } //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - +let filter_data = []; +let filtercheckinGroups = this.render_data; +this.render_data.forEach(item => { + filter_data.push(Object.assign({}, item)); +}) +if (this.FLT_POS === 1) { + this.inputFilter(filter_data); +} else { + this.checkinGroups = filter_data; + this.row_state = this.checkinGroups.length > 0 ? this.checkinGroups[0] : { renderFlight: {} }; +} +//下拉框筛选 +filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filtercheckinGroups) { + if (filtercheckinGroups.hasOwnProperty(key) && filtercheckinGroups[key]) { + if (item[key] === filtercheckinGroups[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - } - return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; } } - }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filtercheckinGroups) { + if (filtercheckinGroups.hasOwnProperty(key) && filtercheckinGroups[key]) { + if (item[key] === filtercheckinGroups[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; } 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(); + let pre_satis = true; + let rea_satis = true; + for (const key in filtercheckinGroups) { + if (filtercheckinGroups.hasOwnProperty(key) && filtercheckinGroups[key]) { + if (item[key] === filtercheckinGroups[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filtercheckinGroups) { + if (filtercheckinGroups.hasOwnProperty(key) && filtercheckinGroups[key]) { + if (item[key] === filtercheckinGroups[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item = item; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item = item; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } } +}) } //输入框筛选 inputFilter(filterData) { - if (this.SEARCH) { - if (this.SEL_COL) { - let sel_col = this.SEL_COL; - filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - return true; - } - } else { - if (this.SEARCH) { - return false; - } else { - return true; - } +if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; } - }) - } else { - filterData = filterData.filter(item => { - let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - is_satis = true; - break; - } else { - is_satis = false; - continue; - } + } else { + if (this.SEARCH) { + return false; + } else { + return true; + } + } + }) + + } else { + filterData = filterData.filter(item => { + let is_satis = false; + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { + is_satis = true; + break; } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } - return is_satis; - }) - } + } + return is_satis; + }) } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); +} +this.checkinGroups = filterData; +this.row_state = this.checkinGroups.length > 0 ? this.checkinGroups[0] : { renderFlight: {} }; } positionArray: Array = []; positionArrayIndex: number = 0; //输入框定位 inputPosition(filterData) { - let transArray = [] - if (this.SEL_COL) { - let sel_col = this.SEL_COL; - filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - transArray.push(element) - } - } else { - if (!this.SEARCH) { - transArray.push(element) - } +let transArray = [] +if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData.forEach(element => { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) } - }); - } else { - filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - transArray.push(element) - break; - } else { - continue; - } - } else { - if (this.SEARCH) { - continue; - } else { - transArray.push(element) - break; - } - } - - } else { - continue; - } - } - }); - } - - if (transArray.length > 0) { - if (transArray.toString() == this.positionArray.toString()) { - this.positionArrayIndex++; - if (this.positionArrayIndex === this.positionArray.length) { - this.positionArrayIndex = 0; - } - this.row_state = this.positionArray[this.positionArrayIndex]; } else { - this.positionArray = transArray; - this.positionArrayIndex = 0; - this.row_state = this.positionArray[this.positionArrayIndex]; + if (!this.SEARCH) { + transArray.push(element) + } } - } else { - alert('没有搜索到相关数据'); - } + }); +} else { + filterData.forEach(element => { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { + transArray.push(element) + break; + } else { + continue; + } + } else { + if (this.SEARCH) { + continue; + } else { + transArray.push(element) + break; + } + } - this.changeDetectorRef.detectChanges(); + } else { + continue; + } + } + }); +} - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - +if (transArray.length > 0) { + if (transArray.toString() == this.positionArray.toString()) { + this.positionArrayIndex++; + if (this.positionArrayIndex === this.positionArray.length) { + this.positionArrayIndex = 0; + } + this.row_state = this.positionArray[this.positionArrayIndex]; + } else { + this.positionArray = transArray; + this.positionArrayIndex = 0; + this.row_state = this.positionArray[this.positionArrayIndex]; } +} else { + alert('没有搜索到相关数据'); +} +} } From 742d78e88733c8e534d64e678400aad95cb50f38 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 21 Nov 2018 18:25:07 +0800 Subject: [PATCH 20/20] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aircraft/aircraft.component.html | 35 +- .../basic-data/aircraft/aircraft.component.ts | 258 ++++------- .../checkin-desk/checkin-desk.component.html | 31 +- .../checkin-desk/checkin-desk.component.ts | 284 ++++-------- .../pages/basic-data/chut/chut.component.html | 19 +- .../pages/basic-data/chut/chut.component.ts | 415 +++++++---------- .../pages/basic-data/city/city.component.html | 25 +- .../pages/basic-data/city/city.component.ts | 251 ++++------- .../terminal-area.component.html | 19 +- .../terminal-area/terminal-area.component.ts | 248 ++++------- .../terminal/terminal.component.html | 19 +- .../basic-data/terminal/terminal.component.ts | 417 +++++++----------- 12 files changed, 669 insertions(+), 1352 deletions(-) diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.html b/src/app/pages/basic-data/aircraft/aircraft.component.html index ac5d3d0..50fd68f 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.html +++ b/src/app/pages/basic-data/aircraft/aircraft.component.html @@ -14,20 +14,20 @@ 查找定位 - +
- +
- @@ -35,7 +35,7 @@
- @@ -51,30 +51,29 @@ 序号 - - {{airline_col.COL_CN}} + 机型 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{aircraft.aircraftNumber}} + {{aircraft.maxPassengers}} + {{aircraft.maxFreightWeight}} + {{aircraft.maxTakeoffWeight}} + {{aircraft.maxAirbridges}} + {{aircraft.aircraftOwnerCode}} + {{aircraft.airlineCode}} + {{aircraft.aircraftTypeCode}} + diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.ts b/src/app/pages/basic-data/aircraft/aircraft.component.ts index 54ecf56..889e4cf 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.ts +++ b/src/app/pages/basic-data/aircraft/aircraft.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,164 +12,73 @@ import * as $ from 'jquery'; constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public aircraft_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 -public filterItems = { - HK: '', //航空公司 - JX: '', //机型 -} - -public formatter = { - 'HK': { - 'GH': '海南航空公司', - 'CH': '国外航空公司' - }, - 'JX': { - 'A': 'A306', - 'B': 'B252', - "C": 'C256' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} - +aircrafts : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/aircraft-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.aircraft_lists = data; + this.aircrafts = this.basicDataService.aircraft; + this.basicDataService.aircraft_subject.subscribe( + data=>{ + this.aircrafts = data; + this.render_data = this.aircrafts; } ) - /* 获取飞机信息 */ - this.httpCilent.get('/assets/mock-data/aircraft-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.aircraft_lists.length; i++) { - let key = this.aircraft_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.aircraft_lists.length; i++) { - let key = this.aircraft_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 过滤及定位 - * @param filterItems - * @return - */ +//刷新 +clearFiter(){ + $("#inputerInfo").val(""); //清空过滤或查找定位文本框 + $("#airlineCompany").val(""); //清空航空公司 + $("#jx").val(""); //清空机型 + this.ngOnInit(); +} //输入框回车事件 inputEnter() { - if (this.FLT_POS === 1) { - this.selectChange() - } else { - this.selectChange() - this.inputPosition(this.render_data) - } +if (this.FLT_POS === 1) { + this.selectChange() +} else { + this.selectChange() + this.inputPosition(this.render_data) +} } //下拉框选择筛选 selectChange() { let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { + let filteraircrafts = this.render_data; + this.render_data.forEach(item => { filter_data.push(Object.assign({}, item)); }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } else { + this.aircrafts = filter_data; + this.row_state = this.aircrafts.length > 0 ? this.aircrafts[0] : { renderFlight: {} }; + } //下拉框筛选 filter_data = filter_data.filter(item => { if (item) { let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in filteraircrafts) { + if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) { + if (item[key] === filteraircrafts[key]) { is_satis = true; continue; } else { @@ -183,9 +91,9 @@ selectChange() { return is_satis; } else if (item) { let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { + for (const key in filteraircrafts) { + if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) { + if (item[key] === filteraircrafts[key]) { is_satis = true; continue; } else { @@ -199,9 +107,9 @@ selectChange() { } else { let pre_satis = true; let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in filteraircrafts) { + if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) { + if (item[key] === filteraircrafts[key]) { pre_satis = true; continue; } else { @@ -211,9 +119,9 @@ selectChange() { } } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { + for (const key in filteraircrafts) { + if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) { + if (item[key] === filteraircrafts[key]) { rea_satis = true; continue; } else { @@ -225,10 +133,10 @@ selectChange() { } if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; + item = item; return pre_satis; } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; + item = item; return rea_satis; } else if (pre_satis && rea_satis) { return pre_satis && rea_satis; @@ -237,24 +145,16 @@ selectChange() { } } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); } -} -//输入框筛选 -inputFilter(filterData) { + //输入框筛选 + inputFilter(filterData) { if (this.SEARCH) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -269,10 +169,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -296,21 +196,20 @@ inputFilter(filterData) { }) } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} + this.aircrafts = filterData; + this.row_state = this.aircrafts.length > 0 ? this.aircrafts[0] : { renderFlight: {} }; + } -positionArray: Array = []; -positionArrayIndex: number = 0; -//输入框定位 -inputPosition(filterData) { + positionArray: Array = []; + positionArrayIndex: number = 0; + //输入框定位 + inputPosition(filterData) { let transArray = [] if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -321,10 +220,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -361,12 +260,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } diff --git a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html index f4074dd..a78066f 100644 --- a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html +++ b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.html @@ -14,19 +14,19 @@ 查找定位 - +
- +
- @@ -35,7 +35,7 @@
- @@ -44,7 +44,7 @@
- @@ -60,24 +60,23 @@ 序号 - - {{airline_col.COL_CN}} + 航站楼区域 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{checkinDesk.checkindeskCode}} + {{checkinDesk.checkindeskName}} + {{checkinDesk.checkinGroupCode}} + {{checkinDesk.chutCode}} + {{checkinDesk.terminalAreaCode}} + diff --git a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts index 7495c74..f244420 100644 --- a/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts +++ b/src/app/pages/basic-data/checkin-desk/checkin-desk.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,189 +12,74 @@ export class CheckinDeskComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public checkindesk_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 -public filterItems = { - HZ: '', //所属航站楼区域 - JJ: '', //值机岛 - ZY: '', //行李传送带 -} - -public formatter = { - 'HZ': { - 'GH': '国内区域', - 'CH': '国际区域', - "QH": '其他区域' - }, - 'JJ': { - 'A': 'A岛', - 'B': 'B岛', - "C": 'C岛' - }, - 'ZY': { - 'X': 'X行李', - 'Z': 'Z行李', - "Y": 'Y行李' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} - +checkinDesks : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/checkindesk-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.checkindesk_lists = data; + this.checkinDesks = this.basicDataService.checkin_desk; + this.basicDataService.checkin_desk_subject.subscribe( + data=>{ + this.checkinDesks = data; + this.render_data = this.checkinDesks; } ) - /* 获取值机柜台信息 */ - this.httpCilent.get('/assets/mock-data/checkindesk-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.checkindesk_lists.length; i++) { - let key = this.checkindesk_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.checkindesk_lists.length; i++) { - let key = this.checkindesk_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights); - }) - //this.doSequence(this.combined_data); - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 执行排序并渲染 - */ -/* doSequence(sequenceData) { - sequenceData.forEach(element => { - element['ORDER'] = this.sequence(element); - }) - - sequenceData.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - - this.render_data = sequenceData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} */ - -/** - * 过滤及定位 - * @param filterItems - * @return - */ +//刷新 +clearFiter(){ + $("#inputerInfo").val(""); //清空过滤或查找定位文本框 + $("#qy").val(""); //清空所属航站楼区域 + $("#zjd").val(""); //清空值机岛 + $("#xl").val(""); //清空行李传送带 + this.ngOnInit(); +} //输入框回车事件 inputEnter() { - if (this.FLT_POS === 1) { - this.selectChange() - } else { - this.selectChange() - this.inputPosition(this.render_data) - } +if (this.FLT_POS === 1) { + this.selectChange() +} else { + this.selectChange() + this.inputPosition(this.render_data) +} } //下拉框选择筛选 selectChange() { let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { + let filtercheckinDesks = this.render_data; + this.render_data.forEach(item => { filter_data.push(Object.assign({}, item)); }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } else { + this.checkinDesks = filter_data; + this.row_state = this.checkinDesks.length > 0 ? this.checkinDesks[0] : { renderFlight: {} }; + } //下拉框筛选 filter_data = filter_data.filter(item => { if (item) { let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in filtercheckinDesks) { + if (filtercheckinDesks.hasOwnProperty(key) && filtercheckinDesks[key]) { + if (item[key] === filtercheckinDesks[key]) { is_satis = true; continue; } else { @@ -208,9 +92,9 @@ selectChange() { return is_satis; } else if (item) { let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { + for (const key in filtercheckinDesks) { + if (filtercheckinDesks.hasOwnProperty(key) && filtercheckinDesks[key]) { + if (item[key] === filtercheckinDesks[key]) { is_satis = true; continue; } else { @@ -224,9 +108,9 @@ selectChange() { } else { let pre_satis = true; let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in filtercheckinDesks) { + if (filtercheckinDesks.hasOwnProperty(key) && filtercheckinDesks[key]) { + if (item[key] === filtercheckinDesks[key]) { pre_satis = true; continue; } else { @@ -236,9 +120,9 @@ selectChange() { } } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { + for (const key in filtercheckinDesks) { + if (filtercheckinDesks.hasOwnProperty(key) && filtercheckinDesks[key]) { + if (item[key] === filtercheckinDesks[key]) { rea_satis = true; continue; } else { @@ -250,10 +134,10 @@ selectChange() { } if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; + item = item; return pre_satis; } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; + item = item; return rea_satis; } else if (pre_satis && rea_satis) { return pre_satis && rea_satis; @@ -262,24 +146,16 @@ selectChange() { } } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); } -} -//输入框筛选 -inputFilter(filterData) { + //输入框筛选 + inputFilter(filterData) { if (this.SEARCH) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -294,10 +170,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -321,21 +197,20 @@ inputFilter(filterData) { }) } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} + this.checkinDesks = filterData; + this.row_state = this.checkinDesks.length > 0 ? this.checkinDesks[0] : { renderFlight: {} }; + } -positionArray: Array = []; -positionArrayIndex: number = 0; -//输入框定位 -inputPosition(filterData) { + positionArray: Array = []; + positionArrayIndex: number = 0; + //输入框定位 + inputPosition(filterData) { let transArray = [] if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -346,10 +221,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -386,12 +261,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } diff --git a/src/app/pages/basic-data/chut/chut.component.html b/src/app/pages/basic-data/chut/chut.component.html index 0a36e05..254b85a 100644 --- a/src/app/pages/basic-data/chut/chut.component.html +++ b/src/app/pages/basic-data/chut/chut.component.html @@ -14,12 +14,12 @@ 查找定位 - +
- +
@@ -30,18 +30,17 @@ 序号 - - {{airline_col.COL_CN}} + 行李传送带代码 + 行李传送带名称 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{chut.chutCode}} + {{chut.chutName}} + diff --git a/src/app/pages/basic-data/chut/chut.component.ts b/src/app/pages/basic-data/chut/chut.component.ts index b6e456b..9b382df 100644 --- a/src/app/pages/basic-data/chut/chut.component.ts +++ b/src/app/pages/basic-data/chut/chut.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,147 +12,41 @@ export class ChutComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public chut_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 -public filterItems = { - -} - -public formatter = { - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} - +chuts : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/chut-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.chut_lists = data; + this.chuts = this.basicDataService.chut; + this.basicDataService.chut_subject.subscribe( + data=>{ + this.chuts = data; + this.render_data = this.chuts; } ) - /* 获取行李传送带信息 */ - this.httpCilent.get('/assets/mock-data/chut-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.chut_lists.length; i++) { - let key = this.chut_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]; - } - row_flights['renderFlight'] = render_flight;if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.chut_lists.length; i++) { - let key = this.chut_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - //this.doSequence(this.combined_data); - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 执行排序并渲染 - */ -/* doSequence(sequenceData) { - sequenceData.forEach(element => { - element['ORDER'] = this.sequence(element); - }) - - sequenceData.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - - this.render_data = sequenceData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} */ - -/** - * 过滤及定位 - * @param filterItems - * @return - */ +//刷新 +clearFiter(){ + $("#inputerInfo").val(""); //清空过滤或查找定位文本框 + this.ngOnInit(); +} //输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { @@ -166,146 +59,143 @@ inputEnter() { //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - +let filter_data = []; +let filterchuts = this.render_data; +this.render_data.forEach(item => { + filter_data.push(Object.assign({}, item)); +}) +if (this.FLT_POS === 1) { + this.inputFilter(filter_data); +} else { + this.chuts = filter_data; + this.row_state = this.chuts.length > 0 ? this.chuts[0] : { renderFlight: {} }; +} +//下拉框筛选 +filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterchuts) { + if (filterchuts.hasOwnProperty(key) && filterchuts[key]) { + if (item[key] === filterchuts[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - } - return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; } } - }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterchuts) { + if (filterchuts.hasOwnProperty(key) && filterchuts[key]) { + if (item[key] === filterchuts[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; } 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(); + let pre_satis = true; + let rea_satis = true; + for (const key in filterchuts) { + if (filterchuts.hasOwnProperty(key) && filterchuts[key]) { + if (item[key] === filterchuts[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterchuts) { + if (filterchuts.hasOwnProperty(key) && filterchuts[key]) { + if (item[key] === filterchuts[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item = item; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item = item; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } } +}) } //输入框筛选 inputFilter(filterData) { - if (this.SEARCH) { - if (this.SEL_COL) { - let sel_col = this.SEL_COL; - filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - return true; - } - } else { - if (this.SEARCH) { - return false; - } else { - return true; - } +if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; } - }) + } else { + if (this.SEARCH) { + return false; + } else { + return true; + } + } + }) - } else { - filterData = filterData.filter(item => { - let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - is_satis = true; - break; - } else { - is_satis = false; - continue; - } + } else { + filterData = filterData.filter(item => { + let is_satis = false; + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { + is_satis = true; + break; } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } - return is_satis; - }) - } + } + return is_satis; + }) } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); +} + this.chuts = filterData; + this.row_state = this.chuts.length > 0 ? this.chuts[0] : { renderFlight: {} }; } positionArray: Array = []; @@ -316,8 +206,8 @@ inputPosition(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -328,10 +218,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -368,12 +258,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } diff --git a/src/app/pages/basic-data/city/city.component.html b/src/app/pages/basic-data/city/city.component.html index 91d69c8..fa31878 100644 --- a/src/app/pages/basic-data/city/city.component.html +++ b/src/app/pages/basic-data/city/city.component.html @@ -14,7 +14,7 @@ 查找定位 - +
- +
@@ -37,7 +37,7 @@
- @@ -64,22 +64,21 @@ 序号 - - {{airline_col.COL_CN}} + 所在国家 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{city.cityCode}} + {{city.cityNameChn}} + {{city.cityNameEng}} + {{city.countryId}} + diff --git a/src/app/pages/basic-data/city/city.component.ts b/src/app/pages/basic-data/city/city.component.ts index 61f79ed..35c9aaa 100644 --- a/src/app/pages/basic-data/city/city.component.ts +++ b/src/app/pages/basic-data/city/city.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,158 +12,72 @@ export class CityComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public city_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 -public filterItems = { - ZY: '', //所在国家 -} - -public formatter = { - 'ZY': { - 'ZG': '中国', - 'MG': '美国', - "YG": '英国' - }, - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} - +citys : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/city-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.city_lists = data; - } - ) - /* 获取城市信息 */ - this.httpCilent.get('/assets/mock-data/city-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.city_lists.length; i++) { - let key = this.city_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.city_lists.length; i++) { - let key = this.city_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); + this.citys = this.basicDataService.city; + this.basicDataService.city_subject.subscribe( + data=>{ + this.citys = data; + this.render_data = this.citys; } ) /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); +} + +//刷新 +clearFiter(){ + $("#inputerInfo").val(""); //清空过滤或查找定位文本框 + $("#citry").val(""); //清空所国家 + this.ngOnInit(); } -/** - * 过滤及定位 - * @param filterItems - * @return - */ //输入框回车事件 inputEnter() { - if (this.FLT_POS === 1) { - this.selectChange() - } else { - this.selectChange() - this.inputPosition(this.render_data) - } +if (this.FLT_POS === 1) { + this.selectChange() +} else { + this.selectChange() + this.inputPosition(this.render_data) +} } //下拉框选择筛选 selectChange() { let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { + let filtercitys = this.render_data; + this.render_data.forEach(item => { filter_data.push(Object.assign({}, item)); }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } else { + this.citys = filter_data; + this.row_state = this.citys.length > 0 ? this.citys[0] : { renderFlight: {} }; + } //下拉框筛选 filter_data = filter_data.filter(item => { if (item) { let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in filtercitys) { + if (filtercitys.hasOwnProperty(key) && filtercitys[key]) { + if (item[key] === filtercitys[key]) { is_satis = true; continue; } else { @@ -177,9 +90,9 @@ selectChange() { return is_satis; } else if (item) { let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { + for (const key in filtercitys) { + if (filtercitys.hasOwnProperty(key) && filtercitys[key]) { + if (item[key] === filtercitys[key]) { is_satis = true; continue; } else { @@ -193,9 +106,9 @@ selectChange() { } else { let pre_satis = true; let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in filtercitys) { + if (filtercitys.hasOwnProperty(key) && filtercitys[key]) { + if (item[key] === filtercitys[key]) { pre_satis = true; continue; } else { @@ -205,9 +118,9 @@ selectChange() { } } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { + for (const key in filtercitys) { + if (filtercitys.hasOwnProperty(key) && filtercitys[key]) { + if (item[key] === filtercitys[key]) { rea_satis = true; continue; } else { @@ -219,10 +132,10 @@ selectChange() { } if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; + item = item; return pre_satis; } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; + item = item; return rea_satis; } else if (pre_satis && rea_satis) { return pre_satis && rea_satis; @@ -231,24 +144,16 @@ selectChange() { } } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); } -} -//输入框筛选 -inputFilter(filterData) { + //输入框筛选 + inputFilter(filterData) { if (this.SEARCH) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -263,10 +168,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -290,21 +195,20 @@ inputFilter(filterData) { }) } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} + this.citys = filterData; + this.row_state = this.citys.length > 0 ? this.citys[0] : { renderFlight: {} }; + } -positionArray: Array = []; -positionArrayIndex: number = 0; -//输入框定位 -inputPosition(filterData) { + positionArray: Array = []; + positionArrayIndex: number = 0; + //输入框定位 + inputPosition(filterData) { let transArray = [] if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -315,10 +219,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -355,12 +259,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } diff --git a/src/app/pages/basic-data/terminal-area/terminal-area.component.html b/src/app/pages/basic-data/terminal-area/terminal-area.component.html index 18d9615..f862faf 100644 --- a/src/app/pages/basic-data/terminal-area/terminal-area.component.html +++ b/src/app/pages/basic-data/terminal-area/terminal-area.component.html @@ -14,12 +14,12 @@ 查找定位 - +
- +
@@ -30,18 +30,17 @@ 序号 - - {{airline_col.COL_CN}} + 航站楼区域代码 + 航站楼区域名称 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{terminalArea.terminalAreaCode}} + {{terminalArea.terminalAreaName}} + diff --git a/src/app/pages/basic-data/terminal-area/terminal-area.component.ts b/src/app/pages/basic-data/terminal-area/terminal-area.component.ts index 1e7871a..2162bd2 100644 --- a/src/app/pages/basic-data/terminal-area/terminal-area.component.ts +++ b/src/app/pages/basic-data/terminal-area/terminal-area.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,154 +12,71 @@ export class TerminalAreaComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public terminalarea_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 -public filterItems = { - -} - -public formatter = { - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} - +terminalAreas : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/terminal-area-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.terminalarea_lists = data; + this.terminalAreas = this.basicDataService.terminal_area; + this.basicDataService.terminal_area_subject.subscribe( + data=>{ + this.terminalAreas = data; + this.render_data = this.terminalAreas; } ) - /* 获取航站楼区域信息 */ - this.httpCilent.get('/assets/mock-data/terminal-area-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.terminalarea_lists.length; i++) { - let key = this.terminalarea_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]; - } - row_flights['renderFlight'] = render_flight; - if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.terminalarea_lists.length; i++) { - let key = this.terminalarea_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); - - } /** - * 过滤及定位 - * @param filterItems - * @return - */ + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); +} + +//刷新 +clearFiter(){ + $("#inputerInfo").val(""); //清空过滤或查找定位文本框 + this.ngOnInit(); +} //输入框回车事件 inputEnter() { - if (this.FLT_POS === 1) { - this.selectChange() - } else { - this.selectChange() - this.inputPosition(this.render_data) - } +if (this.FLT_POS === 1) { + this.selectChange() +} else { + this.selectChange() + this.inputPosition(this.render_data) +} } //下拉框选择筛选 selectChange() { let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { + let filterterminalAreas = this.render_data; + this.render_data.forEach(item => { filter_data.push(Object.assign({}, item)); }) + if (this.FLT_POS === 1) { + this.inputFilter(filter_data); + } else { + this.terminalAreas = filter_data; + this.row_state = this.terminalAreas.length > 0 ? this.terminalAreas[0] : { renderFlight: {} }; + } //下拉框筛选 filter_data = filter_data.filter(item => { if (item) { let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in filterterminalAreas) { + if (filterterminalAreas.hasOwnProperty(key) && filterterminalAreas[key]) { + if (item[key] === filterterminalAreas[key]) { is_satis = true; continue; } else { @@ -173,9 +89,9 @@ selectChange() { return is_satis; } else if (item) { let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { + for (const key in filterterminalAreas) { + if (filterterminalAreas.hasOwnProperty(key) && filterterminalAreas[key]) { + if (item[key] === filterterminalAreas[key]) { is_satis = true; continue; } else { @@ -189,9 +105,9 @@ selectChange() { } else { let pre_satis = true; let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { + for (const key in filterterminalAreas) { + if (filterterminalAreas.hasOwnProperty(key) && filterterminalAreas[key]) { + if (item[key] === filterterminalAreas[key]) { pre_satis = true; continue; } else { @@ -201,9 +117,9 @@ selectChange() { } } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { + for (const key in filterterminalAreas) { + if (filterterminalAreas.hasOwnProperty(key) && filterterminalAreas[key]) { + if (item[key] === filterterminalAreas[key]) { rea_satis = true; continue; } else { @@ -215,10 +131,10 @@ selectChange() { } if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; + item = item; return pre_satis; } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; + item = item; return rea_satis; } else if (pre_satis && rea_satis) { return pre_satis && rea_satis; @@ -227,24 +143,16 @@ selectChange() { } } }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); - } 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(); } -} -//输入框筛选 -inputFilter(filterData) { + //输入框筛选 + inputFilter(filterData) { if (this.SEARCH) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { return true; } } else { @@ -259,10 +167,10 @@ inputFilter(filterData) { } else { filterData = filterData.filter(item => { let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { is_satis = true; break; } else { @@ -286,21 +194,20 @@ inputFilter(filterData) { }) } } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} + this.terminalAreas = filterData; + this.row_state = this.terminalAreas.length > 0 ? this.terminalAreas[0] : { renderFlight: {} }; + } -positionArray: Array = []; -positionArrayIndex: number = 0; -//输入框定位 -inputPosition(filterData) { + positionArray: Array = []; + positionArrayIndex: number = 0; + //输入框定位 + inputPosition(filterData) { let transArray = [] if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -311,10 +218,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -351,12 +258,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - } } diff --git a/src/app/pages/basic-data/terminal/terminal.component.html b/src/app/pages/basic-data/terminal/terminal.component.html index 3ae079d..7b3fd53 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.html +++ b/src/app/pages/basic-data/terminal/terminal.component.html @@ -14,12 +14,12 @@ 查找定位 - +
- +
@@ -30,18 +30,17 @@ 序号 - - {{airline_col.COL_CN}} + 航站楼代码 + 航站楼名称 + - + {{i+1}} - - {{airline_row['renderFlight'][airline_col.COL_CODE]}} + {{terminal.terminalCode}} + {{terminal.terminalName}} + diff --git a/src/app/pages/basic-data/terminal/terminal.component.ts b/src/app/pages/basic-data/terminal/terminal.component.ts index 7d8e397..52426c1 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.ts +++ b/src/app/pages/basic-data/terminal/terminal.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { ChangeDetectorRef } from '@angular/core'; import { HttpClientService } from '../../../services/http-client.service'; -import dateFormatter from '../../../utils/data-formatter'; +import { BasicDataService } from '../../basic-data-service' import { HttpParams } from '@angular/common/http'; import * as $ from 'jquery'; @Component({ @@ -13,147 +12,41 @@ export class TerminalComponent implements OnInit { constructor( private httpCilent: HttpClientService, - private changeDetectorRef: ChangeDetectorRef + private basicDataService: BasicDataService ) { } -public raw_data: Array = []; //原始数据,即航班计划 - -public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 - -public render_data: Array = []; //显示数据,即需要显示的数据 - -public terminal_lists: Array; //列数据 - -public row_state: any = { renderFlight: {} }; - // 搜索条件 SEARCH = ''; //手动输入条件 FLT_POS = 1; //过滤还是定位 SEL_COL = ''; //选择列名 -public filterItems = { - -} - -public formatter = { - 'SODT': dateFormatter, - 'ESTT': dateFormatter, - 'ACTT': dateFormatter -} - -selectRow(i) { - this.row_state = i; - this.changeDetectorRef.detectChanges(); -} - -getColor(col_CODE) { - if (col_CODE === 'SODT') { - return 'skyblue' - } else { - return null - } -} - +terminals : Array; +public row_state: any = { renderFlight: {} }; +public render_data: Array = []; //显示数据,即需要显示的数据 ngOnInit() { - this.changeDetectorRef.detach(); - /* 获取显示列 */ - this.httpCilent.get('/assets/mock-data/terminal-code.json').subscribe( - data => { - data.sort(function (a, b) { - return (a['COL_ORDER'] - b['COL_ORDER']); - }) - this.terminal_lists = data; + this.terminals = this.basicDataService.terminal; + this.basicDataService.terminal_subject.subscribe( + data=>{ + this.terminals = data; + this.render_data = this.terminals; } ) - /* 获取航站楼信息 */ - this.httpCilent.get('/assets/mock-data/terminal-data.json').subscribe( - data => { - //解析数据 - data.forEach(element => { - this.raw_data.push(JSON.parse(element.value)); - }); - - let combined_linked_data = this.raw_data - - combined_linked_data.forEach(element => { - let row_flights = {}; - let render_flight = {}; - let render_pre_flight = {}; - let render_rea_flight = {}; - row_flights['preFlight'] = element; - - for (let i = 0; i < this.terminal_lists.length; i++) { - let key = this.terminal_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]; - } - row_flights['renderFlight'] = render_flight;if (element['isLinked']) { - row_flights['preFlight'] = element['linkFlight']; - delete element['linkFlight']; - delete element['isLinked']; - row_flights['reaFlight'] = element; - - for (let i = 0; i < this.terminal_lists.length; i++) { - let key = this.terminal_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); - } 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]]; - } - } 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]; - } - } - row_flights['renderFlight'] = render_flight; - row_flights['renderPreFlight'] = render_pre_flight; - row_flights['renderReaFlight'] = render_rea_flight; - } - this.combined_data.push(row_flights) - }) - //this.doSequence(this.combined_data); - this.render_data = this.combined_data - this.changeDetectorRef.detectChanges(); - } - ) - /** - * 固定表头 - */ - var tableCont = document.querySelector('#table-container'); - function scrollHandle (){ - var scrollTop = this.scrollTop; - this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; - } - tableCont.addEventListener('scroll',scrollHandle); + /** + * 固定表头 + */ + var tableCont = document.querySelector('#table-container'); + function scrollHandle (){ + var scrollTop = this.scrollTop; + this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)'; + } + tableCont.addEventListener('scroll',scrollHandle); } -/** - * 执行排序并渲染 - */ -/* doSequence(sequenceData) { - sequenceData.forEach(element => { - element['ORDER'] = this.sequence(element); - }) - - sequenceData.sort(function (a, b) { - return (a['ORDER'] - b['ORDER']); - }) - - this.render_data = sequenceData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); -} */ - -/** - * 过滤及定位 - * @param filterItems - * @return - */ +//刷新 +clearFiter(){ + $("#inputerInfo").val(""); //清空过滤或查找定位文本框 + this.ngOnInit(); +} //输入框回车事件 inputEnter() { if (this.FLT_POS === 1) { @@ -166,146 +59,143 @@ inputEnter() { //下拉框选择筛选 selectChange() { - let filter_data = []; - let filterItems = this.filterItems; - this.combined_data.forEach(item => { - filter_data.push(Object.assign({}, item)); - }) - //下拉框筛选 - filter_data = filter_data.filter(item => { - if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - +let filter_data = []; +let filterterminals = this.render_data; +this.render_data.forEach(item => { + filter_data.push(Object.assign({}, item)); +}) +if (this.FLT_POS === 1) { + this.inputFilter(filter_data); +} else { + this.terminals = filter_data; + this.row_state = this.terminals.length > 0 ? this.terminals[0] : { renderFlight: {} }; +} +//下拉框筛选 +filter_data = filter_data.filter(item => { + if (item) { + let is_satis = true; + for (const key in filterterminals) { + if (filterterminals.hasOwnProperty(key) && filterterminals[key]) { + if (item[key] === filterterminals[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; } - } - return is_satis; - } else if (item) { - let is_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - is_satis = true; - continue; - } else { - is_satis = false; - break; - } - } - } - return is_satis; - } else { - let pre_satis = true; - let rea_satis = true; - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['preFlight'][key] === filterItems[key]) { - pre_satis = true; - continue; - } else { - pre_satis = false; - break; - } - - } - } - for (const key in filterItems) { - if (filterItems.hasOwnProperty(key) && filterItems[key]) { - if (item['reaFlight'][key] === filterItems[key]) { - rea_satis = true; - continue; - } else { - rea_satis = false; - break; - } - - } - } - - if (pre_satis && !rea_satis) { - item['renderFlight'] = item['renderPreFlight']; - return pre_satis; - } else if (!pre_satis && rea_satis) { - item['renderFlight'] = item['renderReaFlight']; - return rea_satis; - } else if (pre_satis && rea_satis) { - return pre_satis && rea_satis; - } else { - return false; } } - }) - if (this.FLT_POS === 1) { - this.inputFilter(filter_data); + return is_satis; + } else if (item) { + let is_satis = true; + for (const key in filterterminals) { + if (filterterminals.hasOwnProperty(key) && filterterminals[key]) { + if (item[key] === filterterminals[key]) { + is_satis = true; + continue; + } else { + is_satis = false; + break; + } + + } + } + return is_satis; } 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(); + let pre_satis = true; + let rea_satis = true; + for (const key in filterterminals) { + if (filterterminals.hasOwnProperty(key) && filterterminals[key]) { + if (item[key] === filterterminals[key]) { + pre_satis = true; + continue; + } else { + pre_satis = false; + break; + } + + } + } + for (const key in filterterminals) { + if (filterterminals.hasOwnProperty(key) && filterterminals[key]) { + if (item[key] === filterterminals[key]) { + rea_satis = true; + continue; + } else { + rea_satis = false; + break; + } + + } + } + + if (pre_satis && !rea_satis) { + item = item; + return pre_satis; + } else if (!pre_satis && rea_satis) { + item = item; + return rea_satis; + } else if (pre_satis && rea_satis) { + return pre_satis && rea_satis; + } else { + return false; + } } +}) } //输入框筛选 inputFilter(filterData) { - if (this.SEARCH) { - if (this.SEL_COL) { - let sel_col = this.SEL_COL; - filterData = filterData.filter(item => { - if (item['renderFlight'][sel_col]) { - if (item['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { - return true; - } - } else { - if (this.SEARCH) { - return false; - } else { - return true; - } +if (this.SEARCH) { + if (this.SEL_COL) { + let sel_col = this.SEL_COL; + filterData = filterData.filter(item => { + if (item[sel_col]) { + if (item[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + return true; } - }) + } else { + if (this.SEARCH) { + return false; + } else { + return true; + } + } + }) - } else { - filterData = filterData.filter(item => { - let is_satis = false; - for (const key in item['renderFlight']) { - if (item['renderFlight'].hasOwnProperty(key)) { - if (item['renderFlight'][key]) { - if (item['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { - is_satis = true; - break; - } else { - is_satis = false; - continue; - } + } else { + filterData = filterData.filter(item => { + let is_satis = false; + for (const key in item) { + if (item.hasOwnProperty(key)) { + if (item[key]) { + if (item[key].toString().match(new RegExp(this.SEARCH, 'i'))) { + is_satis = true; + break; } else { - if (this.SEARCH) { - is_satis = false; - continue; - } else { - is_satis = true; - break; - } + is_satis = false; + continue; } } else { - continue; + if (this.SEARCH) { + is_satis = false; + continue; + } else { + is_satis = true; + break; + } } + } else { + continue; } - return is_satis; - }) - } + } + return is_satis; + }) } - this.render_data = filterData; - this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} }; - this.changeDetectorRef.detectChanges(); +} + this.terminals = filterData; + this.row_state = this.terminals.length > 0 ? this.terminals[0] : { renderFlight: {} }; } positionArray: Array = []; @@ -316,8 +206,8 @@ inputPosition(filterData) { if (this.SEL_COL) { let sel_col = this.SEL_COL; filterData.forEach(element => { - if (element['renderFlight'][sel_col]) { - if (element['renderFlight'][sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { + if (element[sel_col]) { + if (element[sel_col].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) } } else { @@ -328,10 +218,10 @@ inputPosition(filterData) { }); } else { filterData.forEach(element => { - for (const key in element['renderFlight']) { - if (element['renderFlight'].hasOwnProperty(key)) { - if (element['renderFlight'][key]) { - if (element['renderFlight'][key].toString().match(new RegExp(this.SEARCH, 'i'))) { + for (const key in element) { + if (element.hasOwnProperty(key)) { + if (element[key]) { + if (element[key].toString().match(new RegExp(this.SEARCH, 'i'))) { transArray.push(element) break; } else { @@ -368,12 +258,5 @@ inputPosition(filterData) { } else { alert('没有搜索到相关数据'); } - - this.changeDetectorRef.detectChanges(); - - let tr = $(".selected"); - let objTr = tr[0]; - $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow"); - - } + } }