From 0b7dc085358ce5516f2570155a62b8e104576e79 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Tue, 13 Nov 2018 14:16:16 +0800 Subject: [PATCH 01/34] 1 --- .../checkin-group.component.html | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 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 879c056..4b52672 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 @@ -1,3 +1,47 @@ -

- checkin-group works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file From c46c8e78d31d0f71d3fb4e7229f9177b67f6004c Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Tue, 13 Nov 2018 14:45:04 +0800 Subject: [PATCH 02/34] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=80=BC=E6=9C=BA?= =?UTF-8?q?=E5=B2=9B=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkin-group.component.scss | 63 +++ .../checkin-group/checkin-group.component.ts | 457 +++++++++++++++++- src/assets/mock-data/checkin-data.json | 171 +++++++ src/assets/mock-data/checkin-group.json | 12 + 4 files changed, 700 insertions(+), 3 deletions(-) create mode 100644 src/assets/mock-data/checkin-data.json create mode 100644 src/assets/mock-data/checkin-group.json diff --git a/src/app/pages/basic-data/checkin-group/checkin-group.component.scss b/src/app/pages/basic-data/checkin-group/checkin-group.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/checkin-group/checkin-group.component.scss +++ b/src/app/pages/basic-data/checkin-group/checkin-group.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } 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 03d4922..ce8e245 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,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-checkin-group', templateUrl: './checkin-group.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class CheckinGroupComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +public render_data: Array = []; //显示数据,即需要显示的数据 + +public col_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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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.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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/checkin-data.json b/src/assets/mock-data/checkin-data.json new file mode 100644 index 0000000..7c93dce --- /dev/null +++ b/src/assets/mock-data/checkin-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"CZ\", \"FLNO\": \"CZ3402\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"CA\", \"FLNO\": \"CA4513\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file diff --git a/src/assets/mock-data/checkin-group.json b/src/assets/mock-data/checkin-group.json new file mode 100644 index 0000000..2be516b --- /dev/null +++ b/src/assets/mock-data/checkin-group.json @@ -0,0 +1,12 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"值机岛代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"值机岛名称", + "COL_ORDER":"2" + } +] \ No newline at end of file From aad629326f7c334e96b76472565da0244f4cbe03 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Tue, 13 Nov 2018 15:09:19 +0800 Subject: [PATCH 03/34] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=99=BB=E6=9C=BA?= =?UTF-8?q?=E9=97=A8=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/basic-data/gate/gate.component.html | 69 ++- .../pages/basic-data/gate/gate.component.scss | 63 +++ .../pages/basic-data/gate/gate.component.ts | 457 +++++++++++++++++- src/assets/mock-data/gate-code.json | 22 + src/assets/mock-data/gate-data.json | 171 +++++++ 5 files changed, 776 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/gate-code.json create mode 100644 src/assets/mock-data/gate-data.json diff --git a/src/app/pages/basic-data/gate/gate.component.html b/src/app/pages/basic-data/gate/gate.component.html index e40bcb1..92f7fa3 100644 --- a/src/app/pages/basic-data/gate/gate.component.html +++ b/src/app/pages/basic-data/gate/gate.component.html @@ -1,3 +1,66 @@ -

- gate works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/gate/gate.component.scss b/src/app/pages/basic-data/gate/gate.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/gate/gate.component.scss +++ b/src/app/pages/basic-data/gate/gate.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } diff --git a/src/app/pages/basic-data/gate/gate.component.ts b/src/app/pages/basic-data/gate/gate.component.ts index 7e88429..9f3f713 100644 --- a/src/app/pages/basic-data/gate/gate.component.ts +++ b/src/app/pages/basic-data/gate/gate.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-gate', templateUrl: './gate.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class GateComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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.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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/gate-code.json b/src/assets/mock-data/gate-code.json new file mode 100644 index 0000000..f57c134 --- /dev/null +++ b/src/assets/mock-data/gate-code.json @@ -0,0 +1,22 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"登机门代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"登机门名称", + "COL_ORDER":"2" + }, + { + "COL_CODE":"HZ", + "COL_CN":"航站楼区域", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"资源状态", + "COL_ORDER":"4" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/gate-data.json b/src/assets/mock-data/gate-data.json new file mode 100644 index 0000000..1c05bc6 --- /dev/null +++ b/src/assets/mock-data/gate-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"1\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 3e7771735ed28325c426dd4e449b76327977d99b Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Tue, 13 Nov 2018 15:34:03 +0800 Subject: [PATCH 04/34] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=88=AA=E7=AB=99?= =?UTF-8?q?=E6=A5=BC=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terminal/terminal.component.html | 50 +- .../terminal/terminal.component.scss | 63 +++ .../basic-data/terminal/terminal.component.ts | 457 +++++++++++++++++- src/assets/mock-data/terminal-code.json | 12 + src/assets/mock-data/terminal-data.json | 171 +++++++ 5 files changed, 747 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/terminal-code.json create mode 100644 src/assets/mock-data/terminal-data.json diff --git a/src/app/pages/basic-data/terminal/terminal.component.html b/src/app/pages/basic-data/terminal/terminal.component.html index 37e9ab3..f3c2b95 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.html +++ b/src/app/pages/basic-data/terminal/terminal.component.html @@ -1,3 +1,47 @@ -

