Merge branch 'develop-3'
This commit is contained in:
@@ -1,3 +1,68 @@
|
||||
<p>
|
||||
aircraft-type works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">打印</button>
|
||||
<button type="button" class="btn btn-info mr-3">飞机登记</button>
|
||||
<button type="button" class="btn btn-info mr-3">定制查询</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航空公司: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.HK" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="GH">海南航空公司</option>
|
||||
<option value="CH">国外航空公司</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">机型: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.JX" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="A">A306</option>
|
||||
<option value="B">B252</option>
|
||||
<option value="C">C256</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of aircrafttype_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of aircrafttype_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,559 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class AircraftTypeComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public aircrafttype_lists: Array<object>; //列数据
|
||||
|
||||
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 = {
|
||||
HK: '', //航空公司
|
||||
JX: '', //机型
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'HK': {
|
||||
'GH': '海南航空公司',
|
||||
'CH': '国外航空公司'
|
||||
},
|
||||
'JX': {
|
||||
'A': 'A306',
|
||||
'B': 'B252',
|
||||
"C": 'C256'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,60 @@
|
||||
<p>
|
||||
aircraft works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">打印</button>
|
||||
<button type="button" class="btn btn-info mr-3">飞机登记</button>
|
||||
<button type="button" class="btn btn-info mr-3">定制查询</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">机型组: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.ZZU" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="E">E-类飞机机型</option>
|
||||
<option value="T">T-类飞机机型</option>
|
||||
<option value="G">G-类飞机机型</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of aircraft_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of aircraft_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,555 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class AircraftComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public aircraft_lists: Array<object>; //列数据
|
||||
|
||||
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 = {
|
||||
ZZU: '', //机型组
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'ZZU': {
|
||||
'E': 'E-类飞机机型',
|
||||
'T': 'T-类飞机机型',
|
||||
'G': 'G-类飞机机型'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,70 @@
|
||||
<p>
|
||||
airline works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">打印</button>
|
||||
<button type="button" class="btn btn-info mr-3">航空公司登记</button>
|
||||
<button type="button" class="btn btn-info mr-3">航空集团登记</button>
|
||||
<button type="button" class="btn btn-info mr-3">航空代理登记</button>
|
||||
<button type="button" class="btn btn-info mr-3">定制查询</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航空集团: </label>
|
||||
<select class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="GH">国内航空集团</option>
|
||||
<option value="CH">国外航空集团</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">航班代理: </label>
|
||||
<select class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="0">广州</option>
|
||||
<option value="1">上海</option>
|
||||
<option value="2">北京</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of airline_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of airline_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public airline_lists: Array<object>; //列数据
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,69 @@
|
||||
<p>
|
||||
airport works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">打印</button>
|
||||
<button type="button" class="btn btn-info mr-3">机场管理</button>
|
||||
<button type="button" class="btn btn-info mr-3">机场集团管理</button>
|
||||
<button type="button" class="btn btn-info mr-3">定制查询</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">机场集团: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.JT" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="GH">国内机场</option>
|
||||
<option value="CH">国际机场</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">城市: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.CS" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="GZ">广州</option>
|
||||
<option value="SH">上海</option>
|
||||
<option value="BJ">北京</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of airport_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of airport_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,558 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class AirportComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public airport_lists: Array<object>; //列数据
|
||||
|
||||
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 = {
|
||||
JT: '', //机场集团
|
||||
CS: '', //所在城市
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'JT': {
|
||||
'GH': '国内区域',
|
||||
'CH': '国际区域'
|
||||
},
|
||||
'CS': {
|
||||
'GZ': '广州',
|
||||
'SH': '上海',
|
||||
"BJ": '北京'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
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] = (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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,3 +1,67 @@
|
||||
<p>
|
||||
carousel works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">行李转盘编辑</button>
|
||||
<button type="button" class="btn btn-info mr-3">打印</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">所属航站楼区域: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.HZ" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="GH">国内区域</option>
|
||||
<option value="CH">国际区域</option>
|
||||
<option value="QT">其他区域</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">资源状态: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.ZY" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="K">可用</option>
|
||||
<option value="R">不可用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of carousel_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of carousel_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,560 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class CarouselComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public carousel_lists: Array<object>; //列数据
|
||||
|
||||
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 = {
|
||||
HZ: '', //所属航站楼区域
|
||||
ZY: '', //资源状态
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'HZ': {
|
||||
'GH': '国内区域',
|
||||
'CH': '国际区域',
|
||||
"QT": '其他区域'
|
||||
},
|
||||
'ZY': {
|
||||
'K': '可用',
|
||||
'R': '不可用',
|
||||
"T": '其他'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
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] = (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)
|
||||
// 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
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,77 @@
|
||||
<p>
|
||||
checkin-desk works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">值机柜台编辑</button>
|
||||
<button type="button" class="btn btn-info mr-3">打印</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">所属航站楼区域: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.HZ" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="GH">国内区域</option>
|
||||
<option value="CH">国外区域</option>
|
||||
<option value="QH">其他区域</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">值机岛: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.JJ" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="A">A岛</option>
|
||||
<option value="B">B岛</option>
|
||||
<option value="C">C岛</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">行李传送带: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.ZY" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="X">X行李</option>
|
||||
<option value="Z">Z行李</option>
|
||||
<option value="Y">Y行李</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of checkindesk_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of checkindesk_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,566 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class CheckinDeskComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public checkindesk_lists: Array<object>; //列数据
|
||||
|
||||
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 = {
|
||||
HZ: '', //所属航站楼区域
|
||||
JJ: '', //值机岛
|
||||
ZY: '', //行李传送带
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'HZ': {
|
||||
'GH': '国内区域',
|
||||
'CH': '国际区域',
|
||||
"QH": '其他区域'
|
||||
},
|
||||
'JJ': {
|
||||
'A': 'A岛',
|
||||
'B': 'B岛',
|
||||
"C": 'C岛'
|
||||
},
|
||||
'ZY': {
|
||||
'X': 'X行李',
|
||||
'Z': 'Z行李',
|
||||
"Y": 'Y行李'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
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] = (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)
|
||||
// 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
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,47 @@
|
||||
<p>
|
||||
checkin-group works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">值机岛编辑</button>
|
||||
<button type="button" class="btn btn-info mr-3">打印</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of col_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of col_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,550 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class CheckinGroupComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public col_lists: Array<object>; //列数据
|
||||
|
||||
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/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] = (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)
|
||||
// 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
|
||||
}
|
||||
|
||||
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() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,47 @@
|
||||
<p>
|
||||
chut works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">行李传送带编辑</button>
|
||||
<button type="button" class="btn btn-info mr-3">打印</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of chut_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of chut_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,549 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class ChutComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public chut_lists: Array<object>; //列数据
|
||||
|
||||
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/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] = (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)
|
||||
// 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
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,81 @@
|
||||
<p>
|
||||
city works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">打印</button>
|
||||
<button type="button" class="btn btn-info mr-3">城市登记</button>
|
||||
<button type="button" class="btn btn-info mr-3">国家登记</button>
|
||||
<button type="button" class="btn btn-info mr-3">洲/地区登记</button>
|
||||
<button type="button" class="btn btn-info mr-3">定制查询</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">洲/地区: </label>
|
||||
<select class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="GH">非洲</option>
|
||||
<option value="CH">亚洲</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">国家: </label>
|
||||
<select class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="0">中国</option>
|
||||
<option value="1">美国</option>
|
||||
<option value="2">英国</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="third-condition row">
|
||||
<label class="radio-inline custom-checkbox nowrap checkInfo mr-4">
|
||||
<input type="checkbox">
|
||||
<span>洲/地区-国家关联</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-checkbox nowrap checkInfo mr-4">
|
||||
<input type="checkbox">
|
||||
<span>国家-城市关联</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<!-- <div id="divFieldset_title" class="divFieldseTitle">城市</div> -->
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of city_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of city_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,550 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class CityComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public city_lists: Array<object>; //列数据
|
||||
|
||||
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/city-code.json').subscribe(
|
||||
data => {
|
||||
data.sort(function (a, b) {
|
||||
return (a['COL_ORDER'] - b['COL_ORDER']);
|
||||
})
|
||||
this.city_lists = data;
|
||||
}
|
||||
)
|
||||
/* 获取城市信息 */
|
||||
this.httpCilent.get('/assets/mock-data/city-data.json').subscribe(
|
||||
data => {
|
||||
//解析数据
|
||||
data.forEach(element => {
|
||||
this.raw_data.push(JSON.parse(element.value));
|
||||
});
|
||||
|
||||
let combined_linked_data = this.raw_data
|
||||
|
||||
combined_linked_data.forEach(element => {
|
||||
let row_flights = {};
|
||||
let render_flight = {};
|
||||
let render_pre_flight = {};
|
||||
let render_rea_flight = {};
|
||||
row_flights['preFlight'] = element;
|
||||
|
||||
for (let i = 0; i < this.city_lists.length; i++) {
|
||||
let key = this.city_lists[i]['COL_CODE']
|
||||
render_flight[key] = typeof (this.formatter[key]) === 'function' ? this.formatter[key](row_flights['preFlight'][key], 1) : this.formatter[key] ? this.formatter[key][row_flights['preFlight'][key]] : row_flights['preFlight'][key];
|
||||
}
|
||||
row_flights['renderFlight'] = render_flight;
|
||||
if (element['isLinked']) {
|
||||
row_flights['preFlight'] = element['linkFlight'];
|
||||
delete element['linkFlight'];
|
||||
delete element['isLinked'];
|
||||
row_flights['reaFlight'] = element;
|
||||
|
||||
for (let i = 0; i < this.city_lists.length; i++) {
|
||||
let key = this.city_lists[i]['COL_CODE']
|
||||
if (this.formatter.hasOwnProperty(key)) {
|
||||
if (typeof (this.formatter[key]) === 'function') {
|
||||
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key](row_flights['preFlight'][key], 1)) : (this.formatter[key](row_flights['preFlight'][key], 1) + '/' + this.formatter[key](row_flights['reaFlight'][key], 1));
|
||||
render_pre_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1);
|
||||
render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1);
|
||||
} else {
|
||||
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key][row_flights['preFlight'][key]]) : (this.formatter[key][row_flights['preFlight'][key]] + '/' + this.formatter[key][row_flights['reaFlight'][key]]);
|
||||
render_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]];
|
||||
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
|
||||
}
|
||||
} else {
|
||||
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (row_flights['preFlight'][key]) : (row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key]);
|
||||
render_pre_flight[key] = row_flights['preFlight'][key];
|
||||
render_rea_flight[key] = row_flights['reaFlight'][key];
|
||||
}
|
||||
}
|
||||
row_flights['renderFlight'] = render_flight;
|
||||
row_flights['renderPreFlight'] = render_pre_flight;
|
||||
row_flights['renderReaFlight'] = render_rea_flight;
|
||||
}
|
||||
this.combined_data.push(row_flights)
|
||||
})
|
||||
|
||||
//排序
|
||||
this.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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,67 @@
|
||||
<p>
|
||||
gate works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">登机门编辑</button>
|
||||
<button type="button" class="btn btn-info mr-3">打印</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">所属航站楼区域: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.HZ" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="GH">国内区域</option>
|
||||
<option value="CH">国际区域</option>
|
||||
<option value="QT">其他区域</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">资源状态: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.ZY" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="K">可用</option>
|
||||
<option value="R">不可用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of gate_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of gate_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,561 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class GateComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public gate_lists: Array<object>; //列数据
|
||||
|
||||
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 = {
|
||||
HZ: '', //所属航站楼区域
|
||||
ZY: '', //资源状态
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'HZ': {
|
||||
'GH': '国内区域',
|
||||
'CH': '国际区域',
|
||||
"QT": '其他区域'
|
||||
},
|
||||
'ZY': {
|
||||
'K': '可用',
|
||||
'R': '不可用',
|
||||
"T": '其他'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
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] = (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)
|
||||
// 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
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,77 @@
|
||||
<p>
|
||||
stand works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">机位编辑</button>
|
||||
<button type="button" class="btn btn-info mr-3">打印</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="second-condition mb-3 row">
|
||||
<div class="input-container mr-4">
|
||||
<label for="">所属航站楼区域: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.ZY" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="GH">国内区域</option>
|
||||
<option value="CH">国际区域</option>
|
||||
<option value="QH">其他区域</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">机位类型: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.HZ" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="YJW">远机位</option>
|
||||
<option value="JJW">近机位</option>
|
||||
<option value="GWJW">过夜机位</option>
|
||||
<option value="ZJW">专机位</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-container mr-4">
|
||||
<label for="">资源状态: </label>
|
||||
<select class="form-control" [(ngModel)]="filterItems.ZYZT" (ngModelChange)="inputFliter()">
|
||||
<option value=""></option>
|
||||
<option value="K">可用</option>
|
||||
<option value="R">不可用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of stand_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of stand_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,567 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class StandComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public stand_lists: Array<object>; //列数据
|
||||
|
||||
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 = {
|
||||
ZY: '', //所属航站楼区域
|
||||
HZ: '', //机位类型
|
||||
ZYZT: '', //资源状态
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'ZY': {
|
||||
'GH': '国内区域',
|
||||
'CH': '国际区域',
|
||||
"QH": '其他区域'
|
||||
},
|
||||
'HZ': {
|
||||
'YJW': '远机位',
|
||||
'JJW': '近机位',
|
||||
"GWJW": '过夜机位',
|
||||
"ZJW": '专机位'
|
||||
},
|
||||
'ZYZT': {
|
||||
'K': '可用',
|
||||
'R': '不可用',
|
||||
"T": '其他'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
if (col_CODE === 'SODT') {
|
||||
return 'skyblue'
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
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] = (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)
|
||||
// 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
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,47 @@
|
||||
<p>
|
||||
terminal-area works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">航站楼区域编辑</button>
|
||||
<button type="button" class="btn btn-info mr-3">打印</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of terminalarea_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of terminalarea_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public terminalarea_lists: Array<object>; //列数据
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,47 @@
|
||||
<p>
|
||||
terminal works!
|
||||
</p>
|
||||
<div class="main-page">
|
||||
<div class="page-content">
|
||||
<div class="search-filter mb-3">
|
||||
<div class="first-condition row">
|
||||
<div class="line-operator-left input-container mb-3 col-xlg-8 col-mlg-8 col-xl-8 col-lg-10">
|
||||
<select class="mr-4 form-control" [(ngModel)]="SEL_COL" name="" id="">
|
||||
<option value="">选择列名</option>
|
||||
</select>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
|
||||
<span>过滤</span>
|
||||
</label>
|
||||
<label class="radio-inline custom-radio nowrap mr-4">
|
||||
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||
<span>查找定位</span>
|
||||
</label>
|
||||
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||
</div>
|
||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
||||
<!-- <button type="button" class="btn btn-info mr-3">航站楼编辑</button>
|
||||
<button type="button" class="btn btn-info mr-3">打印</button> -->
|
||||
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="airline-table">
|
||||
<div class="table-container">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th *ngFor="let airline_col of terminal_lists">{{airline_col.COL_CN}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(i)"
|
||||
[ngClass]="{'active':row_state===i}">
|
||||
<td>{{i+1}}</td>
|
||||
<td *ngFor="let airline_col of terminal_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -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,549 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class TerminalComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||
|
||||
public combined_data: Array<object> = []; //组合数据,即链接航班,显示信息等组合好之后的数据
|
||||
|
||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||
|
||||
public terminal_lists: Array<object>; //列数据
|
||||
|
||||
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-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] = (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)
|
||||
// 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
|
||||
}
|
||||
|
||||
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() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user