From af3a5f7fdb826693ed6359f33088452f5b92efc2 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Mon, 19 Nov 2018 11:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BA=E5=AE=9A=E8=A1=A8?= =?UTF-8?q?=E5=A4=B4=E3=80=81=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4=E3=80=81?= =?UTF-8?q?=E8=88=AA=E7=AB=99=E6=A5=BC=E5=8C=BA=E5=9F=9F=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/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"); + } }