- terminal works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/terminal/terminal.component.scss b/src/app/pages/basic-data/terminal/terminal.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.scss +++ b/src/app/pages/basic-data/terminal/terminal.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } diff --git a/src/app/pages/basic-data/terminal/terminal.component.ts b/src/app/pages/basic-data/terminal/terminal.component.ts index d35ba4f..fb54e6f 100644 --- a/src/app/pages/basic-data/terminal/terminal.component.ts +++ b/src/app/pages/basic-data/terminal/terminal.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-terminal', templateUrl: './terminal.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class TerminalComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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.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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/terminal-code.json b/src/assets/mock-data/terminal-code.json new file mode 100644 index 0000000..996be48 --- /dev/null +++ b/src/assets/mock-data/terminal-code.json @@ -0,0 +1,12 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"航站楼代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"航站楼名称", + "COL_ORDER":"2" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/terminal-data.json b/src/assets/mock-data/terminal-data.json new file mode 100644 index 0000000..e82d2fb --- /dev/null +++ b/src/assets/mock-data/terminal-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 805b774054dd8b87fa3ca6f687131db8fa2d364e Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Tue, 13 Nov 2018 17:23:44 +0800 Subject: [PATCH 05/34] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=A1=8C=E6=9D=8E?= =?UTF-8?q?=E8=BD=AC=E9=80=81=E5=B8=A6=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/basic-data/chut/chut.component.html | 50 +- .../pages/basic-data/chut/chut.component.scss | 63 +++ .../pages/basic-data/chut/chut.component.ts | 457 +++++++++++++++++- src/assets/mock-data/chut-code.json | 12 + src/assets/mock-data/chut-data.json | 171 +++++++ 5 files changed, 747 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/chut-code.json create mode 100644 src/assets/mock-data/chut-data.json diff --git a/src/app/pages/basic-data/chut/chut.component.html b/src/app/pages/basic-data/chut/chut.component.html index ce9b83e..64f2e00 100644 --- a/src/app/pages/basic-data/chut/chut.component.html +++ b/src/app/pages/basic-data/chut/chut.component.html @@ -1,3 +1,47 @@ -

- chut works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/chut/chut.component.scss b/src/app/pages/basic-data/chut/chut.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/chut/chut.component.scss +++ b/src/app/pages/basic-data/chut/chut.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } diff --git a/src/app/pages/basic-data/chut/chut.component.ts b/src/app/pages/basic-data/chut/chut.component.ts index 8440d95..c4a45d7 100644 --- a/src/app/pages/basic-data/chut/chut.component.ts +++ b/src/app/pages/basic-data/chut/chut.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-chut', templateUrl: './chut.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class ChutComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +public render_data: Array = []; //显示数据,即需要显示的数据 + +public chut_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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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.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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/chut-code.json b/src/assets/mock-data/chut-code.json new file mode 100644 index 0000000..92d0457 --- /dev/null +++ b/src/assets/mock-data/chut-code.json @@ -0,0 +1,12 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"行李传送带代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"行李传送带名称", + "COL_ORDER":"2" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/chut-data.json b/src/assets/mock-data/chut-data.json new file mode 100644 index 0000000..afbdf7d --- /dev/null +++ b/src/assets/mock-data/chut-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"传送转盘离港\", \"FLNO\": \"CHA\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From c4023247a6fe4e1d0066fd5eba9093e8055dc644 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Tue, 13 Nov 2018 17:50:05 +0800 Subject: [PATCH 06/34] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=A1=8C=E6=9D=8E?= =?UTF-8?q?=E8=BD=AC=E7=9B=98=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../carousel/carousel.component.html | 69 ++- .../carousel/carousel.component.scss | 63 +++ .../basic-data/carousel/carousel.component.ts | 457 +++++++++++++++++- src/assets/mock-data/carousel-code.json | 22 + src/assets/mock-data/carousel-data.json | 171 +++++++ 5 files changed, 776 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/carousel-code.json create mode 100644 src/assets/mock-data/carousel-data.json diff --git a/src/app/pages/basic-data/carousel/carousel.component.html b/src/app/pages/basic-data/carousel/carousel.component.html index 81732b0..b887ea1 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.html +++ b/src/app/pages/basic-data/carousel/carousel.component.html @@ -1,3 +1,66 @@ -

