|
|
@ -101,9 +101,9 @@ |
|
|
|
placeholder="请输入位置关键词" |
|
|
|
:remote-method="searchOnMap" |
|
|
|
:loading="mapLoading"> |
|
|
|
<el-option v-for="(item,index) in searchOptions" |
|
|
|
<el-option v-for="(item,index) in mapSearchResultList" |
|
|
|
@click.native="handleMapSearchResultSelected(index)" |
|
|
|
:key="item.value" |
|
|
|
:key="index" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value"> |
|
|
|
</el-option> |
|
|
@ -148,7 +148,6 @@ export default { |
|
|
|
xingzhengSelectorVisible: true, // 行政组织是否可见 |
|
|
|
|
|
|
|
// 地图 |
|
|
|
searchOptions: [], //用于展示的地图搜索结果列表 |
|
|
|
searchValue: '', |
|
|
|
mapLoading: false, // 地图加载 |
|
|
|
mapSearchResultList: [], // 地图搜索结果列表 |
|
|
@ -191,7 +190,13 @@ export default { |
|
|
|
let { latitude, longitude } = this.$store.state.user; |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
if(!map){ |
|
|
|
this.initMap(latitude, longitude); |
|
|
|
|
|
|
|
}else{ |
|
|
|
map.setCenter(latitude, longitude); |
|
|
|
map.setMarker(latitude, longitude); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
@ -411,14 +416,12 @@ export default { |
|
|
|
|
|
|
|
if (msg == "success" && data.resultList && data.resultList.length > 0) { |
|
|
|
|
|
|
|
if (data.resultList && data.resultList.length > 0) { |
|
|
|
this.mapSearchResultList = data.resultList |
|
|
|
this.searchOptions = this.mapSearchResultList.map(item => { |
|
|
|
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` }; |
|
|
|
// this.mapSearchResultList = data.resultList |
|
|
|
this.mapSearchResultList = data.resultList.map(item => { |
|
|
|
return { value: `${item.id}`, label: `${item.address + item.name}`,location:item.location }; |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.searchOptions = [ |
|
|
|
this.mapSearchResultList = [ |
|
|
|
{ |
|
|
|
value: '0', |
|
|
|
label: '未检索到结果' |
|
|
@ -426,7 +429,7 @@ export default { |
|
|
|
] |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.searchOptions = []; |
|
|
|
this.mapSearchResultList = []; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -442,7 +445,7 @@ export default { |
|
|
|
if (msg == "success") { |
|
|
|
this.dataForm.address = data.address |
|
|
|
this.searchValue = data.address |
|
|
|
this.searchOptions = [] |
|
|
|
this.mapSearchResultList = [] |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
@ -452,12 +455,14 @@ export default { |
|
|
|
* @param index |
|
|
|
*/ |
|
|
|
handleMapSearchResultSelected (index) { |
|
|
|
let selPosition = this.resultList[index] |
|
|
|
let lonlat = selPosition.lonlat.split(" ") |
|
|
|
map.setCenter(lonlat[1], lonlat[0]); |
|
|
|
map.setMarker(lonlat[1], lonlat[0]); |
|
|
|
this.dataForm.latitude = lonlat[1]; |
|
|
|
this.dataForm.longitude = lonlat[0]; |
|
|
|
console.log(index) |
|
|
|
console.log(this.mapSearchResultList);; |
|
|
|
let selPosition = this.mapSearchResultList[index] |
|
|
|
let {lat,lng} = selPosition.location |
|
|
|
map.setCenter(lat, lng); |
|
|
|
map.setMarker(lat, lng); |
|
|
|
this.dataForm.latitude = lat; |
|
|
|
this.dataForm.longitude = lng; |
|
|
|
this.dataForm.address = selPosition.address + selPosition.name |
|
|
|
}, |
|
|
|
|
|
|
|