航班过滤及精确筛选
This commit is contained in:
@@ -7,14 +7,14 @@
|
|||||||
<option value="">选择列名</option>
|
<option value="">选择列名</option>
|
||||||
</select>
|
</select>
|
||||||
<label class="radio-inline custom-radio nowrap mr-4">
|
<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>
|
<span>过滤</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="radio-inline custom-radio nowrap mr-4">
|
<label class="radio-inline custom-radio nowrap mr-4">
|
||||||
<input type="radio" [(ngModel)]="filterItems.FLT_POS" [value]="2" name="filter-position">
|
<input type="radio" [(ngModel)]="FLT_POS" [value]="2" name="filter-position">
|
||||||
<span>查找定位</span>
|
<span>查找定位</span>
|
||||||
</label>
|
</label>
|
||||||
<input class="form-control" [(ngModel)]="filterItems.SEARCH" type="text">
|
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter) = "inputFliter()">
|
||||||
</div>
|
</div>
|
||||||
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-1">
|
<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>
|
||||||
@@ -145,8 +145,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<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}">
|
||||||
[ngClass]="{'active':row_state===i}">
|
|
||||||
<td>{{i+1}}</td>
|
<td>{{i+1}}</td>
|
||||||
<td></td>
|
<td></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>
|
<td *ngFor="let airline_col of col_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||||
|
|||||||
@@ -48,9 +48,14 @@ export class MainComponent implements OnInit {
|
|||||||
public TOP_13 = 13000000000000;
|
public TOP_13 = 13000000000000;
|
||||||
public TOP_14 = 14000000000000;
|
public TOP_14 = 14000000000000;
|
||||||
|
|
||||||
|
|
||||||
|
// 搜索条件
|
||||||
|
SEARCH = ''; //手动输入条件
|
||||||
|
FLT_POS = 1; //过滤还是定位
|
||||||
|
SEL_COL = ''; //选择列名
|
||||||
|
|
||||||
|
|
||||||
public filterItems = {
|
public filterItems = {
|
||||||
SEARCH: '', //手动输入条件
|
|
||||||
FLT_POS: 1, //过滤还是定位
|
|
||||||
ALCD: '', //航空公司
|
ALCD: '', //航空公司
|
||||||
FLIN: '', //航线类别
|
FLIN: '', //航线类别
|
||||||
FLTY: '', //航班类别
|
FLTY: '', //航班类别
|
||||||
@@ -80,9 +85,9 @@ export class MainComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selectRow($event, i) {
|
selectRow(i) {
|
||||||
this.row_state = i;
|
this.row_state = i;
|
||||||
alert(i)
|
this.changeDetectorRef.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
getColor(col_CODE) {
|
getColor(col_CODE) {
|
||||||
@@ -129,7 +134,6 @@ export class MainComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
combined_linked_data.forEach(element => {
|
combined_linked_data.forEach(element => {
|
||||||
let row_flights = {};
|
let row_flights = {};
|
||||||
let render_flight = {};
|
let render_flight = {};
|
||||||
@@ -162,16 +166,16 @@ export class MainComponent implements OnInit {
|
|||||||
let key = this.col_lists[i]['COL_CODE']
|
let key = this.col_lists[i]['COL_CODE']
|
||||||
if (this.formatter.hasOwnProperty(key)) {
|
if (this.formatter.hasOwnProperty(key)) {
|
||||||
if (typeof (this.formatter[key]) === 'function') {
|
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_pre_flight[key] = this.formatter[key](row_flights['preFlight'][key], 1);
|
||||||
render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1);
|
render_rea_flight[key] = this.formatter[key](row_flights['reaFlight'][key], 1);
|
||||||
} else {
|
} 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_pre_flight[key] = this.formatter[key][row_flights['preFlight'][key]];
|
||||||
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
|
render_rea_flight[key] = this.formatter[key][row_flights['reaFlight'][key]];
|
||||||
}
|
}
|
||||||
} else {
|
} 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_pre_flight[key] = row_flights['preFlight'][key];
|
||||||
render_rea_flight[key] = row_flights['reaFlight'][key];
|
render_rea_flight[key] = row_flights['reaFlight'][key];
|
||||||
}
|
}
|
||||||
@@ -186,13 +190,13 @@ export class MainComponent implements OnInit {
|
|||||||
//排序
|
//排序
|
||||||
this.combined_data.forEach(element => {
|
this.combined_data.forEach(element => {
|
||||||
element['ORDER'] = this.sequence(element)
|
element['ORDER'] = this.sequence(element)
|
||||||
// element['ORDER'] = '+' + element['order']
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.combined_data.sort(function (a, b) {
|
this.combined_data.sort(function (a, b) {
|
||||||
return (a['ORDER'] - b['ORDER']);
|
return (a['ORDER'] - b['ORDER']);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
this.render_data = this.combined_data
|
this.render_data = this.combined_data
|
||||||
|
|
||||||
this.changeDetectorRef.detectChanges();
|
this.changeDetectorRef.detectChanges();
|
||||||
@@ -207,12 +211,125 @@ export class MainComponent implements OnInit {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fliter(filterItems, render_data) {
|
inputFliter() {
|
||||||
if(filterItems.FLT_POS===1){
|
let filterItems = this.filterItems;
|
||||||
//过滤
|
let combined_data = this.combined_data;
|
||||||
}else{
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"COL_CODE":"FLNO",
|
"COL_CODE":"FLNO",
|
||||||
"COL_CN":"航班号",
|
"COL_CN":"航班号",
|
||||||
"COL_ORDER":"10"
|
"COL_ORDER":"1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"COL_CODE":"ALCD",
|
"COL_CODE":"ALCD",
|
||||||
@@ -53,10 +53,5 @@
|
|||||||
"COL_CODE":"STND",
|
"COL_CODE":"STND",
|
||||||
"COL_CN":"停机位",
|
"COL_CN":"停机位",
|
||||||
"COL_ORDER":"16"
|
"COL_ORDER":"16"
|
||||||
},
|
|
||||||
{
|
|
||||||
"COL_CODE":"ORDER",
|
|
||||||
"COL_CN":"排序",
|
|
||||||
"COL_ORDER":"17"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user