- carousel works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/carousel/carousel.component.scss b/src/app/pages/basic-data/carousel/carousel.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.scss +++ b/src/app/pages/basic-data/carousel/carousel.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } diff --git a/src/app/pages/basic-data/carousel/carousel.component.ts b/src/app/pages/basic-data/carousel/carousel.component.ts index c05dba6..4c329b7 100644 --- a/src/app/pages/basic-data/carousel/carousel.component.ts +++ b/src/app/pages/basic-data/carousel/carousel.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-carousel', templateUrl: './carousel.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class CarouselComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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.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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/carousel-code.json b/src/assets/mock-data/carousel-code.json new file mode 100644 index 0000000..fc33774 --- /dev/null +++ b/src/assets/mock-data/carousel-code.json @@ -0,0 +1,22 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"行李转盘代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"行李转盘名称", + "COL_ORDER":"2" + }, + { + "COL_CODE":"HZ", + "COL_CN":"航站楼区域", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"资源状态", + "COL_ORDER":"4" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/carousel-data.json b/src/assets/mock-data/carousel-data.json new file mode 100644 index 0000000..b772104 --- /dev/null +++ b/src/assets/mock-data/carousel-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"1\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号行李转盘\", \"FLNO\": \"2\", \"HZ\": \"2号楼国内区\", \"ZY\": \"可用\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 07ad8feb08718c57305c4859ebffe089748f0ea8 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 14 Nov 2018 14:47:28 +0800 Subject: [PATCH 07/34] =?UTF-8?q?=E5=AF=BC=E5=85=A5=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=8F=8C=E5=90=91=E7=BB=91=E5=AE=9A=20FormsModule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/basic-data/basic-data.module.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/pages/basic-data/basic-data.module.ts b/src/app/pages/basic-data/basic-data.module.ts index 8e96bb1..f18b95f 100644 --- a/src/app/pages/basic-data/basic-data.module.ts +++ b/src/app/pages/basic-data/basic-data.module.ts @@ -15,11 +15,12 @@ import { AircraftTypeComponent } from './aircraft-type/aircraft-type.component'; import { AircraftComponent } from './aircraft/aircraft.component'; import { TerminalAreaComponent } from './terminal-area/terminal-area.component'; import { AirlineComponent } from './airline/airline.component'; - +import { FormsModule } from '@angular/forms'; @NgModule({ imports: [ CommonModule, - BasicDataRouting + BasicDataRouting, + FormsModule ], declarations: [ BasicDataComponent, From 29582f83ab37584117aab0a2b20958fbac4304a0 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 14 Nov 2018 15:13:08 +0800 Subject: [PATCH 08/34] =?UTF-8?q?=E6=9C=BA=E4=BD=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-data/stand/stand.component.html | 80 ++- .../basic-data/stand/stand.component.scss | 63 +++ .../pages/basic-data/stand/stand.component.ts | 457 +++++++++++++++++- src/assets/mock-data/stand-code.json | 27 ++ src/assets/mock-data/stand-data.json | 171 +++++++ 5 files changed, 792 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/stand-code.json create mode 100644 src/assets/mock-data/stand-data.json diff --git a/src/app/pages/basic-data/stand/stand.component.html b/src/app/pages/basic-data/stand/stand.component.html index 087e2fc..8500ccf 100644 --- a/src/app/pages/basic-data/stand/stand.component.html +++ b/src/app/pages/basic-data/stand/stand.component.html @@ -1,3 +1,77 @@ -

- stand works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/stand/stand.component.scss b/src/app/pages/basic-data/stand/stand.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/stand/stand.component.scss +++ b/src/app/pages/basic-data/stand/stand.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } diff --git a/src/app/pages/basic-data/stand/stand.component.ts b/src/app/pages/basic-data/stand/stand.component.ts index d845110..dd05497 100644 --- a/src/app/pages/basic-data/stand/stand.component.ts +++ b/src/app/pages/basic-data/stand/stand.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-stand', templateUrl: './stand.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class StandComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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.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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/stand-code.json b/src/assets/mock-data/stand-code.json new file mode 100644 index 0000000..c72a96e --- /dev/null +++ b/src/assets/mock-data/stand-code.json @@ -0,0 +1,27 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"机位代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"机位名称", + "COL_ORDER":"2" + }, + { + "COL_CODE":"HZ", + "COL_CN":"机位类型", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZYZT", + "COL_CN":"资源状态", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"航站楼区域", + "COL_ORDER":"4" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/stand-data.json b/src/assets/mock-data/stand-data.json new file mode 100644 index 0000000..780f19e --- /dev/null +++ b/src/assets/mock-data/stand-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"02\", \"FLNO\": \"01\", \"HZ\": \"远机位\", \"ZYZT\": \"可用\", \"ZY\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 0ce6232bfae88d3b1588537b6034859b7f438536 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 14 Nov 2018 15:16:09 +0800 Subject: [PATCH 09/34] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=80=BC=E6=9C=BA?= =?UTF-8?q?=E6=9F=9C=E5=8F=B0=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkin-desk/checkin-desk.component.html | 79 ++- .../checkin-desk/checkin-desk.component.scss | 63 +++ .../checkin-desk/checkin-desk.component.ts | 457 +++++++++++++++++- src/assets/mock-data/checkindesk-code.json | 27 ++ src/assets/mock-data/checkindesk-data.json | 171 +++++++ 5 files changed, 791 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/checkindesk-code.json create mode 100644 src/assets/mock-data/checkindesk-data.json 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 0da91c3..bc81a7d 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 @@ -1,3 +1,76 @@ -

- checkin-desk works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file 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 e69de29..cf17098 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 @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } 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 7a74715..35b9d17 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,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-checkin-desk', templateUrl: './checkin-desk.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class CheckinDeskComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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.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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/checkindesk-code.json b/src/assets/mock-data/checkindesk-code.json new file mode 100644 index 0000000..0440d41 --- /dev/null +++ b/src/assets/mock-data/checkindesk-code.json @@ -0,0 +1,27 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"值机柜台代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"值机柜台名称", + "COL_ORDER":"2" + }, + { + "COL_CODE":"JJ", + "COL_CN":"值机岛", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"行李传送带", + "COL_ORDER":"4" + }, + { + "COL_CODE":"HZ", + "COL_CN":"航站楼区域", + "COL_ORDER":"5" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/checkindesk-data.json b/src/assets/mock-data/checkindesk-data.json new file mode 100644 index 0000000..cef8360 --- /dev/null +++ b/src/assets/mock-data/checkindesk-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{ \"FLNO\": \"A01\",\"ALCD\": \"A01\", \"JJ\": \"A岛\",\"ZY\": \"行李转盘离港\",\"HZ\": \"2号楼国内区\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 3a898d394727c2c6ef2cc4b98793736ab084f15f Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 14 Nov 2018 15:18:13 +0800 Subject: [PATCH 10/34] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=BA=E5=9C=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-data/airport/airport.component.html | 72 ++- .../basic-data/airport/airport.component.scss | 63 +++ .../basic-data/airport/airport.component.ts | 457 +++++++++++++++++- src/assets/mock-data/airport-code.json | 52 ++ src/assets/mock-data/airport-data.json | 171 +++++++ 5 files changed, 809 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/airport-code.json create mode 100644 src/assets/mock-data/airport-data.json diff --git a/src/app/pages/basic-data/airport/airport.component.html b/src/app/pages/basic-data/airport/airport.component.html index 06b1f14..7d32320 100644 --- a/src/app/pages/basic-data/airport/airport.component.html +++ b/src/app/pages/basic-data/airport/airport.component.html @@ -1,3 +1,69 @@ -

- airport works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/airport/airport.component.scss b/src/app/pages/basic-data/airport/airport.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/airport/airport.component.scss +++ b/src/app/pages/basic-data/airport/airport.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } diff --git a/src/app/pages/basic-data/airport/airport.component.ts b/src/app/pages/basic-data/airport/airport.component.ts index 9f1f2a1..c6d1dd6 100644 --- a/src/app/pages/basic-data/airport/airport.component.ts +++ b/src/app/pages/basic-data/airport/airport.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-airport', templateUrl: './airport.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class AirportComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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.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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/airport-code.json b/src/assets/mock-data/airport-code.json new file mode 100644 index 0000000..970ff97 --- /dev/null +++ b/src/assets/mock-data/airport-code.json @@ -0,0 +1,52 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"机场代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"机场中文名", + "COL_ORDER":"2" + }, + { + "COL_CODE":"HZ", + "COL_CN":"中文简称", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"机场英文名", + "COL_ORDER":"4" + }, + { + "COL_CODE":"YW", + "COL_CN":"英文简称", + "COL_ORDER":"5" + }, + { + "COL_CODE":"IATA", + "COL_CN":"IATA码", + "COL_ORDER":"6" + }, + { + "COL_CODE":"CAA", + "COL_CN":"CAA码", + "COL_ORDER":"7" + }, + { + "COL_CODE":"ICAO", + "COL_CN":"ICAO码", + "COL_ORDER":"8" + }, + { + "COL_CODE":"JT", + "COL_CN":"机场集团", + "COL_ORDER":"9" + }, + { + "COL_CODE":"CS", + "COL_CN":"所在城市", + "COL_ORDER":"10" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/airport-data.json b/src/assets/mock-data/airport-data.json new file mode 100644 index 0000000..ee980be --- /dev/null +++ b/src/assets/mock-data/airport-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"广州\", \"FLNO\": \"HAV\", \"HZ\": \"广州\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\", \"CS\": \"广州\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 11e8eca16caf5dcfa416b2c7fddf879ea72c3626 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 14 Nov 2018 15:33:14 +0800 Subject: [PATCH 11/34] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/basic-data/city/city.component.html | 84 +++- .../pages/basic-data/city/city.component.scss | 79 +++ .../pages/basic-data/city/city.component.ts | 457 +++++++++++++++++- src/assets/mock-data/city-code.json | 22 + src/assets/mock-data/city-data.json | 171 +++++++ 5 files changed, 807 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/city-code.json create mode 100644 src/assets/mock-data/city-data.json diff --git a/src/app/pages/basic-data/city/city.component.html b/src/app/pages/basic-data/city/city.component.html index 703b87b..63c4ce9 100644 --- a/src/app/pages/basic-data/city/city.component.html +++ b/src/app/pages/basic-data/city/city.component.html @@ -1,3 +1,81 @@ -

