Commit 714b524f authored by 耿迪迪's avatar 耿迪迪

设备管理 gengdidi

parent d4d3b9f3
......@@ -95,8 +95,6 @@ export const DEVICE_TYPE = {
position: lnglats[i],
map: map,
offset: new AMap.Pixel(-13, -30),
// 设置是否可以拖拽
draggable: true,
cursor: 'move',
// 设置拖拽效果
raiseOnDrag: true
......@@ -122,9 +120,11 @@ export const DEVICE_TYPE = {
}
});
marker.on('dragend', function (e) {
alert(e.lnglat);
editWindow.editForm.longitude = e.lnglat.lng;
editWindow.editForm.latitude = e.lnglat.lat;
console.log(e.lnglat,"rrrr====");
});
//this.markers.push(marker);
this.markers.push(marker);
}
map.setFitView();
......@@ -139,6 +139,24 @@ export const DEVICE_TYPE = {
}
/**
* marker添加拖拽事件
*/
addMarkerDragg(){
for(var i = 0; i < this.markers.length; i++){
this.markers[i].setDraggable(true);
}
}
/**
* marker移除拖拽事件
*/
removeMarkerDragg(){
for(var i = 0; i < this.markers.length; i++){
this.markers[i].setDraggable(false);
}
}
/**
......
......@@ -73,14 +73,17 @@
addDevice(){
this.deviceType = true;
this.gaoMap.mapOperateType = "add";
this.gaoMap.removeMarkerDragg();
},
editDevice(){
this.deviceType = false;
this.gaoMap.mapOperateType = "edit";
this.gaoMap.addMarkerDragg();
},
deleteDevice(){
this.deviceType = false;
this.gaoMap.mapOperateType = "delete";
this.gaoMap.removeMarkerDragg();
},
selectDeviceType(val){
// if("add" == this.operationType){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment