机型、飞机优化
This commit is contained in:
@@ -54,7 +54,7 @@ inputEnter() {
|
|||||||
this.inputFilter(this.aircraftTypes)
|
this.inputFilter(this.aircraftTypes)
|
||||||
} else {
|
} else {
|
||||||
this.inputFilter(this.aircraftTypes)
|
this.inputFilter(this.aircraftTypes)
|
||||||
// this.inputPosition(this.render_data)
|
this.inputPosition(this.aircraftTypes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,26 +20,28 @@
|
|||||||
<!-- <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> -->
|
||||||
<button type="button" class="btn btn-info mr-3" (click)="clearFiter()">刷新</button>
|
<button type="button" class="btn btn-info mr-3">刷新</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="second-condition mb-3 row">
|
<div class="second-condition mb-3 row">
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">航空公司: </label>
|
<label for="airlineCode">航空公司: </label>
|
||||||
<select class="form-control" [(ngModel)]="aircrafts" (ngModelChange)="selectChange()" id="airlineCompany">
|
<select class="form-control" [(ngModel)]="filterItems.airlineCode" (ngModelChange)="selectChange()" id="airlineCompany">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<option value="GH">海南航空公司</option>
|
<option *ngFor="let item of aircrafts" [value]="item.airlineCode">{{item.airlineCode}}</option>
|
||||||
<option value="CH">国外航空公司</option>
|
<!-- <option value="GH">海南航空公司</option>
|
||||||
|
<option value="CH">国外航空公司</option> -->
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-container mr-4">
|
<div class="input-container mr-4">
|
||||||
<label for="">机型: </label>
|
<label for="aircraftTypeCode">机型: </label>
|
||||||
<select class="form-control" [(ngModel)]="aircrafts" (ngModelChange)="selectChange()" id="jx">
|
<select class="form-control" [(ngModel)]="filterItems.aircraftTypeCode" (ngModelChange)="selectChange()" id="jx">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<option value="A">A306</option>
|
<option *ngFor="let item of aircrafts" [value]="item.aircraftTypeCode">{{item.aircraftTypeCode}}</option>
|
||||||
|
<!-- <option value="A">A306</option>
|
||||||
<option value="B">B252</option>
|
<option value="B">B252</option>
|
||||||
<option value="C">C256</option>
|
<option value="C">C256</option> -->
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -63,7 +65,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let aircraft of aircrafts;let i = index">
|
<tr *ngFor="let aircraft of render_data;let i = index">
|
||||||
<td>{{i+1}}</td>
|
<td>{{i+1}}</td>
|
||||||
<td>{{aircraft.aircraftNumber}}</td>
|
<td>{{aircraft.aircraftNumber}}</td>
|
||||||
<td>{{aircraft.maxPassengers}}</td>
|
<td>{{aircraft.maxPassengers}}</td>
|
||||||
|
|||||||
@@ -20,9 +20,17 @@ SEARCH = ''; //手动输入条件
|
|||||||
FLT_POS = 1; //过滤还是定位
|
FLT_POS = 1; //过滤还是定位
|
||||||
SEL_COL = ''; //选择列名
|
SEL_COL = ''; //选择列名
|
||||||
|
|
||||||
|
//下拉框
|
||||||
|
public filterItems = {
|
||||||
|
airlineCode:'',
|
||||||
|
aircraftTypeCode:'',
|
||||||
|
}
|
||||||
|
|
||||||
aircrafts : Array<any>;
|
aircrafts : Array<any>;
|
||||||
public row_state: any = { renderFlight: {} };
|
public row_state: any = { renderFlight: {} };
|
||||||
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
public render_data: Array<object> = []; //显示数据,即需要显示的数据
|
||||||
|
public return_data: Array<object> = []; //下拉框显示数据
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.aircrafts = this.basicDataService.aircraft;
|
this.aircrafts = this.basicDataService.aircraft;
|
||||||
this.basicDataService.aircraft_subject.subscribe(
|
this.basicDataService.aircraft_subject.subscribe(
|
||||||
@@ -42,109 +50,34 @@ ngOnInit() {
|
|||||||
tableCont.addEventListener('scroll',scrollHandle);
|
tableCont.addEventListener('scroll',scrollHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//刷新
|
|
||||||
clearFiter(){
|
|
||||||
$("#inputerInfo").val(""); //清空过滤或查找定位文本框
|
|
||||||
$("#airlineCompany").val(""); //清空航空公司
|
|
||||||
$("#jx").val(""); //清空机型
|
|
||||||
this.ngOnInit();
|
|
||||||
}
|
|
||||||
//输入框回车事件
|
//输入框回车事件
|
||||||
inputEnter() {
|
inputEnter() {
|
||||||
if (this.FLT_POS === 1) {
|
if (this.FLT_POS === 1) {
|
||||||
this.selectChange()
|
this.inputFilter(this.aircrafts)
|
||||||
} else {
|
} else {
|
||||||
this.selectChange()
|
this.inputFilter(this.aircrafts)
|
||||||
this.inputPosition(this.render_data)
|
this.inputPosition(this.aircrafts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//下拉框选择筛选
|
//下拉框选择筛选
|
||||||
selectChange() {
|
selectChange() {
|
||||||
let filter_data = [];
|
this.return_data = this.aircrafts.filter(item=>{
|
||||||
let filteraircrafts = this.render_data;
|
|
||||||
this.render_data.forEach(item => {
|
|
||||||
filter_data.push(Object.assign({}, item));
|
|
||||||
})
|
|
||||||
if (this.FLT_POS === 1) {
|
|
||||||
this.inputFilter(filter_data);
|
|
||||||
} else {
|
|
||||||
this.aircrafts = filter_data;
|
|
||||||
this.row_state = this.aircrafts.length > 0 ? this.aircrafts[0] : { renderFlight: {} };
|
|
||||||
}
|
|
||||||
//下拉框筛选
|
|
||||||
filter_data = filter_data.filter(item => {
|
|
||||||
if (item) {
|
|
||||||
let is_satis = true;
|
let is_satis = true;
|
||||||
for (const key in filteraircrafts) {
|
for (const key in this.filterItems) {
|
||||||
if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) {
|
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
|
||||||
if (item[key] === filteraircrafts[key]) {
|
if (item[key] === this.filterItems[key]) {
|
||||||
is_satis = true;
|
is_satis = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
is_satis = false;
|
is_satis = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return is_satis;
|
return is_satis;
|
||||||
} else if (item) {
|
|
||||||
let is_satis = true;
|
|
||||||
for (const key in filteraircrafts) {
|
|
||||||
if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) {
|
|
||||||
if (item[key] === filteraircrafts[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 filteraircrafts) {
|
|
||||||
if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) {
|
|
||||||
if (item[key] === filteraircrafts[key]) {
|
|
||||||
pre_satis = true;
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
pre_satis = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const key in filteraircrafts) {
|
|
||||||
if (filteraircrafts.hasOwnProperty(key) && filteraircrafts[key]) {
|
|
||||||
if (item[key] === filteraircrafts[key]) {
|
|
||||||
rea_satis = true;
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
rea_satis = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pre_satis && !rea_satis) {
|
|
||||||
item = item;
|
|
||||||
return pre_satis;
|
|
||||||
} else if (!pre_satis && rea_satis) {
|
|
||||||
item = item;
|
|
||||||
return rea_satis;
|
|
||||||
} else if (pre_satis && rea_satis) {
|
|
||||||
return pre_satis && rea_satis;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
this.render_data = this.return_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//输入框筛选
|
//输入框筛选
|
||||||
@@ -196,8 +129,8 @@ selectChange() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.aircrafts = filterData;
|
this.render_data = filterData;
|
||||||
this.row_state = this.aircrafts.length > 0 ? this.aircrafts[0] : { renderFlight: {} };
|
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||||
}
|
}
|
||||||
|
|
||||||
positionArray: Array<any> = [];
|
positionArray: Array<any> = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user