行李传送带选择列名数据绑定及查找定位数据过滤筛选

This commit is contained in:
714943302@qq.com
2018-11-23 13:41:35 +08:00
parent c1c4daf1da
commit 184046f782
2 changed files with 72 additions and 137 deletions
@@ -5,6 +5,8 @@
<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>
<option value="chutCode">行李传送带代码</option>
<option value="chutName">行李传送带名称</option>
</select>
<label class="radio-inline custom-radio nowrap mr-4">
<input type="radio" [(ngModel)]="FLT_POS" [value]="1" name="filter-position">
@@ -19,7 +21,7 @@
<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" (click)="clearFiter()">刷新</button>
<button type="button" class="btn btn-info mr-3">刷新</button>
</div>
</div>
</div>
@@ -36,7 +38,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let chut of chuts;let i = index">
<tr *ngFor="let chut of render_data;let i = index">
<td>{{i+1}}</td>
<td>{{chut.chutCode}}</td>
<td>{{chut.chutName}}</td>
+16 -83
View File
@@ -20,9 +20,15 @@ SEARCH = ''; //手动输入条件
FLT_POS = 1; //过滤还是定位
SEL_COL = ''; //选择列名
//下拉框
public filterItems = {
}
chuts : Array<any>;
public row_state: any = { renderFlight: {} };
public render_data: Array<object> = []; //显示数据,即需要显示的数据
public return_data: Array<object> = []; //下拉框显示数据
ngOnInit() {
this.chuts = this.basicDataService.chut;
this.basicDataService.chut_subject.subscribe(
@@ -42,107 +48,34 @@ ngOnInit() {
tableCont.addEventListener('scroll',scrollHandle);
}
//刷新
clearFiter(){
$("#inputerInfo").val(""); //清空过滤或查找定位文本框
this.ngOnInit();
}
//输入框回车事件
inputEnter() {
if (this.FLT_POS === 1) {
this.selectChange()
this.inputFilter(this.chuts)
} else {
this.selectChange()
this.inputPosition(this.render_data)
this.inputFilter(this.chuts)
this.inputPosition(this.chuts)
}
}
//下拉框选择筛选
selectChange() {
let filter_data = [];
let filterchuts = 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.chuts = filter_data;
this.row_state = this.chuts.length > 0 ? this.chuts[0] : { renderFlight: {} };
}
//下拉框筛选
filter_data = filter_data.filter(item => {
if (item) {
this.return_data = this.chuts.filter(item=>{
let is_satis = true;
for (const key in filterchuts) {
if (filterchuts.hasOwnProperty(key) && filterchuts[key]) {
if (item[key] === filterchuts[key]) {
for (const key in this.filterItems) {
if (this.filterItems.hasOwnProperty(key) && this.filterItems[key]) {
if (item[key] === this.filterItems[key]) {
is_satis = true;
continue;
} else {
is_satis = false;
break;
}
}
}
return is_satis;
} else if (item) {
let is_satis = true;
for (const key in filterchuts) {
if (filterchuts.hasOwnProperty(key) && filterchuts[key]) {
if (item[key] === filterchuts[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 filterchuts) {
if (filterchuts.hasOwnProperty(key) && filterchuts[key]) {
if (item[key] === filterchuts[key]) {
pre_satis = true;
continue;
} else {
pre_satis = false;
break;
}
}
}
for (const key in filterchuts) {
if (filterchuts.hasOwnProperty(key) && filterchuts[key]) {
if (item[key] === filterchuts[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;
}
//输入框筛选
@@ -194,8 +127,8 @@ if (this.SEARCH) {
})
}
}
this.chuts = filterData;
this.row_state = this.chuts.length > 0 ? this.chuts[0] : { renderFlight: {} };
this.render_data = filterData;
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
}
positionArray: Array<any> = [];