- city works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/city/city.component.scss b/src/app/pages/basic-data/city/city.component.scss index e69de29..fb75750 100644 --- a/src/app/pages/basic-data/city/city.component.scss +++ b/src/app/pages/basic-data/city/city.component.scss @@ -0,0 +1,79 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } + +.divFieldseTitle{ + position: relative; + display: inline; + left: 10px; + top: 11px; + white-space: nowrap; + text-align: center; + background-color: #fff; + font-weight: bold; +} +.checkInfo{ + position: relative; + top: 5px; + left: 15px; +} \ No newline at end of file diff --git a/src/app/pages/basic-data/city/city.component.ts b/src/app/pages/basic-data/city/city.component.ts index 6ac5e1d..3e0ad72 100644 --- a/src/app/pages/basic-data/city/city.component.ts +++ b/src/app/pages/basic-data/city/city.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-city', templateUrl: './city.component.html', @@ -7,9 +9,458 @@ import { Component, OnInit } from '@angular/core'; }) export class CityComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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 filterItems = { + SEARCH: '', //手动输入条件 + FLT_POS: 1, //过滤还是定位 + /* ALCD: '', //航空公司 + FLIN: '', //航线类别 + FLTY: '', //航班类别 + MVIN: '', //到达/出发 + TRML: '', //航站楼 + FHAG: '', //机坪代理 + MHAG: '', //维护代理 + PHAG: '', //旅客代理 */ +} + +public formatter = { + 'MVIN': { + 'A': '到达', + 'D': '出发', + 'DF': '其他' + }, + 'FLIN': { + 'D': '国内', + 'I': '国际', + 'M': '混合', + 'R': '地区', + 'DF': '其他' + }, + 'SODT': dateFormatter, + 'ESTT': dateFormatter, + 'ACTT': dateFormatter +} + + +selectRow($event, i) { + this.row_state = i; + alert(i) +} + +getColor(col_CODE) { + if (col_CODE === 'SODT') { + return 'skyblue' + } else { + return null + } +} + +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] = 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] = 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]; + 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.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.render_data = this.combined_data + + this.changeDetectorRef.detectChanges(); + } + ) +} + +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 + */ + +fliter(filterItems, render_data) { + if(filterItems.FLT_POS===1){ + //过滤 + }else{ + //定位 + } +} +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/city-code.json b/src/assets/mock-data/city-code.json new file mode 100644 index 0000000..5dcc0cc --- /dev/null +++ b/src/assets/mock-data/city-code.json @@ -0,0 +1,22 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"城市代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"城市中文名", + "COL_ORDER":"2" + }, + { + "COL_CODE":"HZ", + "COL_CN":"城市英文名", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"所在国家", + "COL_ORDER":"4" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/city-data.json b/src/assets/mock-data/city-data.json new file mode 100644 index 0000000..0a2df63 --- /dev/null +++ b/src/assets/mock-data/city-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"开罗\", \"FLNO\": \"YYJ\", \"HZ\": \"ICAJI\", \"ZY\": \"埃及\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 7c618961468278c10c2daf0ff449616b778506bb Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Wed, 14 Nov 2018 15:38:07 +0800 Subject: [PATCH 12/34] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=8C=E5=90=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=91=E5=AE=9A@NgModule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkin-group/checkin-group.component.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 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 4b52672..d617e05 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 @@ -7,14 +7,14 @@ - - + + 过滤 + + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+ + \ No newline at end of file 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 e69de29..cf17098 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 @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } 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 55d70b3..8719cfe 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,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-aircraft-type', templateUrl: './aircraft-type.component.html', @@ -7,9 +9,549 @@ import { Component, OnInit } from '@angular/core'; }) export class AircraftTypeComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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; + +// 搜索条件 +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 + } +} + +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.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.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(); + } + ) +} + +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; + 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)) + } + }else{ + if(!this.SEARCH){ + filter_data.push(Object.assign({}, item)) + } + } + }) + }else{ + combined_data.forEach(item => { + 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)) + break; + } + } else { + continue; + } + } + } + }) + } + + //下拉框筛选 + 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.changeDetectorRef.detectChanges(); +} + +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/aircraft-type-code.json b/src/assets/mock-data/aircraft-type-code.json new file mode 100644 index 0000000..86164c2 --- /dev/null +++ b/src/assets/mock-data/aircraft-type-code.json @@ -0,0 +1,42 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"飞机号", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"最大乘客数", + "COL_ORDER":"2" + }, + { + "COL_CODE":"HZ", + "COL_CN":"最大货物重量", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"最大起飞重量", + "COL_ORDER":"4" + }, + { + "COL_CODE":"LQ", + "COL_CN":"最大廊桥数", + "COL_ORDER":"5" + }, + { + "COL_CODE":"ZJ", + "COL_CN":"机主航空公司", + "COL_ORDER":"6" + }, + { + "COL_CODE":"HK", + "COL_CN":"航空公司", + "COL_ORDER":"7" + }, + { + "COL_CODE":"JX", + "COL_CN":"机型", + "COL_ORDER":"8" + } +] \ 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 new file mode 100644 index 0000000..9225d48 --- /dev/null +++ b/src/assets/mock-data/aircraft-type-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"415\", \"FLNO\": \"B6532\", \"HZ\": \"926999.0\", \"ZY\": \"9999.0\", \"LQ\": \"2\", \"ZJ\": \"海南航空公司\", \"HK\": \"海南航空公司\", \"JX\": \"B8888\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 37d2bc027b15bfcab61a67e2799a9fd5412550d1 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Thu, 15 Nov 2018 09:06:56 +0800 Subject: [PATCH 23/34] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A3=9E=E6=9C=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aircraft/aircraft.component.html | 63 +- .../aircraft/aircraft.component.scss | 63 ++ .../basic-data/aircraft/aircraft.component.ts | 552 +++++++++++++++++- src/assets/mock-data/aircraft-code.json | 67 +++ src/assets/mock-data/aircraft-data.json | 171 ++++++ 5 files changed, 909 insertions(+), 7 deletions(-) create mode 100644 src/assets/mock-data/aircraft-code.json create mode 100644 src/assets/mock-data/aircraft-data.json diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.html b/src/app/pages/basic-data/aircraft/aircraft.component.html index ce30cef..84b5898 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.html +++ b/src/app/pages/basic-data/aircraft/aircraft.component.html @@ -1,3 +1,60 @@ -

- aircraft works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.scss b/src/app/pages/basic-data/aircraft/aircraft.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.scss +++ b/src/app/pages/basic-data/aircraft/aircraft.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } diff --git a/src/app/pages/basic-data/aircraft/aircraft.component.ts b/src/app/pages/basic-data/aircraft/aircraft.component.ts index f100e5d..c3e2e1f 100644 --- a/src/app/pages/basic-data/aircraft/aircraft.component.ts +++ b/src/app/pages/basic-data/aircraft/aircraft.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-aircraft', templateUrl: './aircraft.component.html', @@ -7,9 +9,551 @@ import { Component, OnInit } from '@angular/core'; }) export class AircraftComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } + +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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; + +// 搜索条件 +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 + } +} + +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.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.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(); + } + ) +} + +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 +} + +inputFliter() { + let filterItems = this.filterItems; + let combined_data = this.combined_data; + 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)) + } + }else{ + if(!this.SEARCH){ + filter_data.push(Object.assign({}, item)) + } + } + }) + }else{ + combined_data.forEach(item => { + 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)) + break; + } + } else { + continue; + } + } + } + }) + } + + //下拉框筛选 + 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.changeDetectorRef.detectChanges(); +} + + +/** + * 获取航班实际时间 + * @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; + } + } - ngOnInit() { - } } diff --git a/src/assets/mock-data/aircraft-code.json b/src/assets/mock-data/aircraft-code.json new file mode 100644 index 0000000..fb4f699 --- /dev/null +++ b/src/assets/mock-data/aircraft-code.json @@ -0,0 +1,67 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"机型代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"机型名称", + "COL_ORDER":"2" + }, + { + "COL_CODE":"HZ", + "COL_CN":"飞机长度", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"翼展", + "COL_ORDER":"4" + }, + { + "COL_CODE":"LQ", + "COL_CN":"机身高度", + "COL_ORDER":"5" + }, + { + "COL_CODE":"ZJ", + "COL_CN":"最大乘客数", + "COL_ORDER":"6" + }, + { + "COL_CODE":"HK", + "COL_CN":"最大货物重量", + "COL_ORDER":"7" + }, + { + "COL_CODE":"JX", + "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 new file mode 100644 index 0000000..1ec8cd2 --- /dev/null +++ b/src/assets/mock-data/aircraft-data.json @@ -0,0 +1,171 @@ +[ + { + "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\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "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\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From b5509d4f546b779cbcbe8b1e75818c903f891abb Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Thu, 15 Nov 2018 09:08:48 +0800 Subject: [PATCH 24/34] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=88=AA=E7=AB=99?= =?UTF-8?q?=E6=A5=BC=E5=8C=BA=E5=9F=9F=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terminal-area.component.html | 50 +- .../terminal-area.component.scss | 63 ++ .../terminal-area/terminal-area.component.ts | 548 +++++++++++++++++- src/assets/mock-data/terminal-area-code.json | 12 + src/assets/mock-data/terminal-area-data.json | 171 ++++++ 5 files changed, 838 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/terminal-area-code.json create mode 100644 src/assets/mock-data/terminal-area-data.json 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 4765730..7bd5a54 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 @@ -1,3 +1,47 @@ -

