Commit 65039efb authored by 耿迪迪's avatar 耿迪迪

设备管理搜索、设备拖拽问题 gengdidi

parent 66b6cd0b
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
this.map.remove(this.obj); this.map.remove(this.obj);
this.form.deviceId = response.data; this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form); this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear();
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
}else{ }else{
this.msgSuccess("新增失败"); this.msgSuccess("新增失败");
......
...@@ -81,6 +81,9 @@ ...@@ -81,6 +81,9 @@
gaoMap : null gaoMap : null
} }
}, },
mounted(){
console.log(this.form.longitude,"===============")
},
components: { components: {
FileUpload, FileUpload,
}, },
...@@ -108,6 +111,7 @@ ...@@ -108,6 +111,7 @@
this.map.remove(this.obj); this.map.remove(this.obj);
this.form.deviceId = response.data; this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form); this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear();
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
}else{ }else{
this.msgSuccess("新增失败"); this.msgSuccess("新增失败");
......
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
this.map.remove(this.obj); this.map.remove(this.obj);
this.form.deviceId = response.data; this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form); this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear();
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
}else{ }else{
this.msgSuccess("新增失败"); this.msgSuccess("新增失败");
......
...@@ -208,34 +208,6 @@ class gaodeMap { ...@@ -208,34 +208,6 @@ class gaodeMap {
return html; return html;
} }
} }
/* let html = "<div>" +
"<table>" +
"<tr>" +
"<td>所属燃气公司</td>" +
"<td>正元</td>" +
"</tr>" +
"<tr>" +
"<td>名称</td>" +
"<td>1234</td>" +
"</tr>" +
"<tr>" +
"<td>地址</td>" +
"<td>石家庄市新华区</td>" +
"</tr>" +
"</table>" +
"</div>";
switch (this.markerType){
case DEVICE_TYPE.REGEULATORBOX :{
return html;
}
case DEVICE_TYPE.VALUEWELL :{
return html;
}
case DEVICE_TYPE.FLOWMETER :{
return html;
}
}*/
} }
/** /**
...@@ -512,9 +484,17 @@ class gaodeMap { ...@@ -512,9 +484,17 @@ class gaodeMap {
device.obj = e.obj; device.obj = e.obj;
device.gaoMap = that; device.gaoMap = that;
e.obj.on("click", function(aa) { e.obj.on("click", function(aa) {
console.log(aa,"fdsfdsfdsa===click")
let postion = aa.target._position; let postion = aa.target._position;
device.form.longitude = postion.lng; //兼容拖拽后单击事件,拖拽后点击事件返回位置为数组
device.form.latitude = postion.lat; if(postion instanceof Array){
device.form.longitude = postion[0];
device.form.latitude = postion[1];
}else{
device.form.longitude = postion.lng;
device.form.latitude = postion.lat;
}
device.show(); device.show();
}); });
} }
...@@ -616,5 +596,35 @@ class gaodeMap { ...@@ -616,5 +596,35 @@ class gaodeMap {
} }
); );
} }
searchTips(inputId){
let that = this;
AMap.plugin(['AMap.AutoComplete', 'AMap.PlaceSearch'], function () {
//输入提示
var autoOptions = {
input: inputId
};
var auto = new AMap.AutoComplete(autoOptions);
that.placeSearch = new AMap.PlaceSearch({
map: map
});
//构造地点查询类
auto.on('select', function(e){
console.log(e,"eeeeee========")
that.placeSearch.clear();
that.placeSearch.setCity(e.poi.adcode);
that.placeSearch.search(e.poi.name); //关键字查询查询
})
})
}
searchKeyWord(keyWord){
AMap.plugin(['AMap.AutoComplete'], function () {
var placeSearch = new AMap.PlaceSearch({
map: map
});
placeSearch.search(keyWord); //关键字查询查询
})
}
} }
export default gaodeMap; export default gaodeMap;
<template> <template>
<div> <div>
<div style="width: 100vw; height: 100vh" id="container"></div> <div style="width: 100vw; height: 100vh" id="container"></div>
<!-- <div class="input-card" style='width: 24rem;'> <el-input v-model="keyWord" placeholder="点击输入" id="tipinput" class="search-input"/>
<div class="input-item"> <el-button type="red" icon="el-icon-search" class="search-but" @click="search()">搜索</el-button>
<input type="radio" name='func' value='marker'><span class="input-text">画点</span>
<input type="radio" name='func' value='polyline'><span class="input-text">画折线</span>
<input type="radio" name='func' value='polygon'><span class="input-text" style='width:5rem;'>画多边形</span>
</div>
<div class="input-item">
<input type="radio" name='func' value='rectangle'><span class="input-text">画矩形</span>
<input type="radio" name='func' value='circle'><span class="input-text">画圆</span>
</div>
<div class="input-item">
<input id="clear" type="button" class="btn" value="清除" />
<input id="close" type="button" class="btn" value="关闭绘图" />
</div>
</div>-->
<el-button <el-button
type="primary" type="primary"
style="position: absolute; top: 100px; left: 75%" style="position: absolute; top: 100px; left: 75%"
...@@ -76,6 +63,7 @@ export default { ...@@ -76,6 +63,7 @@ export default {
inspectionTime: null, inspectionTime: null,
remarks: null remarks: null
}, },
keyWord:""
}; };
}, },
mounted() { mounted() {
...@@ -96,6 +84,7 @@ export default { ...@@ -96,6 +84,7 @@ export default {
]; ];
gaoMap.addPolyline(path); gaoMap.addPolyline(path);
gaoMap.addMouseTool(); gaoMap.addMouseTool();
gaoMap.searchTips("tipinput");
this.getDeviceInfo(); this.getDeviceInfo();
}, },
methods: { methods: {
...@@ -109,11 +98,13 @@ export default { ...@@ -109,11 +98,13 @@ export default {
this.gaoMap.lineType =2; this.gaoMap.lineType =2;
this.gaoMap.mapOperateType = "edit"; this.gaoMap.mapOperateType = "edit";
this.gaoMap.addMarkerDragg(); this.gaoMap.addMarkerDragg();
this.gaoMap.placeSearch.clear();
}, },
deleteDevice() { deleteDevice() {
this.deviceType = false; this.deviceType = false;
this.gaoMap.mapOperateType = "delete"; this.gaoMap.mapOperateType = "delete";
this.gaoMap.removeMarkerDragg(); this.gaoMap.removeMarkerDragg();
this.gaoMap.placeSearch.clear();
}, },
selectDeviceType(val) { selectDeviceType(val) {
// if("add" == this.operationType){ // if("add" == this.operationType){
...@@ -146,6 +137,10 @@ export default { ...@@ -146,6 +137,10 @@ export default {
this.loading = false; this.loading = false;
}); });
},
search(){
this.gaoMap.placeSearch.clear();
this.gaoMap.placeSearch.search(this.keyWord)
} }
}, },
}; };
...@@ -226,5 +221,17 @@ input[type="radio"] { ...@@ -226,5 +221,17 @@ input[type="radio"] {
width: 4rem; width: 4rem;
margin-right: 1rem; margin-right: 1rem;
} }
.search-input{
position: absolute;
top: 100px;
left: 2%;
width:240px;
}
.search-but{
position: absolute;
top: 100px; left: 19%;
width:85px;color: white;
background-color: #053B6A;
}
</style> </style>
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