Commit 0212b640 by 前端

修复bug

1 parent 77dc9a43
......@@ -39,7 +39,7 @@
<el-form-item label="详细地址">
<div class="device_item">
<el-input
ref="addressInput"
ref="addressInput"
v-model.trim="form.address"
id="tipInput"
maxlength="50"
......@@ -250,6 +250,7 @@ export default {
_this.mapLoading = false;
window.AMap = AMap;
_this.map = mapService.init("map", { zoom: 12 });
_this.mouseTool = new AMap.MouseTool(_this.map);
var autoComplete = new AMap.AutoComplete({
input: "tipInput",
});
......@@ -257,7 +258,7 @@ export default {
console.log(e);
let poi = e.poi || {};
_this.poi = poi;
_this.$refs.addressInput.focus()
_this.$refs.addressInput.focus();
});
})
.catch((error) => {
......@@ -270,7 +271,7 @@ export default {
getAddress() {
let _this = this;
let poi = this.poi;
_this.clearMap()
_this.clearMap();
if (poi && poi.location) {
_this.autoCenterMarker = mapService.createMarker(poi.location);
_this.map.setFitView();
......@@ -289,33 +290,31 @@ export default {
});
return false;
}
if (_this.mouseTool) {
return false;
}
console.log(_zoom);
// if (_this.mouseTool) {
// _this.mouseTool.close();
// return false;
// }
if (_zoom < 14) {
_this.map.setZoom(14);
}
_this.map.setZooms([14, 30]);
var mouseTool = new AMap.MouseTool(_map);
mouseTool.rectangle({
fillColor: "#2C68FF",
strokeColor: "#2C68FF",
fillOpacity: 0.3,
strokeWeight: 4,
strokeOpacity: 1,
draggable: true,
});
mouseTool.close()
mouseTool.on("draw", function (e) {
let rectangle = e.obj;
mouseTool.close();
_this.rectangle = rectangle;
_this.calculateWidthHeight(rectangle.getOptions().bounds);
});
_this.mouseTool = mouseTool;
if (_this.mouseTool) {
_this.mouseTool.rectangle({
fillColor: "#2C68FF",
strokeColor: "#2C68FF",
fillOpacity: 0.3,
strokeWeight: 4,
strokeOpacity: 1,
draggable: true,
});
_this.mouseTool.on("draw", function (e) {
let rectangle = e.obj;
_this.mouseTool.close();
_this.rectangle = rectangle;
_this.calculateWidthHeight(rectangle.getOptions().bounds);
});
}
},
// 计算矩形宽度、高度
......@@ -351,7 +350,7 @@ export default {
this.rectangleHeight = 0;
this.rectangleWidth = 0;
this.rectangle = null;
this.mouseTool = null;
//this.mouseTool = null;
this.deviceList = [];
this.map.setZooms([2, 30]);
},
......@@ -363,7 +362,10 @@ export default {
this.rectangleWidth = 0;
this.form = {};
this.deviceList = [];
this.mouseTool = null;
if (this.mouseTool) {
this.mouseTool.close(true);
//this.mouseTool = null;
}
},
// 展开
......@@ -485,8 +487,8 @@ export default {
}
GER_REGIONAL_LOCATION(params).then((res) => {
let list = res.data || [];
if(res.code != 200){
if (res.code != 200) {
showToast({
message: res.message,
});
......@@ -631,7 +633,9 @@ export default {
});
mass.setMap(_this.map);
this.drawDone = true;
//this.map.setFitView();
if(arr && arr.length<10){
this.map.setFitView();
}
this.mapMass = mass;
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!