表格高度自适应等优化
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit,ViewChild,Renderer2 } from '@angular/core';
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
import { ToastService } from '../../components/toast/toast.service';
|
||||
@@ -22,6 +22,7 @@ declare var laydate: any;
|
||||
export class HistoricalDataComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private renderer2: Renderer2,
|
||||
private basicDataService: BasicDataService,
|
||||
private operateSpinServiceService: OperateSpinServiceService,
|
||||
private httpCilent: HttpClientService,
|
||||
@@ -65,6 +66,10 @@ export class HistoricalDataComponent implements OnInit {
|
||||
'guarantee': false
|
||||
}
|
||||
|
||||
@ViewChild('mainPage') mainPage;
|
||||
@ViewChild('searchFilter') searchFilter;
|
||||
@ViewChild('tableContainer') tableContainer;
|
||||
|
||||
ngOnInit() {
|
||||
laydate.render({
|
||||
elem: '#selectDate',
|
||||
@@ -93,6 +98,11 @@ export class HistoricalDataComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px');
|
||||
window.onresize = function () {
|
||||
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px');
|
||||
}.bind(this)
|
||||
|
||||
|
||||
/* 获取用户设置 */
|
||||
this.httpCilent.get('/adminapi/settings/uisettings').subscribe(
|
||||
@@ -106,7 +116,7 @@ export class HistoricalDataComponent implements OnInit {
|
||||
}
|
||||
)
|
||||
//获取航班动态信息
|
||||
this.httpCilent.post('/adminapi/hitFlightData/list').subscribe(
|
||||
this.httpCilent.post('/adminapi/hitFlightData/list',{ hstFLightTime: '2018-11-22' }).subscribe(
|
||||
data => {
|
||||
this.raw_data = data.body;
|
||||
|
||||
@@ -204,6 +214,13 @@ export class HistoricalDataComponent implements OnInit {
|
||||
this.operateSpinServiceService.hideSpin()
|
||||
}
|
||||
|
||||
public filterClose: boolean = true;
|
||||
toggleFilter() {
|
||||
this.filterClose = !this.filterClose;
|
||||
this.changeDetectorRef.detectChanges();
|
||||
this.renderer2.setStyle(this.tableContainer.nativeElement, 'height', this.mainPage.nativeElement.offsetHeight - this.searchFilter.nativeElement.offsetHeight - 55 + 'px');
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user