表格高度自适应等优化
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 { NavigationEnd, Router } from '@angular/router';
|
||||
|
||||
@@ -28,6 +28,7 @@ import * as $ from 'jquery';
|
||||
export class MainComponent implements OnInit {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private renderer2: Renderer2,
|
||||
private basicDataService: BasicDataService,
|
||||
private operateSpinServiceService: OperateSpinServiceService,
|
||||
private httpCilent: HttpClientService,
|
||||
@@ -35,14 +36,12 @@ export class MainComponent implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private websocketService: WebsocketService
|
||||
) {
|
||||
console.log(new Date().getTime());
|
||||
this.operateSpinServiceService.showSpin();
|
||||
this.changeDetectorRef.detach();
|
||||
this.router.events.pipe(
|
||||
filter((event => event instanceof NavigationEnd))
|
||||
).subscribe(
|
||||
(event: NavigationEnd) => {
|
||||
console.log(event);
|
||||
if (event.urlAfterRedirects === '/app/main') {
|
||||
this.httpCilent.get('/adminapi/settings/uisettings').subscribe(
|
||||
data => {
|
||||
@@ -107,31 +106,36 @@ export class MainComponent implements OnInit {
|
||||
'guarantee': false
|
||||
}
|
||||
|
||||
@ViewChild('mainPage') mainPage;
|
||||
@ViewChild('searchFilter') searchFilter;
|
||||
@ViewChild('tableContainer') tableContainer;
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
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.websocketService.dynamicsMessage().subscribe(
|
||||
event => {
|
||||
let data = JSON.parse(event as string);
|
||||
if (data.topic === 'schd') {
|
||||
console.log(new Date().getTime());
|
||||
let message = JSON.parse(data.message);
|
||||
console.log(message);
|
||||
//是否可以开始处理动态消息
|
||||
if (this.canHandleDynamicMessage) {
|
||||
this.dynamicMessageHandle(message);
|
||||
} else {
|
||||
this.dynamicMessageArray.push(message);
|
||||
}
|
||||
|
||||
} else if (data.topic === 'msg') {
|
||||
let message = JSON.parse(data.message);
|
||||
console.log(message);
|
||||
if (this.canHandleDynamicAlert) {
|
||||
this.dynamicAlertHandle(message);
|
||||
} else {
|
||||
this.dynamicAlertArray.push(message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -207,6 +211,13 @@ export class MainComponent implements OnInit {
|
||||
tableCont.addEventListener('scroll', scrollHandle)
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 动态消息处理方法
|
||||
@@ -262,8 +273,6 @@ export class MainComponent implements OnInit {
|
||||
return (a['ORDER'] - b['ORDER']);
|
||||
})
|
||||
this.changeDetectorRef.detectChanges();
|
||||
console.log(new Date().getTime());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,7 +304,6 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
dynamicAlertHandle(message) {
|
||||
let alertType = message.META.TYPE + '-' + message.META.STYP;
|
||||
console.log(alertType)
|
||||
let index = this.airline_message_alert.findIndex(val => val['COL_CODE'] === alertType);
|
||||
if (index > -1) {
|
||||
let alertText = this.alertMessage[alertType]();
|
||||
@@ -330,7 +338,6 @@ export class MainComponent implements OnInit {
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
this.changeDetectorRef.detectChanges();
|
||||
this.operateSpinServiceService.hideSpin();
|
||||
console.log(new Date().getTime());
|
||||
|
||||
//开始处理动态消息
|
||||
this.canHandleDynamicMessage = true;
|
||||
@@ -379,7 +386,6 @@ export class MainComponent implements OnInit {
|
||||
* 输入框回车事件
|
||||
*/
|
||||
inputEnter() {
|
||||
console.log(new Date().getTime());
|
||||
if (this.FLT_POS === 1) {
|
||||
this.selectChange()
|
||||
} else {
|
||||
@@ -567,7 +573,6 @@ export class MainComponent implements OnInit {
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
this.changeDetectorRef.detectChanges();
|
||||
this.operateSpinServiceService.hideSpin();
|
||||
console.log(new Date().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user