Browse Source

[修正] 修正GIS路线函数执行顺序BUG

zhuzhou
陈鹏飞 4 years ago
parent
commit
388e0e55bd
  1. 7
      src/app/key-unit/router-gis/router-gis.component.ts

7
src/app/key-unit/router-gis/router-gis.component.ts

@ -14,17 +14,20 @@ export class RouterGISComponent implements OnInit {
constructor(public _ngZone:NgZone,public snackBar: MatSnackBar,private http:HttpClient,private route:ActivatedRoute,) { }
ngOnInit(): void {
this.getCompanyData()
}
ngAfterViewInit(): void {
let async = this.getCompanyData()
window.setTimeout(()=>{
async.then(res=>{
this.mapInit()
})
},0)
}
//获取单位 信息
getCompanyData () {
return new Promise((resolve,reject)=>{
this.http.get(`/api/Companies/${this.route.snapshot.queryParams.id}`).subscribe((data:any)=>{
if (data.driveRouteStartPoint && data.driveRouteStartPoint.x && data.driveRouteStartPoint.y && data.driveRouteStartName) { //开始坐标 名称
this.routeStart = data.driveRouteStartName
@ -37,6 +40,8 @@ export class RouterGISComponent implements OnInit {
this.routeEnd = data.name
this.endCoordinate = [data.location.x,data.location.y]
}
resolve('success')
}) //http
})
}

Loading…
Cancel
Save