航站楼过滤及精确筛选
This commit is contained in:
@@ -3,18 +3,18 @@
|
||||
<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="">
|
||||
<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)]="filterItems.FLT_POS" [value]="1" name="filter-position">
|
||||
<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)]="filterItems.FLT_POS" [value]="2" name="filter-position">
|
||||
</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)]="filterItems.SEARCH" type="text">
|
||||
</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>
|
||||
@@ -34,7 +34,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow($event,i)"
|
||||
<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>
|
||||
|
||||
@@ -40,41 +40,24 @@ public TOP_12 = 12000000000000;
|
||||
public TOP_13 = 13000000000000;
|
||||
public TOP_14 = 14000000000000;
|
||||
|
||||
// 搜索条件
|
||||
SEARCH = ''; //手动输入条件
|
||||
FLT_POS = 1; //过滤还是定位
|
||||
SEL_COL = ''; //选择列名
|
||||
|
||||
public filterItems = {
|
||||
SEARCH: '', //手动输入条件
|
||||
FLT_POS: 1, //过滤还是定位
|
||||
/* ALCD: '', //航空公司
|
||||
FLIN: '', //航线类别
|
||||
FLTY: '', //航班类别
|
||||
MVIN: '', //到达/出发
|
||||
TRML: '', //航站楼
|
||||
FHAG: '', //机坪代理
|
||||
MHAG: '', //维护代理
|
||||
PHAG: '', //旅客代理 */
|
||||
|
||||
}
|
||||
|
||||
public formatter = {
|
||||
'MVIN': {
|
||||
'A': '到达',
|
||||
'D': '出发',
|
||||
'DF': '其他'
|
||||
},
|
||||
'FLIN': {
|
||||
'D': '国内',
|
||||
'I': '国际',
|
||||
'M': '混合',
|
||||
'R': '地区',
|
||||
'DF': '其他'
|
||||
},
|
||||
'SODT': dateFormatter,
|
||||
'ESTT': dateFormatter,
|
||||
'ACTT': dateFormatter
|
||||
}
|
||||
|
||||
|
||||
selectRow($event, i) {
|
||||
selectRow(i) {
|
||||
this.row_state = i;
|
||||
alert(i)
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
getColor(col_CODE) {
|
||||
@@ -127,16 +110,16 @@ ngOnInit() {
|
||||
let key = this.terminal_lists[i]['COL_CODE']
|
||||
if (this.formatter.hasOwnProperty(key)) {
|
||||
if (typeof (this.formatter[key]) === 'function') {
|
||||
render_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1) + '/' + this.formatter[key](row_flights['reaFlight'][key], 1);
|
||||
render_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] = this.formatter[key][row_flights['preFlight'][key]] + '/' + this.formatter[key][row_flights['reaFlight'][key]];
|
||||
render_flight[key] = (row_flights['preFlight'][key] === row_flights['reaFlight'][key]) ? (this.formatter[key][row_flights['preFlight'][key]]) : (this.formatter[key][row_flights['preFlight'][key]] + '/' + this.formatter[key][row_flights['reaFlight'][key]]);
|
||||
render_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]];
|
||||
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
|
||||
}
|
||||
} else {
|
||||
render_flight[key] = row_flights['preFlight'][key] + '/' + row_flights['reaFlight'][key];
|
||||
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];
|
||||
}
|
||||
@@ -247,19 +230,127 @@ public sequence(flight) {
|
||||
return this.TOP_14
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤机定位
|
||||
* @param filterItems
|
||||
* @return
|
||||
*/
|
||||
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 { //定位
|
||||
|
||||
fliter(filterItems, render_data) {
|
||||
if(filterItems.FLT_POS===1){
|
||||
//过滤
|
||||
}else{
|
||||
//定位
|
||||
}
|
||||
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取航班实际时间
|
||||
* @param flight
|
||||
|
||||
Reference in New Issue
Block a user