- terminal-area works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file 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 e69de29..cf17098 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 @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } 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 49da09b..db86f50 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,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-terminal-area', templateUrl: './terminal-area.component.html', @@ -7,9 +9,549 @@ import { Component, OnInit } from '@angular/core'; }) export class TerminalAreaComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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; + +// 搜索条件 +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 + } +} + +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.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.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(); + } + ) +} + +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; + 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)) + } + }else{ + if(!this.SEARCH){ + filter_data.push(Object.assign({}, item)) + } + } + }) + }else{ + combined_data.forEach(item => { + 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)) + break; + } + } else { + continue; + } + } + } + }) + } + + //下拉框筛选 + 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.changeDetectorRef.detectChanges(); +} + +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/terminal-area-code.json b/src/assets/mock-data/terminal-area-code.json new file mode 100644 index 0000000..3444421 --- /dev/null +++ b/src/assets/mock-data/terminal-area-code.json @@ -0,0 +1,12 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"航站楼区域代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"航站楼区域名称", + "COL_ORDER":"2" + } +] \ No newline at end of file diff --git a/src/assets/mock-data/terminal-area-data.json b/src/assets/mock-data/terminal-area-data.json new file mode 100644 index 0000000..e82d2fb --- /dev/null +++ b/src/assets/mock-data/terminal-area-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"一号登机口\", \"FLNO\": \"VIP\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file From 31cf7e444e0bbb8e04ae38ab757202c546aa6c9a Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Thu, 15 Nov 2018 09:10:08 +0800 Subject: [PATCH 25/34] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=88=AA=E7=A9=BA?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-data/airline/airline.component.html | 73 ++- .../basic-data/airline/airline.component.scss | 63 ++ .../basic-data/airline/airline.component.ts | 549 +++++++++++++++++- src/assets/mock-data/airline-code-data.json | 171 ++++++ src/assets/mock-data/airline-code.json | 47 ++ 5 files changed, 897 insertions(+), 6 deletions(-) create mode 100644 src/assets/mock-data/airline-code-data.json create mode 100644 src/assets/mock-data/airline-code.json diff --git a/src/app/pages/basic-data/airline/airline.component.html b/src/app/pages/basic-data/airline/airline.component.html index 59a58d7..cb03a25 100644 --- a/src/app/pages/basic-data/airline/airline.component.html +++ b/src/app/pages/basic-data/airline/airline.component.html @@ -1,3 +1,70 @@ -

