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

设备管理 gengdidi

parent d4d3b9f3
...@@ -95,8 +95,6 @@ export const DEVICE_TYPE = { ...@@ -95,8 +95,6 @@ export const DEVICE_TYPE = {
position: lnglats[i], position: lnglats[i],
map: map, map: map,
offset: new AMap.Pixel(-13, -30), offset: new AMap.Pixel(-13, -30),
// 设置是否可以拖拽
draggable: true,
cursor: 'move', cursor: 'move',
// 设置拖拽效果 // 设置拖拽效果
raiseOnDrag: true raiseOnDrag: true
...@@ -122,9 +120,11 @@ export const DEVICE_TYPE = { ...@@ -122,9 +120,11 @@ export const DEVICE_TYPE = {
} }
}); });
marker.on('dragend', function (e) { 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(); map.setFitView();
...@@ -139,6 +139,24 @@ export const DEVICE_TYPE = { ...@@ -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 @@ ...@@ -73,14 +73,17 @@
addDevice(){ addDevice(){
this.deviceType = true; this.deviceType = true;
this.gaoMap.mapOperateType = "add"; this.gaoMap.mapOperateType = "add";
this.gaoMap.removeMarkerDragg();
}, },
editDevice(){ editDevice(){
this.deviceType = false; this.deviceType = false;
this.gaoMap.mapOperateType = "edit"; this.gaoMap.mapOperateType = "edit";
this.gaoMap.addMarkerDragg();
}, },
deleteDevice(){ deleteDevice(){
this.deviceType = false; this.deviceType = false;
this.gaoMap.mapOperateType = "delete"; this.gaoMap.mapOperateType = "delete";
this.gaoMap.removeMarkerDragg();
}, },
selectDeviceType(val){ selectDeviceType(val){
// if("add" == this.operationType){ // 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