From c94ad928fed629c18ae381e60a635211d3bddade Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Fri, 16 Nov 2018 16:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=80=BC=E6=9C=BA=E5=B2=9B=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 --- .../checkin-group.component.html | 6 +- .../checkin-group/checkin-group.component.ts | 328 +----------------- 2 files changed, 20 insertions(+), 314 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 19e7f40..e7d4cec 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 @@ -30,13 +30,17 @@ 序号 + {{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; - } - } - - + } }