|
|
|
@ -14,29 +14,34 @@ 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(()=>{ |
|
|
|
|
this.mapInit() |
|
|
|
|
async.then(res=>{ |
|
|
|
|
this.mapInit() |
|
|
|
|
}) |
|
|
|
|
},0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取单位 信息
|
|
|
|
|
getCompanyData () { |
|
|
|
|
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 |
|
|
|
|
this.startCoordinate = [data.driveRouteStartPoint.x,data.driveRouteStartPoint.y] |
|
|
|
|
} |
|
|
|
|
if (data.driveRouteEndPoint && data.driveRouteEndPoint.x && data.driveRouteEndPoint.y && data.driveRouteEndName) { //结束坐标 名称
|
|
|
|
|
this.routeEnd = data.driveRouteEndName |
|
|
|
|
this.endCoordinate = [data.driveRouteEndPoint.x,data.driveRouteEndPoint.y] |
|
|
|
|
} else if (data.location && data.location.x && data.location.y) { |
|
|
|
|
this.routeEnd = data.name |
|
|
|
|
this.endCoordinate = [data.location.x,data.location.y] |
|
|
|
|
} |
|
|
|
|
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 |
|
|
|
|
this.startCoordinate = [data.driveRouteStartPoint.x,data.driveRouteStartPoint.y] |
|
|
|
|
} |
|
|
|
|
if (data.driveRouteEndPoint && data.driveRouteEndPoint.x && data.driveRouteEndPoint.y && data.driveRouteEndName) { //结束坐标 名称
|
|
|
|
|
this.routeEnd = data.driveRouteEndName |
|
|
|
|
this.endCoordinate = [data.driveRouteEndPoint.x,data.driveRouteEndPoint.y] |
|
|
|
|
} else if (data.location && data.location.x && data.location.y) { |
|
|
|
|
this.routeEnd = data.name |
|
|
|
|
this.endCoordinate = [data.location.x,data.location.y] |
|
|
|
|
} |
|
|
|
|
resolve('success') |
|
|
|
|
}) //http
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|