Commit 76e63767 authored by 耿迪迪's avatar 耿迪迪

地图搜索 gengdidi

parent 56eca651
......@@ -124,7 +124,7 @@
this.map.remove(this.obj);
this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear();
//this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功");
}else{
......
......@@ -124,7 +124,7 @@
this.map.remove(this.obj);
this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear();
//this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功");
}else{
......
......@@ -126,7 +126,7 @@
this.form.deviceId = response.data;
console.log(this.gaoMap,"addgaoMap")
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear();
//this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功");
}else{
......
......@@ -124,7 +124,7 @@
this.map.remove(this.obj);
this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.placeSearch.clear();
//this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功");
}else{
......
......@@ -802,29 +802,18 @@ class gaodeMap {
var autoOptions = {
input: inputId
};
var auto = new AMap.AutoComplete(autoOptions);
let 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); //关键字查询查询
that.searchSelectAdcode = e.poi.adcode;
that.searchSelectName = e.poi.name;
});
});
}
searchKeyWord(keyWord) {
AMap.plugin(["AMap.AutoComplete"], function() {
var placeSearch = new AMap.PlaceSearch({
map: map
});
placeSearch.search(keyWord); //关键字查询查询
});
}
closeAddMarker(){
this.mouseTool.close();
map.remove(this.markerOverlays);
......
<template>
<div>
<div style="width: 100vw; height: 100vh" id="container"></div>
<!-- <div class="input-card" style='width: 24rem;'>
<div class="input-item">
<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>-->
<div class="btn-wrapper">
<!-- <el-button type="primary" class="el-btn" icon="el-icon-search" @click="addDevice"
>
新增
</el-button>
<el-button type="primary" class="el-btn" @click="editDevice"
>编辑
</el-button>
<el-button type="primary" class="el-btn" @click="deleteDevice"
>删除
</el-button> -->
<div class="myBtn">
<div
class="el-btn"
......@@ -88,7 +63,6 @@
</div>
</div>
<!-- <el-select-->
<el-input
v-model="keyWord"
placeholder="点击输入"
......@@ -96,43 +70,17 @@
class="search-input"
/>
<el-button
type="red"
icon="el-icon-search"
class="search-but"
@click="search()"
>搜索</el-button
>
<!-- <el-button
type="primary"
style="position: absolute; top: 100px; left: 75%"
@click="addDevice"
>新增</el-button
>
<el-button
type="primary"
style="position: absolute; top: 100px; left: 82%"
@click="editDevice"
>编辑</el-button
>
<el-button
type="primary"
style="position: absolute; top: 100px; left: 90%"
@click="deleteDevice"
>删除</el-button
icon="el-icon-refresh"
class="refresh-but"
@click="refreshMap()"
>重置</el-button
>
<el-select
v-model="value"
placeholder="请选择..."
@change="selectDeviceType"
style="position: absolute; top: 150px; left: 75%"
v-if="deviceType"
>
<el-option label="管道" value="1"></el-option>
<el-option label="调压箱" value="2"></el-option>
<el-option label="阀门井" value="3"></el-option>
<el-option label="流量计" value="4"></el-option>
<el-option label="值班人员" value="5"></el-option>
</el-select> -->
<div class="leftBar-wrapper">
<div
......@@ -164,23 +112,6 @@ export default {
deviceType: false,
value: "",
operateType: "",
queryParams: {
enterpriseId: null,
pipeId: null,
deviceName: null,
deviceAddr: null,
deviceModel: null,
deviceType: null,
longitude: null,
latitude: null,
iotNo: null,
iconUrl: null,
linkman: null,
phone: null,
installationTime: null,
inspectionTime: null,
remarks: null,
},
radio1: "",
// 1新建,2编辑,3删除,点按钮变色
targetNum: 0,
......@@ -222,8 +153,11 @@ export default {
};
},
mounted() {
this.initMap();
},
methods: {
initMap(){
let gaoMap = new gaodeMap("石家庄");
this.gaoMap = gaoMap;
window.addEventListener("click", this.barClose);
gaoMap.addMouseTool();
......@@ -231,7 +165,6 @@ export default {
this.getDeviceInfo();
this.getPipeList();
},
methods: {
// 左边的Bar修改值
leftBarChange(item) {
// this.leftBarNum= this.leftBarNum != item.value ? item.value:0;
......@@ -294,7 +227,7 @@ export default {
this.deviceType = false;
this.gaoMap.mapOperateType = "edit";
this.gaoMap.addMarkerDragg();
this.gaoMap.placeSearch.clear();
// this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
},
deleteDevice() {
......@@ -306,7 +239,7 @@ export default {
this.deviceType = false;
this.gaoMap.mapOperateType = "delete";
this.gaoMap.removeMarkerDragg();
this.gaoMap.placeSearch.clear();
//this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
},
selectDeviceType(val) {
......@@ -321,9 +254,9 @@ export default {
this.gaoMap.createNewLine();
}
},
getDeviceInfo() {
getDeviceInfo(queryParams) {
this.loading = true;
getAllDeviceInfo(this.queryParams).then((response) => {
getAllDeviceInfo(queryParams).then((response) => {
if (response.code == 200) {
for (var i = 0; i < response.data.length; i++) {
if ("1" == response.data[i].deviceType) {
......@@ -346,8 +279,8 @@ export default {
this.loading = false;
});
},
getPipeList() {
pipeAllInfoList().then((res) => {
getPipeList(queryParams) {
pipeAllInfoList(queryParams).then((res) => {
console.log("管道", res);
if (res.code == 200) {
this.gaoMap.addPolyline(res.data);
......@@ -355,8 +288,23 @@ export default {
});
},
search() {
map.clearMap();
this.gaoMap.placeSearch.clear();
if(!(!this.gaoMap.searchSelectAdcode && !this.gaoMap.searchSelectName)){
this.gaoMap.placeSearch.setCity(this.gaoMap.searchSelectAdcode);
this.gaoMap.placeSearch.search(this.gaoMap.searchSelectName);
this.getDeviceInfo({"deviceName": this.gaoMap.searchSelectName});
this.gaoMap.polyLines = [];
this.getPipeList({"pipeName": this.gaoMap.searchSelectName});
this.gaoMap.searchSelectAdcode = undefined;
this.gaoMap.searchSelectName = undefined;
}else{
this.gaoMap.placeSearch.search(this.keyWord);
this.getDeviceInfo({"deviceName": this.keyWord});
this.gaoMap.polyLines = [];
this.getPipeList({"pipeName": this.keyWord});
}
},
// 新建下拉列表关闭
barClose() {
......@@ -371,6 +319,10 @@ export default {
this.gaoMap.lineFlag = false;
this.gaoMap.createNewLine();
},
refreshMap(){
map.clearMap();
this.initMap();
}
},
beforeDestroy() {
......@@ -386,7 +338,7 @@ export default {
.leftBar-wrapper {
position: fixed;
left: 100px;
top: 100px;
top: 150px;
.box {
width: 180px;
height: 48px;
......@@ -601,5 +553,14 @@ input[type="radio"] {
color: white;
background-color: #053b6a;
}
.refresh-but{
position: absolute;
top: 100px;
left: 25%;
width: 85px;
color: white;
background-color: #053b6a;
}
</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