添加路由复用策略
This commit is contained in:
@@ -5,7 +5,8 @@ import { MainComponent } from './main.component'
|
||||
const mainRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: MainComponent
|
||||
component: MainComponent,
|
||||
data: { preload: true, reuse: true }
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
<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">灯光关闭</button>
|
||||
<button type="button" class="btn btn-info mr-3">查看开关灯记录</button> -->
|
||||
<button type="button" class="btn btn-info mr-3" (click)="refresh()">刷新</button>
|
||||
<!-- <button type="button" class="btn btn-info">航班动态信息</button> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -53,12 +50,6 @@
|
||||
<option value="">VIP</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- <div class="input-container mr-4">
|
||||
<label for="">航班任务: </label>
|
||||
<select class="form-control" name="" id="">
|
||||
<option value=""></option>
|
||||
</select>
|
||||
</div> -->
|
||||
<div class="input-container mr-4">
|
||||
<label for="">到达/出发:</label>
|
||||
<select [(ngModel)]="filterItems.MVIN" (ngModelChange)="selectChange()" class="form-control">
|
||||
@@ -151,7 +142,8 @@
|
||||
[ngClass]="{'selected':row_state['renderFlight']['FLNO']===airline_row['renderFlight']['FLNO']}">
|
||||
<td>{{i+1}}</td>
|
||||
<td>{{isLast}}</td>
|
||||
<td *ngFor="let airline_col of col_lists" [ngClass]="getPosition(airline_col.COL_CODE,airline_row)" [ngStyle]="{'background-color':getColor(airline_col.COL_CODE,airline_row)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
<td *ngFor="let airline_col of col_lists" [ngClass]="getPosition(airline_col.COL_CODE,airline_row)"
|
||||
[ngStyle]="{'background-color':getColor(airline_col.COL_CODE,airline_row)}">{{airline_row['renderFlight'][airline_col.COL_CODE]}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
.main-page {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
@@ -122,6 +123,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
.page-loading{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('../../../assets/images/page-loading.gif');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
// @media screen and (min-width: 1200px){
|
||||
// .line-operator-right{
|
||||
// text-align: left;
|
||||
|
||||
@@ -46,13 +46,14 @@ export class MainComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private basicDataService: BasicDataService,
|
||||
// private operateSpinServiceService:OperateSpinServiceService,
|
||||
private operateSpinServiceService: OperateSpinServiceService,
|
||||
private httpCilent: HttpClientService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private toastService: ToastService,
|
||||
private websocketService: WebsocketService
|
||||
) {
|
||||
console.log(new Date().getTime())
|
||||
this.operateSpinServiceService.showSpin();
|
||||
}
|
||||
public tabClose: boolean = true;
|
||||
public isSpinning: boolean = true;
|
||||
@@ -108,12 +109,13 @@ export class MainComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.websocketService.dynamicsMessage().subscribe(
|
||||
event => {
|
||||
console.log(event);
|
||||
}
|
||||
)
|
||||
// this.getBasicData()
|
||||
|
||||
this.changeDetectorRef.detach();
|
||||
/* 获取显示列 */
|
||||
this.httpCilent.get('/assets/mock-data/airline-col_code.json').subscribe(
|
||||
@@ -397,17 +399,13 @@ export class MainComponent implements OnInit {
|
||||
sequenceData.forEach(element => {
|
||||
element['ORDER'] = this.sequence(element);
|
||||
})
|
||||
|
||||
sequenceData.sort(function (a, b) {
|
||||
return (a['ORDER'] - b['ORDER']);
|
||||
})
|
||||
|
||||
this.render_data = sequenceData;
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
console.log(new Date().getTime() + '---');
|
||||
this.changeDetectorRef.detectChanges();
|
||||
console.log(new Date().getTime() + '---');
|
||||
|
||||
this.operateSpinServiceService.hideSpin()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,9 +438,7 @@ export class MainComponent implements OnInit {
|
||||
*/
|
||||
refresh() {
|
||||
this.render_data.reverse();
|
||||
console.log('=====');
|
||||
this.changeDetectorRef.detectChanges();
|
||||
console.log('-----');
|
||||
}
|
||||
|
||||
|
||||
@@ -482,92 +478,94 @@ export class MainComponent implements OnInit {
|
||||
* 下拉框选择筛选
|
||||
*/
|
||||
selectChange() {
|
||||
// this.operateSpinServiceService.showSpin()
|
||||
let filter_data = [];
|
||||
let filterItems = this.filterItems;
|
||||
this.combined_data.forEach(item => {
|
||||
filter_data.push(Object.assign({}, item));
|
||||
})
|
||||
//下拉框筛选
|
||||
filter_data = filter_data.filter(item => {
|
||||
if (this.isArriFlight(item)) {
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['preFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
this.operateSpinServiceService.showSpin();
|
||||
setTimeout(() => {
|
||||
let filter_data = [];
|
||||
let filterItems = this.filterItems;
|
||||
this.combined_data.forEach(item => {
|
||||
filter_data.push(Object.assign({}, item));
|
||||
})
|
||||
//下拉框筛选
|
||||
filter_data = filter_data.filter(item => {
|
||||
if (this.isArriFlight(item)) {
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['preFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return is_satis;
|
||||
} else if (this.isDeptFlight(item)) {
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['reaFlight'][key] === filterItems[key]) {
|
||||
is_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
is_satis = false;
|
||||
break;
|
||||
return is_satis;
|
||||
} else if (this.isDeptFlight(item)) {
|
||||
let is_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['reaFlight'][key] === filterItems[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 filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['preFlight'][key] === filterItems[key]) {
|
||||
pre_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
pre_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['reaFlight'][key] === filterItems[key]) {
|
||||
rea_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
rea_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (pre_satis && !rea_satis) {
|
||||
item['renderFlight'] = item['renderPreFlight'];
|
||||
return pre_satis;
|
||||
} else if (!pre_satis && rea_satis) {
|
||||
item['renderFlight'] = item['renderReaFlight'];
|
||||
return rea_satis;
|
||||
} else if (pre_satis && rea_satis) {
|
||||
return pre_satis && rea_satis;
|
||||
return is_satis;
|
||||
} else {
|
||||
return false;
|
||||
let pre_satis = true;
|
||||
let rea_satis = true;
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['preFlight'][key] === filterItems[key]) {
|
||||
pre_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
pre_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (const key in filterItems) {
|
||||
if (filterItems.hasOwnProperty(key) && filterItems[key]) {
|
||||
if (item['reaFlight'][key] === filterItems[key]) {
|
||||
rea_satis = true;
|
||||
continue;
|
||||
} else {
|
||||
rea_satis = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (pre_satis && !rea_satis) {
|
||||
item['renderFlight'] = item['renderPreFlight'];
|
||||
return pre_satis;
|
||||
} else if (!pre_satis && rea_satis) {
|
||||
item['renderFlight'] = item['renderReaFlight'];
|
||||
return rea_satis;
|
||||
} else if (pre_satis && rea_satis) {
|
||||
return pre_satis && rea_satis;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
if (this.FLT_POS === 1) {
|
||||
this.inputFilter(filter_data);
|
||||
} else {
|
||||
this.render_data = filter_data;
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
})
|
||||
if (this.FLT_POS === 1) {
|
||||
this.inputFilter(filter_data);
|
||||
} else {
|
||||
this.render_data = filter_data;
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
}, 10)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -625,6 +623,7 @@ export class MainComponent implements OnInit {
|
||||
this.render_data = filterData;
|
||||
this.row_state = this.render_data.length > 0 ? this.render_data[0] : { renderFlight: {} };
|
||||
this.changeDetectorRef.detectChanges();
|
||||
this.operateSpinServiceService.hideSpin()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user