表格高度自适应等优化

This commit is contained in:
zhouyuejun
2018-12-24 16:33:39 +08:00
parent b1d84ac2bc
commit 6e35f9cb88
9 changed files with 127 additions and 41 deletions
@@ -1,6 +1,6 @@
<div class="main-page">
<div class="main-page" #mainPage>
<div class="page-content">
<div class="search-filter mb-3">
<div class="search-filter mb-3" #searchFilter>
<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 [(ngModel)]="SEL_COL" class="mr-4 form-control" name="" id="">
@@ -17,12 +17,13 @@
</label>
<input class="form-control" [(ngModel)]="SEARCH" type="text" (keyup.enter)="inputEnter()">
</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" (click)="refresh()">刷新</button>
<div class="line-operator-right mb-3 col-xlg-4 col-mlg-4 col-xl-4 col-lg-2">
<button type="button" class="btn btn-info mr-2" (click)="toggleFilter()">{{filterClose?'展开':'关闭'}}</button>
<button type="button" class="btn btn-info mr-2" (click)="refresh()">刷新</button>
</div>
</div>
<div class="second-condition mb-3 row">
<div [ngClass]="{'filterClose-c':filterClose,'filterClose-o':!filterClose}" class="second-condition mb-3 row">
<div class="input-container mr-4">
<label for="">航空公司:&nbsp;&nbsp;</label>
<select [(ngModel)]="filterItems.ALCD" (ngModelChange)="selectChange()" class="form-control">
@@ -82,7 +83,7 @@
</div>
</div>
<div class="third-condition row">
<div [ngClass]="{'filterClose-c':filterClose,'filterClose-o':!filterClose}" class="third-condition row">
<label class="radio-inline custom-checkbox nowrap mr-4">
<input type="checkbox" [(ngModel)]="checkboxGroup.related" (ngModelChange)="checkboxChange()">
<span>航班关联信息</span>
@@ -106,7 +107,7 @@
</div>
</div>
<div class="airline-table">
<div id="table-container" class="table-container" [ngClass]="{'table-c': !tabClose,'table-o': tabClose}">
<div #tableContainer id="table-container" class="table-container" [ngClass]="{'table-c': !tabClose,'table-o': tabClose}">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
@@ -19,6 +19,9 @@
}
}
}
.second-condition,.third-condition{
display: none;
}
.input-container {
padding: 0;
> .form-control {
@@ -26,6 +29,12 @@
display: inline-block;
}
}
.filterClose-c{
display: none;
}
.filterClose-o{
display: flex;
}
}
.airline-table{
.table-container{
@@ -50,6 +59,19 @@
text-align: center;
}
}
&::-webkit-scrollbar {
width: 15px;
height: 15px;
}
&::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
background: rgba(165, 207, 222, 1);
border-radius: 10px;
}
&::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.06);
border-radius: 10px;
}
}
}
}
@@ -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');
}
/**
* 刷新
*/