Browse Source

党组织新增编辑地图问题

feature
mk 2 years ago
parent
commit
6a6a7c64d9
  1. 39
      src/views/modules/communityParty/partyOrg/create.vue
  2. 4
      src/views/modules/communityParty/partyOrg/update.vue

39
src/views/modules/communityParty/partyOrg/create.vue

@ -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
},

4
src/views/modules/communityParty/partyOrg/update.vue

@ -165,19 +165,15 @@ export default {
await this.loadPrincipals();
//
this.$nextTick(() => {
this.dataForm.principalId = partyOrgInfo.principalId;
console.log(this.principals)
console.log(this.dataForm.principalId )
if (!map) {
// console.log(":", longitude, latitude);
this.initMap(this.dataForm.latitude, this.dataForm.longitude);
} else {
map.setCenter(this.dataForm.latitude, this.dataForm.longitude);
map.setMarker(this.dataForm.latitude, this.dataForm.longitude);
}
});
},
//

Loading…
Cancel
Save