|
@@ -1,6 +1,10 @@
|
|
|
-import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
|
-import { SettingsService } from '@delon/theme';
|
|
|
+import { Component, ChangeDetectionStrategy, Inject } from '@angular/core';
|
|
|
+import { SettingsService, _HttpClient } from '@delon/theme';
|
|
|
import { DepartService } from 'app/services/depart.service';
|
|
|
+import { Router } from '@angular/router';
|
|
|
+import { ReuseTabService } from '@delon/abc';
|
|
|
+import { ITokenService, DA_SERVICE_TOKEN } from '@delon/auth';
|
|
|
+import { StartupService } from '@core';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'layout-header',
|
|
@@ -10,35 +14,70 @@ import { DepartService } from 'app/services/depart.service';
|
|
|
export class HeaderComponent {
|
|
|
searchToggleStatus: boolean;
|
|
|
|
|
|
- constructor(public settings: SettingsService,public departService:DepartService) {}
|
|
|
+ constructor(
|
|
|
+ public settings: SettingsService,
|
|
|
+ public departService: DepartService,
|
|
|
+ private router: Router,
|
|
|
+ public http: _HttpClient,
|
|
|
+ private reuseTabService: ReuseTabService,
|
|
|
+ @Inject(DA_SERVICE_TOKEN) private tokenService: ITokenService,
|
|
|
+ private startupSrv: StartupService,
|
|
|
+ ) {}
|
|
|
ngOnInit(): void {
|
|
|
this.getOrgList();
|
|
|
}
|
|
|
toggleCollapsedSidebar() {
|
|
|
-
|
|
|
this.settings.setLayout('collapsed', !this.settings.layout.collapsed);
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
searchToggleChange() {
|
|
|
-
|
|
|
this.searchToggleStatus = !this.searchToggleStatus;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询全部公司
|
|
|
*/
|
|
|
- orgList=[];
|
|
|
- getOrgList(){
|
|
|
- this.departService.getByType("1").then((response)=>{
|
|
|
- if(response.success){
|
|
|
- this.orgList=response.result;
|
|
|
+ orgList = [];
|
|
|
+ getOrgList() {
|
|
|
+ this.departService.getByType('1').then(response => {
|
|
|
+ if (response.success) {
|
|
|
+ this.orgList = response.result;
|
|
|
+ this.orgList.forEach(element => {
|
|
|
+ if(element.id==this.settings.user.pkOrg){
|
|
|
+ sessionStorage.setItem('pkorg',element.id)
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- aa(){
|
|
|
- // alert(1);
|
|
|
+ /**
|
|
|
+ * 切换公司
|
|
|
+ */
|
|
|
+ departName = '';
|
|
|
+ orgClick(org) {
|
|
|
+ this.departName = org.departName;
|
|
|
+ sessionStorage.setItem('pkorg', org.id);
|
|
|
+ // window.location.reload();
|
|
|
+ // this.reuseTabService.clear();
|
|
|
+ // this.router.navigateByUrl('/dashboard/analysis');
|
|
|
+ // this.router.navigateByUrl("");
|
|
|
+ // this.startupSrv.load().then(() => {
|
|
|
+ // /*
|
|
|
+ // let url = this.tokenService.referrer!.url || '/dashboard/analysis';
|
|
|
+ // if (url.includes('/passport')) url = '/';
|
|
|
+ // this.router.navigateByUrl(url);
|
|
|
+ // this.notification.remove();
|
|
|
+ // this.notification.success("欢迎 "+res.result.userInfo.username,res.result.timeTag+"好!欢迎回来");*/
|
|
|
+
|
|
|
+ // this.router.navigateByUrl('/dashboard/analysis');
|
|
|
+ // });
|
|
|
+ //刷新页面
|
|
|
+ window.location.reload();
|
|
|
+ // 清空路由复用信息
|
|
|
+ this.reuseTabService.clear();
|
|
|
+ this.router.navigateByUrl('/dashboard/analysis');
|
|
|
+ this.router.navigateByUrl("")
|
|
|
+
|
|
|
}
|
|
|
}
|