公共部分样式修改及table表头固定

This commit is contained in:
zhouyuejun
2018-11-15 18:29:19 +08:00
parent f30867e92b
commit 11cb7c366a
8 changed files with 97 additions and 63 deletions
+20 -1
View File
@@ -145,13 +145,32 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(airline_row)" [ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}"> <tr *ngFor="let airline_row of render_data;let i = index" (click)="selectRow(airline_row)"
[ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}">
<td>{{i+1}}</td> <td>{{i+1}}</td>
<td></td> <td></td>
<td *ngFor="let airline_col of col_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td> <td *ngFor="let airline_col of col_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<!-- <nz-table #nzTable nzBordered [nzData]="render_data" [nzFrontPagination]="false" [nzScroll]="{ y: '700px' }">
<thead>
<tr>
<th nzWidth="50px">序号</th>
<th nzWidth="80px">重要提示</th>
<th nzWidth="80px" *ngFor="let airline_col of col_lists">{{airline_col.COL_CN}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let airline_row of nzTable.data;let i = index" (click)="selectRow(airline_row)"
[ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}">
<td>{{i+1}}</td>
<td></td>
<td *ngFor="let airline_col of col_lists" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
</tr>
</tbody>
</nz-table> -->
</div> </div>
</div> </div>
</div> </div>
+7 -2
View File
@@ -1,6 +1,7 @@
.main-page { .main-page {
width: 100%; width: 100%;
height: calc(100% - 66px); height: 100%;
overflow-y: scroll;
padding: 15px 10px; padding: 15px 10px;
background-color: #fff; background-color: #fff;
.page-content { .page-content {
@@ -31,7 +32,8 @@
// border: 1px solid #ccc; // border: 1px solid #ccc;
width: 100%; width: 100%;
height: 700px; height: 700px;
overflow: scroll; overflow: auto;
box-shadow: 0 0 1px .5px #ddd;
table{ table{
width: max-content; width: max-content;
tr{ tr{
@@ -40,6 +42,9 @@
background: rgb(181, 215, 255); background: rgb(181, 215, 255);
} }
} }
th{
background-color: #ddd;
}
th,td{ th,td{
// border: none; // border: none;
text-align: center; text-align: center;
+11 -2
View File
@@ -103,7 +103,6 @@ export class MainComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
// console.log($)
this.changeDetectorRef.detach(); this.changeDetectorRef.detach();
/* 获取显示列 */ /* 获取显示列 */
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe( this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
@@ -195,6 +194,16 @@ export class MainComponent implements OnInit {
this.doSequence(this.combined_data); this.doSequence(this.combined_data);
} }
) )
/**
* 固定表头
*/
var tableCont = document.querySelector('#table-container')
function scrollHandle (){
var scrollTop = this.scrollTop;
this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
}
tableCont.addEventListener('scroll',scrollHandle)
} }
@@ -439,7 +448,7 @@ export class MainComponent implements OnInit {
let tr = $(".selected"); let tr = $(".selected");
let objTr = tr[0]; let objTr = tr[0];
$("#table-container").animate({ scrollTop: objTr.offsetTop }, "slow"); $("#table-container").animate({ scrollTop: objTr.offsetTop - 42 }, "slow");
} }
/** /**
+3
View File
@@ -1,6 +1,8 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgZorroAntdModule } from 'ng-zorro-antd'
import { PipesModule } from '../../pipes/pipes.module'; import { PipesModule } from '../../pipes/pipes.module';
import { MainComponent } from './main.component'; import { MainComponent } from './main.component';
import { MainRoutingModule } from './main-routing.module' import { MainRoutingModule } from './main-routing.module'
@@ -10,6 +12,7 @@ import { MainRoutingModule } from './main-routing.module'
CommonModule, CommonModule,
FormsModule, FormsModule,
ReactiveFormsModule, ReactiveFormsModule,
NgZorroAntdModule,
PipesModule, PipesModule,
MainRoutingModule MainRoutingModule
], ],
+13 -10
View File
@@ -1,15 +1,9 @@
<div class="wrapper"> <div class="wrapper">
<div class="left-wrapper"> <div class="header-wrapper">
<div class="left-header">
<!-- <img src="/assets/images/logo.png" /> -->
<h3>航班信息查询系统</h3>
</div>
<div class="left-menu">
<app-sidebar-menu [data]="menuData"></app-sidebar-menu>
</div>
</div>
<div class="right-wrapper">
<nav class="navbar navbar-expand navbar-dark bg-dark"> <nav class="navbar navbar-expand navbar-dark bg-dark">
<a class="navbar-brand">
航班信息查询系统
</a>
<a class="navbar-brand"> <a class="navbar-brand">
<i class=" fa fa-dedent"></i> <i class=" fa fa-dedent"></i>
</a> </a>
@@ -61,7 +55,16 @@
</ul> </ul>
</div> </div>
</nav> </nav>
</div>
<div class="content-wrapper">
<div class="left-wrapper">
<div class="left-menu">
<app-sidebar-menu [data]="menuData"></app-sidebar-menu>
</div>
</div>
<div class="right-wrapper">
<router-outlet></router-outlet> <router-outlet></router-outlet>
</div> </div>
</div>
</div> </div>
+38 -31
View File
@@ -3,37 +3,8 @@
.wrapper { .wrapper {
width: 100%; width: 100%;
height: 100%; height: 100%;
.left-wrapper { overflow: hidden;
height: 100%; .header-wrapper {
width: 235px;
position: fixed;
top: 0;
left: 0;
background-color: rgb(46, 59, 76);
float: left;
.left-header {
height: 66px;
border-bottom: 1px solid $gray-900;
text-align: center;
line-height: 66px;
img {
width: 32px;
height: 32px;
vertical-align: middle;
margin-right: 12px;
}
h3 {
display: inline-block;
color: $white;
vertical-align: middle;
margin: 0;
}
}
}
.right-wrapper {
// width: 100%;
height: 100%;
margin-left: 235px;
.navbar { .navbar {
height: 66px; height: 66px;
background-color: rgb(46, 59, 76) !important; background-color: rgb(46, 59, 76) !important;
@@ -95,4 +66,40 @@
} }
} }
} }
.content-wrapper {
height: 100%;
.left-wrapper {
height: calc(100% - 66px);
width: 235px;
position: fixed;
top: 66px;
left: 0;
background-color: rgb(46, 59, 76);
padding-bottom: 30px;
overflow-y: scroll;
.left-header {
height: 66px;
border-bottom: 1px solid $gray-900;
text-align: center;
line-height: 66px;
img {
width: 32px;
height: 32px;
vertical-align: middle;
margin-right: 12px;
}
h3 {
display: inline-block;
color: $white;
vertical-align: middle;
margin: 0;
}
}
}
.right-wrapper {
height: calc(100% - 66px);
margin-left: 235px;
}
}
} }
-12
View File
@@ -193,18 +193,7 @@ export class PagesComponent implements OnInit {
this.router.events.pipe( this.router.events.pipe(
filter(event => event instanceof NavigationEnd), filter(event => event instanceof NavigationEnd),
// map(() => this.activatedRoute),
// map(route => {
// console.log(route)
// while (route.firstChild) route = route.firstChild;
// console.log('-----')
// return route;
// }),
// filter(route => route.outlet === 'primary'),
// mergeMap(route => route.data)
).subscribe((event) => { ).subscribe((event) => {
// console.log(event['urlAfterRedirects'])
this.selectActiveMenu(this.menuData,event['urlAfterRedirects']) this.selectActiveMenu(this.menuData,event['urlAfterRedirects'])
}); });
@@ -227,7 +216,6 @@ export class PagesComponent implements OnInit {
item.isActive = false; item.isActive = false;
} }
}else{ }else{
// item.isExpend = !item.isExpend;
this.selectActiveMenu(item.children,activeRoute) this.selectActiveMenu(item.children,activeRoute)
} }
}) })
+1 -1
View File
@@ -5,7 +5,7 @@ body {
height: 100%; height: 100%;
font-size: 14px !important; font-size: 14px !important;
font-family: "Roboto", sans-serif !important; font-family: "Roboto", sans-serif !important;
background-color: #1190d6 !important; background-color: #fff !important;
// color: rgb(0, 0, 0) !important; // color: rgb(0, 0, 0) !important;
} }
/*添加手形*/ /*添加手形*/