|
|
@ -17,8 +17,14 @@ import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-scor |
|
|
|
import { MaskLayerService } from 'src/app/mask-layer.service'; |
|
|
|
import { MaskLayerService } from 'src/app/mask-layer.service'; |
|
|
|
import * as ObjectID from 'bson-objectid'; |
|
|
|
import * as ObjectID from 'bson-objectid'; |
|
|
|
import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem'; |
|
|
|
import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem'; |
|
|
|
|
|
|
|
declare var AMap: any |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
declare global { |
|
|
|
|
|
|
|
interface Window { |
|
|
|
|
|
|
|
deleteMarker: any; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
declare var AMap:any |
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-collection-tools-plan', |
|
|
|
selector: 'app-collection-tools-plan', |
|
|
|
templateUrl: './collection-tools.component.html', |
|
|
|
templateUrl: './collection-tools.component.html', |
|
|
@ -28,7 +34,7 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
@ViewChild('canvas') canvas: WorkingAreaComponent; //父组件中获得子组件的引用
|
|
|
|
@ViewChild('canvas') canvas: WorkingAreaComponent; //父组件中获得子组件的引用
|
|
|
|
|
|
|
|
|
|
|
|
constructor(public _ngZone: NgZone, private maskLayerService: MaskLayerService, private tabbarService: TabbarAndScoreService, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, private element: ElementRef, public canvasData: CanvasShareDataService, private router: Router, private route: ActivatedRoute) { } |
|
|
|
constructor(public renderer2: Renderer2, public _ngZone: NgZone, private maskLayerService: MaskLayerService, private tabbarService: TabbarAndScoreService, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, private element: ElementRef, public canvasData: CanvasShareDataService, private router: Router, private route: ActivatedRoute) { } |
|
|
|
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; |
|
|
|
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; |
|
|
|
// tree配置
|
|
|
|
// tree配置
|
|
|
|
private _transformer = (node, level: number) => {//要给渲染节点传那些属性参数
|
|
|
|
private _transformer = (node, level: number) => {//要给渲染节点传那些属性参数
|
|
|
@ -80,6 +86,7 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
gallery//viewerJs实例
|
|
|
|
gallery//viewerJs实例
|
|
|
|
//设置属性框
|
|
|
|
//设置属性框
|
|
|
|
setAssetsProperty(obj) { |
|
|
|
setAssetsProperty(obj) { |
|
|
|
|
|
|
|
console.log(obj) |
|
|
|
//初始化viewerJs实例
|
|
|
|
//初始化viewerJs实例
|
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
obj.PropertyInfos.forEach(item => { |
|
|
|
obj.PropertyInfos.forEach(item => { |
|
|
@ -465,11 +472,12 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
multipleAssetData: any//当前多选的素材
|
|
|
|
multipleAssetData: any//当前多选的素材
|
|
|
|
firstMultipleAssetData: any//当前多选的第一个素材
|
|
|
|
firstMultipleAssetData: any//当前多选的第一个素材
|
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
|
|
|
|
|
|
|
|
let _this = this |
|
|
|
let _this = this |
|
|
|
AxMessageSystem.addListener('selectionChanged', () => { |
|
|
|
AxMessageSystem.addListener('selectionChanged', () => { |
|
|
|
if (this.canvas.selection.size() == 1) {//如果是单选
|
|
|
|
if (this.canvas.selection.size() == 1) {//如果是单选
|
|
|
|
this.isMultipleAsset = false |
|
|
|
this.isMultipleAsset = false |
|
|
|
// console.log('单选',this.canvas.selection.first().assetData)
|
|
|
|
console.log('单选', this.canvas.selection.first().assetData) |
|
|
|
this.setAssetsProperty(this.canvas.selection.first().assetData) |
|
|
|
this.setAssetsProperty(this.canvas.selection.first().assetData) |
|
|
|
} else if (this.canvas.selection.size()) { |
|
|
|
} else if (this.canvas.selection.size()) { |
|
|
|
this.isShowProperty = true |
|
|
|
this.isShowProperty = true |
|
|
@ -1227,6 +1235,21 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
this.canvas.setHighlight(iconHighLightArr) |
|
|
|
this.canvas.setHighlight(iconHighLightArr) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
hideAllTreenode: boolean = true; //全部显示/隐藏tree节点
|
|
|
|
|
|
|
|
toggoleAllTreenode() { |
|
|
|
|
|
|
|
this.hideAllTreenode = !this.hideAllTreenode |
|
|
|
|
|
|
|
let list = [] |
|
|
|
|
|
|
|
this.allFireElements.forEach(element => { |
|
|
|
|
|
|
|
if (element.isTemplate) { this.hideAllTreenode ? element.isLook = false : element.isLook = true } |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.treeControl.dataNodes.forEach(item => { |
|
|
|
|
|
|
|
this.hideAllTreenode ? item.isLook = false : item.isLook = true |
|
|
|
|
|
|
|
item.level === 0 ? list.push(item) : null |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
list.forEach(item => { |
|
|
|
|
|
|
|
this.clickLookItem(item) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//点击数节点的显示隐藏icon
|
|
|
|
//点击数节点的显示隐藏icon
|
|
|
|
clickLookItem(node) { |
|
|
|
clickLookItem(node) { |
|
|
@ -1301,7 +1324,7 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
//封装 刷新 tree 数据
|
|
|
|
//封装 刷新 tree 数据
|
|
|
|
async renovateTreeData(isRefresh: boolean = true) { |
|
|
|
async renovateTreeData(isRefresh: boolean = true) { |
|
|
|
// this.allFireElements[this.allFireElements.length-1].children = []
|
|
|
|
// this.allFireElements[this.allFireElements.length-1].children = []
|
|
|
|
if(!this.selectingSitePlan.isGis){ |
|
|
|
if (!this.selectingSitePlan.isGis) { |
|
|
|
isRefresh ? await this.canvas.refresh() : null |
|
|
|
isRefresh ? await this.canvas.refresh() : null |
|
|
|
this.canvas.setNameVisible(this.basicInfo, 0) |
|
|
|
this.canvas.setNameVisible(this.basicInfo, 0) |
|
|
|
this.canvas.setNameVisible(this.wantToWork, 1) |
|
|
|
this.canvas.setNameVisible(this.wantToWork, 1) |
|
|
@ -1309,34 +1332,37 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
isRefresh ? this.canvasData.isChange = false : null //服务中 数据是否改动 改为false
|
|
|
|
isRefresh ? this.canvasData.isChange = false : null //服务中 数据是否改动 改为false
|
|
|
|
isRefresh ? this.isShowProperty = true : null |
|
|
|
isRefresh ? this.isShowProperty = true : null |
|
|
|
isRefresh ? this.isShowAttribute = true : null |
|
|
|
isRefresh ? this.isShowAttribute = true : null |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
//加载高德地图
|
|
|
|
//加载高德地图
|
|
|
|
this.toLoadGis() |
|
|
|
this.toLoadGis() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// let beforeOneId = this.selectingSitePlan.id || '' //当前 选中 平面图 楼层/区域 id
|
|
|
|
let beforeOneId = this.selectingSitePlan.id || '' //当前 选中 平面图 楼层/区域 id
|
|
|
|
// let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据
|
|
|
|
let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据
|
|
|
|
// let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //当前 楼层 数据
|
|
|
|
let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //当前 楼层 数据
|
|
|
|
|
|
|
|
|
|
|
|
// for(let key in companyBuildingData.data){
|
|
|
|
for(let key in companyBuildingData.data){ |
|
|
|
// if (companyBuildingData.data[key].FloorId === beforeOneId) { //处理 单位/建筑 数据是否归于当前楼层下
|
|
|
|
if (companyBuildingData.data[key].FloorId === beforeOneId) { //处理 单位/建筑 数据是否归于当前楼层下
|
|
|
|
// storeyData.data[key] = companyBuildingData.data[key]
|
|
|
|
storeyData.data[key] = companyBuildingData.data[key] |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// for(let key in storeyData.data){ //筛选数据 没有匹配全部放入到 其他 数组
|
|
|
|
for(let key in storeyData.data){ //筛选数据 没有匹配全部放入到 其他 数组
|
|
|
|
// let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId )
|
|
|
|
let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId ) |
|
|
|
// if (!noMatch && storeyData.data[key].Id != "图例") {
|
|
|
|
if (!noMatch && storeyData.data[key].Id != "图例") { |
|
|
|
// this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key])
|
|
|
|
this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// this.handleTreeData(storeyData) //处理tree数据结构
|
|
|
|
this.handleTreeData(storeyData) //处理tree数据结构
|
|
|
|
} |
|
|
|
} |
|
|
|
map:any |
|
|
|
map: any |
|
|
|
toLoadGis(){ |
|
|
|
toLoadGis() { |
|
|
|
this.map = new AMap.Map('container', { |
|
|
|
this.map = new AMap.Map('planContainer', { |
|
|
|
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D',
|
|
|
|
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D',
|
|
|
|
zoom:11, //初始化地图层级
|
|
|
|
zoom: 11, //初始化地图层级
|
|
|
|
center: [116.397428, 39.90923] //初始化地图中心点
|
|
|
|
}); |
|
|
|
|
|
|
|
this.map.setCity('上海市'); |
|
|
|
|
|
|
|
this.map.on('click', (e) => { |
|
|
|
|
|
|
|
this.showInfoClick(e) |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1388,15 +1414,15 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
//获取总平面图
|
|
|
|
//获取总平面图
|
|
|
|
getSitePlan() { |
|
|
|
getSitePlan() { |
|
|
|
// let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //获取单位下 消防要素
|
|
|
|
let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //获取单位下 消防要素
|
|
|
|
let planData = this.getSitePlanCompanyData() //获取 单位 数据
|
|
|
|
let planData = this.getSitePlanCompanyData() //获取 单位 数据
|
|
|
|
this.http.get('/api/SitePlans', { params: this.params }).subscribe(data => { |
|
|
|
this.http.get('/api/SitePlans', { params: this.params }).subscribe(data => { |
|
|
|
this.sitePlanData = data |
|
|
|
this.sitePlanData = data |
|
|
|
this.selectingSitePlan = this.sitePlanData[0] || {} |
|
|
|
this.selectingSitePlan = this.sitePlanData[0] || {} |
|
|
|
this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据
|
|
|
|
this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据
|
|
|
|
if(this.sitePlanData.length != 0 && this.sitePlanData[0].isGis){ |
|
|
|
if (this.sitePlanData.length != 0 && this.sitePlanData[0].isGis) { |
|
|
|
this.isGis = true |
|
|
|
this.isGis = true |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
this.isGis = false |
|
|
|
this.isGis = false |
|
|
|
} |
|
|
|
} |
|
|
|
this.selectSitePlanIndex = 0 |
|
|
|
this.selectSitePlanIndex = 0 |
|
|
@ -1411,7 +1437,7 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
//获取建筑 楼层/区域 废弃
|
|
|
|
//获取建筑 楼层/区域 废弃
|
|
|
|
getBuildingSitePlan(item) { |
|
|
|
getBuildingSitePlan(item) { |
|
|
|
let params = { buildingId: item.id } |
|
|
|
let params = { buildingId: item.id } |
|
|
|
// let fireData = this.getFireElements(item.buildingTypes[0].id || '') //获取建筑下 消防要素
|
|
|
|
let fireData = this.getFireElements(item.buildingTypes[0].id || '') //获取建筑下 消防要素
|
|
|
|
let planData = this.getBuildingData(params) //获取 建筑 数据
|
|
|
|
let planData = this.getBuildingData(params) //获取 建筑 数据
|
|
|
|
this.http.get('/api/BuildingAreas', { params }).subscribe(data => { |
|
|
|
this.http.get('/api/BuildingAreas', { params }).subscribe(data => { |
|
|
|
this.sitePlanData = data |
|
|
|
this.sitePlanData = data |
|
|
@ -1452,6 +1478,7 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
getSitePlanCompanyData() { |
|
|
|
getSitePlanCompanyData() { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
this.http.get('/api/CompanyData', { params: this.params }).subscribe((data: any) => { |
|
|
|
this.http.get('/api/CompanyData', { params: this.params }).subscribe((data: any) => { |
|
|
|
|
|
|
|
console.log('单位数据', data) |
|
|
|
this.canvasData.originalcompanyBuildingData = data || {} // 单位原数据
|
|
|
|
this.canvasData.originalcompanyBuildingData = data || {} // 单位原数据
|
|
|
|
this.canvasData.originalcompanyBuildingData.data ? this.canvasData.originalcompanyBuildingData.data = JSON.parse(this.canvasData.originalcompanyBuildingData.data) : this.canvasData.originalcompanyBuildingData.data = {} |
|
|
|
this.canvasData.originalcompanyBuildingData.data ? this.canvasData.originalcompanyBuildingData.data = JSON.parse(this.canvasData.originalcompanyBuildingData.data) : this.canvasData.originalcompanyBuildingData.data = {} |
|
|
|
this.canvasData.originalcompanyBuildingData.version = "2.0" |
|
|
|
this.canvasData.originalcompanyBuildingData.version = "2.0" |
|
|
@ -1465,6 +1492,7 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
getSitePlanStorey(e) { |
|
|
|
getSitePlanStorey(e) { |
|
|
|
let params = { sitePlanId: e.id } |
|
|
|
let params = { sitePlanId: e.id } |
|
|
|
this.http.get(`/api/SitePlanData`, { params }).subscribe((data: any) => { |
|
|
|
this.http.get(`/api/SitePlanData`, { params }).subscribe((data: any) => { |
|
|
|
|
|
|
|
console.log('平面图数据', data) |
|
|
|
this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据
|
|
|
|
this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据
|
|
|
|
this.canvasData.originaleveryStoreyData.data ? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {} |
|
|
|
this.canvasData.originaleveryStoreyData.data ? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {} |
|
|
|
this.canvasData.originaleveryStoreyData.version = "2.0" |
|
|
|
this.canvasData.originaleveryStoreyData.version = "2.0" |
|
|
@ -1499,12 +1527,12 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//点击选中 平面图 楼层/区域 时
|
|
|
|
//点击选中 平面图 楼层/区域 时
|
|
|
|
isGis:boolean |
|
|
|
isGis: boolean |
|
|
|
selectSitePlan(item, index) { |
|
|
|
selectSitePlan(item, index) { |
|
|
|
console.log('点击楼层',item) |
|
|
|
console.log('点击楼层', item) |
|
|
|
if(item.isGis){ |
|
|
|
if (item.isGis) { |
|
|
|
this.isGis = true |
|
|
|
this.isGis = true |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
this.isGis = false |
|
|
|
this.isGis = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1654,7 +1682,7 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
//旋转底图
|
|
|
|
//旋转底图
|
|
|
|
revolveImg(item) { |
|
|
|
revolveImg(item) { |
|
|
|
if(item.isGis){ |
|
|
|
if (item.isGis) { |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
config.verticalPosition = 'top'; |
|
|
|
config.verticalPosition = 'top'; |
|
|
|
config.duration = 3000 |
|
|
|
config.duration = 3000 |
|
|
@ -1744,7 +1772,7 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
//复制图层 平面图 楼层/区域
|
|
|
|
//复制图层 平面图 楼层/区域
|
|
|
|
duplicateLayer(item) { |
|
|
|
duplicateLayer(item) { |
|
|
|
|
|
|
|
|
|
|
|
if(item.isGis){ |
|
|
|
if (item.isGis) { |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
config.verticalPosition = 'top'; |
|
|
|
config.verticalPosition = 'top'; |
|
|
|
config.duration = 3000 |
|
|
|
config.duration = 3000 |
|
|
@ -1938,11 +1966,102 @@ export class CollectionToolsPlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
//点击选中素材库图片时
|
|
|
|
//点击选中素材库图片时
|
|
|
|
selectImg(item, items, index) { |
|
|
|
selectImg(item, items, index) { |
|
|
|
|
|
|
|
//如果是gis
|
|
|
|
this.selectLibrary = item.name |
|
|
|
this.selectLibrary = item.name |
|
|
|
this.selectImage = items |
|
|
|
this.selectImage = items |
|
|
|
|
|
|
|
// console.log('选中图片',this.selectImage)
|
|
|
|
this.selectImageIndex = index |
|
|
|
this.selectImageIndex = index |
|
|
|
this.canvasData.selectTemplateData = items |
|
|
|
if (this.isGis) { |
|
|
|
this.canvas.beginPaint() |
|
|
|
console.log(this.map) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.canvasData.selectTemplateData = items |
|
|
|
|
|
|
|
this.canvas.beginPaint() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//存储当前gis平面图的所有图标信息
|
|
|
|
|
|
|
|
planData = [] |
|
|
|
|
|
|
|
//存储当前gis平面图的所有marker信息
|
|
|
|
|
|
|
|
planDataMarkers = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//地图单击事件
|
|
|
|
|
|
|
|
clickId |
|
|
|
|
|
|
|
showInfoClick(e) { |
|
|
|
|
|
|
|
if (!this.selectImage.imageUrl) { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let id = ObjectID.default.generate() |
|
|
|
|
|
|
|
// console.log('点击了地图', e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 新增点标记
|
|
|
|
|
|
|
|
// 点标记显示内容,HTML要素字符串
|
|
|
|
|
|
|
|
let markerContent = '' + |
|
|
|
|
|
|
|
'<div class="custom-content-marker" id="xxxx">' + |
|
|
|
|
|
|
|
`<img src="${this.selectImage.imageUrl}">` + |
|
|
|
|
|
|
|
`<div class="close-btn" id="${id}" onclick='deleteMarker()'>X</div>` + |
|
|
|
|
|
|
|
'</div>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将 icon 传入 marker
|
|
|
|
|
|
|
|
let startMarker = new AMap.Marker({ |
|
|
|
|
|
|
|
position: new AMap.LngLat(e.lnglat.lng, e.lnglat.lat), |
|
|
|
|
|
|
|
// 将 html 传给 content
|
|
|
|
|
|
|
|
content: markerContent, |
|
|
|
|
|
|
|
// 以 icon 的 [center bottom] 为原点
|
|
|
|
|
|
|
|
offset: new AMap.Pixel(-13, -30), |
|
|
|
|
|
|
|
draggable: true, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startMarker.id = id |
|
|
|
|
|
|
|
startMarker.on('click', (e) => { |
|
|
|
|
|
|
|
this.clickId = e.target.id |
|
|
|
|
|
|
|
for (let index = 0; index < this.planData.length; index++) { |
|
|
|
|
|
|
|
const item = this.planData[index]; |
|
|
|
|
|
|
|
if (item.id == e.target.id) { |
|
|
|
|
|
|
|
this.setAssetsProperty(item) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
startMarker.on('dragend', (e) => { |
|
|
|
|
|
|
|
console.log('拖拽完成', e) |
|
|
|
|
|
|
|
this.clickId = e.target.id |
|
|
|
|
|
|
|
for (let index = 0; index < this.planData.length; index++) { |
|
|
|
|
|
|
|
const item = this.planData[index]; |
|
|
|
|
|
|
|
if (item.id == e.target.id) { |
|
|
|
|
|
|
|
//修改最终坐标数据
|
|
|
|
|
|
|
|
item.point = { x: e.lnglat.lng, y: e.lnglat.lat } |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将图标数据添加
|
|
|
|
|
|
|
|
let itemData = JSON.parse(JSON.stringify(this.selectImage)) |
|
|
|
|
|
|
|
itemData.id = id |
|
|
|
|
|
|
|
itemData.point = { x: e.lnglat.lng, y: e.lnglat.lat } |
|
|
|
|
|
|
|
this.planData.push(itemData) |
|
|
|
|
|
|
|
//将marker点添加
|
|
|
|
|
|
|
|
this.planDataMarkers.push(startMarker) |
|
|
|
|
|
|
|
this.map.add(startMarker); |
|
|
|
|
|
|
|
//点击关闭按钮
|
|
|
|
|
|
|
|
window.deleteMarker = () => { |
|
|
|
|
|
|
|
//清除地图标点
|
|
|
|
|
|
|
|
this.planDataMarkers.forEach((element, index) => { |
|
|
|
|
|
|
|
if (element.id == this.clickId) { |
|
|
|
|
|
|
|
this.planDataMarkers[index].setMap(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//删除指定数据
|
|
|
|
|
|
|
|
for (let index = 0; index < this.planData.length; index++) { |
|
|
|
|
|
|
|
const item = this.planData[index]; |
|
|
|
|
|
|
|
if (item.id == this.clickId) { |
|
|
|
|
|
|
|
this.planData.splice(index, 1) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|