Browse Source

[完善] 功能分区, 行车路线完善

zhuzhou
陈鹏飞 4 years ago
parent
commit
fa56e68a6e
  1. 3
      src/app/canvas-share-data.service.ts
  2. 28
      src/app/key-unit/function-division-look/function-division.component.ts
  3. 28
      src/app/key-unit/function-division/function-division.component.ts
  4. 2
      src/app/key-unit/router-gis/router-gis.component.html
  5. 9
      src/app/key-unit/router-gis/router-gis.component.scss
  6. 76
      src/app/key-unit/router-gis/router-gis.component.ts
  7. 6
      src/app/ui/collection-tools/collection-tools.component.html
  8. 12
      src/app/ui/collection-tools/collection-tools.component.ts

3
src/app/canvas-share-data.service.ts

@ -20,6 +20,7 @@ export class CanvasShareDataService {
isChange:boolean = false; // 数据 是否改动
selectTemplateData:any; // 选择当前 模板数据
isMultiSelect:boolean = false; // 单选/多选 模板图标
// 总平面图/建筑 楼层
selectStorey: any = {area: '', details: ''}; // 选择当前 楼层 数据
@ -29,7 +30,7 @@ export class CanvasShareDataService {
// 处置 节点
allDisposalNode: any = []; // 所有 处置节点
allNodeMarkers: any; // 灾情 标签信息
allNodeMarkers: any = { highlightMarkers:{}, markers:{} }; // 灾情 标签信息
selectPanelPoint: DisposalNodeData = new DisposalNodeData(); // 当前数据节点
selectPanelPointBaseData: any = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''}; // 当前 数据节点 对应 父级节点
customizeDisposalNode:any; // 新建 自定义数据节点 底图+名称

28
src/app/key-unit/function-division-look/function-division.component.ts

@ -129,21 +129,45 @@ export class FunctionDivisionLookComponent implements OnInit {
})
}
noDataList = [] //没有 创建功能分区 的建筑
//获得所有建筑的功能分区
getAllBuildingFunctionalZoning () {
this.selectBuildingFunctionalZoning = []
this.allBuildingFunctionalZoning = []
this.allBuilding.forEach(element => {
this.noDataList = []
this.allBuilding.forEach((element,index) => {
let data={buildingId: element.id}
this.http.get(`/api/BuildingFunctionalDivisions`,{params:data}).subscribe((data:any)=>{
if (data.length) {
element.functionalZoning = data
this.selectBuildingFunctionalZoning.push([]) //拥有建筑功能分区的提前push空数组
this.allBuildingFunctionalZoning.push(element) }
this.allBuildingFunctionalZoning.push(element)
this.noDataList.push(true)
} else {
this.noDataList.push(false)
}
if (this.noDataList.length === this.allBuilding.length) { this.addVoluntarilyPartition() }
})
});
}
// 没有 创建 建筑功能分区时 自动创建
addVoluntarilyPartition () {
let isFalse = []
this.noDataList.forEach(item=> { item===false? isFalse.push(1) : null })
if (isFalse.length === this.allBuilding.length) { //没有 建筑功能分区时
let data = {
buildingId: this.allBuilding[0].id,
region: "",
area: 0,
details: ""
}
this.http.post('/api/BuildingFunctionalDivisions',data,{params:{companyId : this.route.snapshot.queryParams.id}}).subscribe(data=>{
this.getAllBuilding()
})
} //if
}
//封装函数刷新当前建筑功能分区
updateCurrent (e,index) {
let data= {buildingId: e.id}

28
src/app/key-unit/function-division/function-division.component.ts

@ -131,21 +131,45 @@ export class FunctionDivisionComponent implements OnInit {
})
}
noDataList = [] //没有 创建功能分区 的建筑
//获得所有建筑的功能分区
getAllBuildingFunctionalZoning () {
this.selectBuildingFunctionalZoning = []
this.allBuildingFunctionalZoning = []
this.allBuilding.forEach(element => {
this.noDataList = []
this.allBuilding.forEach((element,index) => {
let data={buildingId: element.id}
this.http.get(`/api/BuildingFunctionalDivisions`,{params:data}).subscribe((data:any)=>{
if (data.length) {
element.functionalZoning = data
this.selectBuildingFunctionalZoning.push([]) //拥有建筑功能分区的提前push空数组
this.allBuildingFunctionalZoning.push(element) }
this.allBuildingFunctionalZoning.push(element)
this.noDataList.push(true)
} else {
this.noDataList.push(false)
}
if (this.noDataList.length === this.allBuilding.length) { this.addVoluntarilyPartition() }
})
});
}
// 没有 创建 建筑功能分区时 自动创建
addVoluntarilyPartition () {
let isFalse = []
this.noDataList.forEach(item=> { item===false? isFalse.push(1) : null })
if (isFalse.length === this.allBuilding.length) { //没有 建筑功能分区时
let data = {
buildingId: this.allBuilding[0].id,
region: "",
area: 0,
details: ""
}
this.http.post('/api/BuildingFunctionalDivisions',data,{params:{companyId : this.route.snapshot.queryParams.id}}).subscribe(data=>{
this.getAllBuilding()
})
} //if
}
//封装函数刷新当前建筑功能分区
updateCurrent (e,index) {
let data= {buildingId: e.id}

2
src/app/key-unit/router-gis/router-gis.component.html

@ -60,4 +60,6 @@
</div>
<!-- 导航路线 -->
<button class="submitRouter" mat-raised-button color='primary' (click)='submitRouter()'>保存路线</button>
</div>

9
src/app/key-unit/router-gis/router-gis.component.scss

@ -109,4 +109,11 @@
.routeGISPublicIcon { position: absolute; color: #fff; font-size: 14px; } //导航 定位部分公共样式
//选择路线 方案 button
.routeType { margin: 0 10px; outline: none; border: none; background-color: transparent; font-size: 14px; font-weight: 550; color: rgb(122, 116, 116); }
.selectRouteType { color: #0080FF; }
.selectRouteType { color: #0080FF; }
//保存
.submitRouter {
position: absolute;
top: 15px;
right: 30px;
}

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

@ -1,5 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Component, EventEmitter, NgZone, OnInit, Output } from '@angular/core';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router';
declare var AMap: any;
@Component({
@ -9,14 +11,75 @@ declare var AMap: any;
})
export class RouterGISComponent implements OnInit {
@Output() onCustomEvent: EventEmitter<any> = new EventEmitter();//创建实力
constructor(public _ngZone:NgZone,public snackBar: MatSnackBar,) { }
constructor(public _ngZone:NgZone,public snackBar: MatSnackBar,private http:HttpClient,private route:ActivatedRoute,) { }
ngOnInit(): void {
this.getCompanyData()
}
ngAfterViewInit(): void {
window.setTimeout(()=>{
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]
}
})
}
//保存 路线
submitRouter () {
if (this.startCoordinate && this.endCoordinate && this.routeStart && this.routeEnd) {
let start = {x:null, y:null}
let end = {x:null, y:null}
if (this.startCoordinate instanceof Array) {
start.x = this.startCoordinate[0]
start.y = this.startCoordinate[1]
} else {
start.x = this.startCoordinate.lng
start.y = this.startCoordinate.lat
}
if (this.endCoordinate instanceof Array) {
end.x = this.endCoordinate[0]
end.y = this.endCoordinate[1]
} else {
end.x = this.endCoordinate.lng
end.y = this.endCoordinate.lat
}
let params = {
id: this.route.snapshot.queryParams.id,
driveRouteStartPoint: start,
driveRouteStartName: this.routeStart,
driveRouteEndPoint: end,
driveRouteEndName: this.routeEnd,
}
this.http.put(`/api/Companies/${this.route.snapshot.queryParams.id}`,params).subscribe(data=>{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
})
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请先规划路线','确定',config);
}
}
//地图初始化
mapInit () {
let that = this
@ -31,6 +94,9 @@ export class RouterGISComponent implements OnInit {
layers:[layer], //当只想显示标准图层时layers属性可缺省,
});
that.map.setCity('上海市');
AMap.plugin('AMap.Driving', function() {
that.startCoordinate && that.endCoordinate? that.queryGISRoute() : null
})
}
map:any; //地图实例
@ -41,6 +107,9 @@ export class RouterGISComponent implements OnInit {
timeout:any; //延时器
routeGIS:any; //查询结果 规划路线
selectType:boolean = true; //路线选择 推荐方案/躲避用拥堵
routes:any = { distance: 0, time: 0, steps: [], };//导航查询结果 路线规划
startCoordinate:any//开始坐标
endCoordinate:any//结束坐标
//输入框 输入事件
routeChange (e) {
@ -56,7 +125,6 @@ export class RouterGISComponent implements OnInit {
var autoComplete = new AMap.Autocomplete(autoOptions);
autoComplete.search(keywords, function(status, result) {
if (result && result.tips && result.tips.length) { //搜索到数据时
that._ngZone.run(()=>{
if(e == 0){
that.routeStartList = result.tips
@ -113,10 +181,6 @@ export class RouterGISComponent implements OnInit {
this.endCoordinate = data2
}
routes:any = { distance: 0, time: 0, steps: [], };//导航查询结果 路线规划
startCoordinate:any//开始坐标
endCoordinate:any//结束坐标
//导航查询
queryGISRoute () {
if (this.startCoordinate && this.endCoordinate) {

6
src/app/ui/collection-tools/collection-tools.component.html

@ -14,9 +14,9 @@
想定作业名称<mat-icon>visibility</mat-icon>
</span>
<!-- <span class="marginLeftRight">
<mat-checkbox color="primary"></mat-checkbox> 多选
</span> -->
<span class="marginLeftRight">
<mat-checkbox color="primary" [(ngModel)]="canvasData.isMultiSelect"></mat-checkbox> 多选
</span>
<span class="marginLeftRight">
<mat-checkbox color="primary" [(ngModel)]="isShowLegend" (change)='changeLegend($event)' [disabled]='this.canvasData.selectPanelPoint.BackgroundImageUrl'></mat-checkbox> 显示图例
</span>

12
src/app/ui/collection-tools/collection-tools.component.ts

@ -2436,6 +2436,12 @@ export class CollectionToolsComponent implements OnInit {
this.selectingSitePlan = this.sitePlanData[index] || {}
this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据
this.selectSitePlanIndex = index
if (index == -1) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('匹配楼层已被删除','确定',config);
}
Promise.all([fireData,planData]).then((res)=>{
this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据
@ -2452,6 +2458,12 @@ export class CollectionToolsComponent implements OnInit {
this.selectingSitePlan = this.sitePlanData[index] || {}
this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据
this.selectSitePlanIndex = index
if (index == -1) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('匹配楼层已被删除','确定',config);
}
Promise.all([fireData,planData]).then((res)=>{
this.getBuildingStorey(this.selectingSitePlan) //获取 建筑 楼层数据

Loading…
Cancel
Save