diff --git a/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts b/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts index 953146a..61e854f 100644 --- a/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts +++ b/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts @@ -63,7 +63,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit { planMode//预案类型 xiazai//是否点击下载按钮进来的 //index - ngOnInit() { + async ngOnInit() { //this.index = this.getArrayIndex(this.planTemplateData,'单位概况') this.xiazai=this.route.snapshot.queryParams.xiazai this.haveNew=this.route.snapshot.queryParams.haveNew @@ -79,12 +79,12 @@ export class CreatePlanOnlineFiveComponent implements OnInit { this.selectedItem='封面' this.pattern = 'edit' } - this.getUnitData() - this.getOrganizations() + await this.getUnitData() + await this.getOrganizations() if(this.route.snapshot.queryParams.xiazai=='true'){ - window.setTimeout(()=>{ - this.generatingDoc() - },5000) + window.setTimeout(async ()=>{ + this.generatingDoc() + },32000) } } @@ -123,8 +123,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit { } //得到当前单位所在组织机构的tree型数据 allorganizations: any //所有组织机构 - getpresentOrganization() { - this.newallorganizations = this.allorganizations + async getpresentOrganization() { + let result=new Promise((resolve)=>{ + this.newallorganizations = this.allorganizations this.newallorganizations.forEach(item => { item.children = [] this.newallorganizations.forEach(element => { @@ -133,6 +134,10 @@ export class CreatePlanOnlineFiveComponent implements OnInit { } }); }); + this.dataSource.data = this.tree.toTree(this.treedata); + resolve(this.dataSource.data) + }) + /* this.http.get("/api/Account/Profiles").subscribe( (data: any) => { this.organizationName = data.organizationName @@ -147,18 +152,21 @@ export class CreatePlanOnlineFiveComponent implements OnInit { } } ) */ - this.dataSource.data = this.tree.toTree(this.treedata); + } //获得所有组织机构 - getOrganizations() { - this.http.get('/api/Organizations').subscribe( - (data: any) => { - this.allorganizations = data - this.treedata = this.tree.toTree(data); - this.getpresentOrganization(); - } - ) + async getOrganizations() { + let result=new Promise((resolve)=>{ + this.http.get('/api/Organizations').subscribe( + async (data: any) => { + this.allorganizations = data + this.treedata = this.tree.toTree(data); + await this.getpresentOrganization(); + resolve(data) + } + ) + }) } //清空查询条件数据 clearSearch() { @@ -173,18 +181,22 @@ export class CreatePlanOnlineFiveComponent implements OnInit { let paramsdata: any = { Name: this.route.snapshot.queryParams.unitName || '', } - this.http.get("/api/Companies", { params: paramsdata }).subscribe((data: any) => { - data.items.forEach(element => { - if (element.id == this.route.snapshot.queryParams.companyId) { - this.unitData = element - if(this.planLevel=='5'){ - this.zaixianDr=true + let result=new Promise((resolve)=>{ + this.http.get("/api/Companies", { params: paramsdata }).subscribe((data: any) => { + data.items.forEach(async element => { + if (element.id == this.route.snapshot.queryParams.companyId) { + this.unitData = element + if(this.planLevel=='5'){ + this.zaixianDr=true + } + //console.log('单位列表信息', this.unitData) + await this.getTemplateData() } - //console.log('单位列表信息', this.unitData) - this.getTemplateData() - } - }); + }); + resolve(data) + }) }) + } //获得四周毗邻信息 getArrayIndex(arr, groupName) { @@ -592,7 +604,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit { completed: true, groupName: "单位概况" } - getTemplateData() { + async getTemplateData() { + let result=new Promise((resolve)=>{ this.http.get(`/api/PlanComponents/${this.route.snapshot.queryParams.planId}/WebText`).subscribe((data: any) => { console.log('预案内容', data.webTextData) if(this.route.snapshot.queryParams.planMode==4&&data.webTextData==null){ @@ -710,7 +723,10 @@ export class CreatePlanOnlineFiveComponent implements OnInit { }); console.log(this.planTemplateData) } + resolve(data) }) + }) + } diff --git a/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts b/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts index a0f6771..c820c31 100644 --- a/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts +++ b/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts @@ -1880,7 +1880,7 @@ export class wenbenUpload{ console.log(this.data) window.setTimeout(()=>{ this.dialogRef.close(); - },8000) + },45000) } src=this.sanitizer.bypassSecurityTrustResourceUrl(this.data.src); }