This commit is contained in:
Fuhui Peng (c) 2017-08-18 17:42:50 +08:00
parent 7393843bd0
commit 45c4796486

View File

@ -47,7 +47,6 @@ import { StatisticHandler } from '../shared/statictics/statistic-handler.service
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ProjectComponent implements OnInit, OnDestroy {
selecteType:number = 0;
changedProjects: Project[];
projectTypes = ProjectTypes;
@ -64,6 +63,15 @@ export class ProjectComponent implements OnInit, OnDestroy {
subscription: Subscription;
loading: boolean = true;
get selecteType (): number {
return this.currentFilteredType;
}
set selecteType(_project: number) {
if (window.sessionStorage) {
window.sessionStorage['projectTypeValue'] = _project;
}
}
constructor(
private projectService: ProjectService,
private messageHandlerService: MessageHandlerService,
@ -99,6 +107,10 @@ export class ProjectComponent implements OnInit, OnDestroy {
}
ngOnInit(): void {
if (window.sessionStorage && window.sessionStorage['projectTypeValue'] && window.sessionStorage['fromDetails']) {
this.currentFilteredType = +window.sessionStorage['projectTypeValue'];
window.sessionStorage.removeItem('fromDetails');
}
}
ngOnDestroy(): void {
@ -122,12 +134,6 @@ export class ProjectComponent implements OnInit, OnDestroy {
retrieve(state?: State): void {
this.projectName = "";
if (window.sessionStorage && window.sessionStorage['projectTypeValue'] && window.sessionStorage['fromDetails']) {
this.currentFilteredType = +window.sessionStorage['projectTypeValue'];
this.selecteType = this.currentFilteredType;
window.sessionStorage.removeItem('fromDetails');
}
if (this.currentFilteredType !== 0) {
this.getProjects('', this.currentFilteredType - 1);
return;
@ -186,9 +192,6 @@ export class ProjectComponent implements OnInit, OnDestroy {
} else {
this.getProjects("", this.currentFilteredType - 1);
}
if (window.sessionStorage) {
window.sessionStorage['projectTypeValue'] = this.currentFilteredType;
}
}
}
@ -206,11 +209,6 @@ export class ProjectComponent implements OnInit, OnDestroy {
} else {
this.getProjects("", this.currentFilteredType - 1);
}
this.selecteType = this.currentFilteredType;
if (window.sessionStorage) {
window.sessionStorage['projectTypeValue'] = this.currentFilteredType;
}
},
error => this.messageHandlerService.handleError(error)
);