- airline works! -

+
+
+
+
+
+ + + + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+
+ +
+
+ + + + + + + + + + + + + +
序号{{airline_col.COL_CN}}
{{i+1}}{{airline_row['renderFlight'][airline_col.COL_CODE]}}
+
+
+
+
\ No newline at end of file diff --git a/src/app/pages/basic-data/airline/airline.component.scss b/src/app/pages/basic-data/airline/airline.component.scss index e69de29..cf17098 100644 --- a/src/app/pages/basic-data/airline/airline.component.scss +++ b/src/app/pages/basic-data/airline/airline.component.scss @@ -0,0 +1,63 @@ +.main-page { + width: 100%; + height: calc(100% - 66px); + padding: 15px 10px; + background-color: #fff; + .page-content { + border: 1px solid #ccc; + padding: 10px 20px; + .search-filter { + padding: 0 15px; + .first-condition { + .line-operator-right { + text-align: right; + padding: 0; + .btn-info { + background-color: rgb(122, 156, 204); + border-color: rgb(122, 156, 204); + } + } + } + .input-container { + padding: 0; + > .form-control { + width: 180px; + display: inline-block; + } + } + } + .airline-table{ + .table-container{ + // border: 1px solid #ccc; + width: 100%; + height: 700px; + overflow: scroll; + table{ + width: max-content; + tr{ + cursor: pointer; + &.active{ + background: rgb(181, 215, 255); + } + } + th,td{ + // border: none; + text-align: center; + } + } + } + } + } +} + +@media screen and (max-width: 991px) { + .line-operator-right { + text-align: left !important; + } +} + +// @media screen and (min-width: 1200px){ +// .line-operator-right{ +// text-align: left; +// } +// } diff --git a/src/app/pages/basic-data/airline/airline.component.ts b/src/app/pages/basic-data/airline/airline.component.ts index 868a191..2f80add 100644 --- a/src/app/pages/basic-data/airline/airline.component.ts +++ b/src/app/pages/basic-data/airline/airline.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; - +import { ChangeDetectorRef } from '@angular/core'; +import { HttpClientService } from '../../../services/http-client.service'; +import dateFormatter from '../../../utils/data-formatter'; @Component({ selector: 'app-airline', templateUrl: './airline.component.html', @@ -7,9 +9,550 @@ import { Component, OnInit } from '@angular/core'; }) export class AirlineComponent implements OnInit { - constructor() { } + constructor( + private httpCilent: HttpClientService, + private changeDetectorRef: ChangeDetectorRef +) { } - ngOnInit() { +public raw_data: Array = []; //原始数据,即航班计划 + +public combined_data: Array = []; //组合数据,即链接航班,显示信息等组合好之后的数据 + +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; + +// 搜索条件 +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 + } +} + +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.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(); + } + ) +} + +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; + 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)) + } + }else{ + if(!this.SEARCH){ + filter_data.push(Object.assign({}, item)) + } + } + }) + }else{ + combined_data.forEach(item => { + 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)) + break; + } + } else { + continue; + } + } + } + }) + } + + //下拉框筛选 + 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.changeDetectorRef.detectChanges(); +} + +/** + * 获取航班实际时间 + * @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; + } + } + + } diff --git a/src/assets/mock-data/airline-code-data.json b/src/assets/mock-data/airline-code-data.json new file mode 100644 index 0000000..acacc9d --- /dev/null +++ b/src/assets/mock-data/airline-code-data.json @@ -0,0 +1,171 @@ +[ + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1988, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083618" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + }, + { + "topic": "schd", + "value": "{\"ALCD\": \"香港华明航空公司\", \"FLNO\": \"LD\", \"HZ\": \"香港华明\", \"ZY\": \"GZ\", \"YW\": \"GZ\", \"IATA\": \"IATA\", \"CAA\": \"CAA\",\"ICAO\": \"ICAO\",\"JT\": \"机场集团\"}", + "offset": 1989, + "partition": 0, + "highWaterOffset": 3975, + "key": "11083248" + } + +] \ No newline at end of file diff --git a/src/assets/mock-data/airline-code.json b/src/assets/mock-data/airline-code.json new file mode 100644 index 0000000..657ec81 --- /dev/null +++ b/src/assets/mock-data/airline-code.json @@ -0,0 +1,47 @@ +[ + { + "COL_CODE":"FLNO", + "COL_CN":"航空公司代码", + "COL_ORDER":"1" + }, + { + "COL_CODE":"ALCD", + "COL_CN":"航空公司中文名", + "COL_ORDER":"2" + }, + { + "COL_CODE":"HZ", + "COL_CN":"中文简称", + "COL_ORDER":"3" + }, + { + "COL_CODE":"ZY", + "COL_CN":"航空公司英文名", + "COL_ORDER":"4" + }, + { + "COL_CODE":"YW", + "COL_CN":"英文简称", + "COL_ORDER":"5" + }, + { + "COL_CODE":"IATA", + "COL_CN":"IATA码", + "COL_ORDER":"6" + }, + { + "COL_CODE":"CAA", + "COL_CN":"CAA码", + "COL_ORDER":"7" + }, + { + "COL_CODE":"ICAO", + "COL_CN":"ICAO码", + "COL_ORDER":"8" + }, + { + "COL_CODE":"JT", + "COL_CN":"上级母公司", + "COL_ORDER":"9" + } +] \ No newline at end of file From 4284e07b40afb57ef9cb204c23250b7040b1bd23 Mon Sep 17 00:00:00 2001 From: "714943302@qq.com" Date: Thu, 15 Nov 2018 14:18:43 +0800 Subject: [PATCH 26/34] =?UTF-8?q?=E5=9F=8E=E5=B8=82=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E5=8F=8A=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/city/city.component.html | 26 +-- .../pages/basic-data/city/city.component.ts | 180 +++++++++++++----- 2 files changed, 149 insertions(+), 57 deletions(-) diff --git a/src/app/pages/basic-data/city/city.component.html b/src/app/pages/basic-data/city/city.component.html index 63c4ce9..a8412a2 100644 --- a/src/app/pages/basic-data/city/city.component.html +++ b/src/app/pages/basic-data/city/city.component.html @@ -3,18 +3,18 @@
- - - - + + + +