Browse Source

党群中心首页加上地图

shibei_master
dai 4 years ago
parent
commit
7c3883052b
  1. 70
      src/views/modules/communityService/dqfwzx/index.vue

70
src/views/modules/communityService/dqfwzx/index.vue

@ -43,6 +43,9 @@
>修改</el-button
>
</div>
<div id="centerIndexApp" class="div_map"></div>
<el-table
:data="tableData[currentIndex].matterList"
border
@ -151,6 +154,12 @@ import editForm from "./cpts/edit";
import orderForm from "./cpts/order";
import orderList from "./cpts/orderList";
var map;
var search;
var markers;
var infoWindowList;
let loading; //
export default {
components: { editForm, orderForm, orderList },
data() {
@ -175,12 +184,66 @@ export default {
},
...mapGetters(["clientHeight"]),
},
watch: {},
watch: {
currentIndex() {
this.setMap();
},
},
async mounted() {
await this.loadAgency();
this.getTableData();
await this.getTableData();
this.initMap();
this.setMap();
},
methods: {
// init
initMap() {
//
var center = new window.TMap.LatLng(36.0722275, 120.38945519);
// map TMap.Map()
map = new window.TMap.Map(document.getElementById("centerIndexApp"), {
center: center, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45, //
});
search = new window.TMap.service.Search({ pageSize: 10 });
//
markers = new TMap.MultiMarker({
map: map,
geometries: [],
});
infoWindowList = Array(10);
},
setMarker(lat, lng, centerName) {
markers.setGeometries([]);
markers.add([
{
id: "911",
styleId: "marker",
position: new TMap.LatLng(lat, lng),
properties: {
title: centerName,
},
},
]);
},
setCenter(lat, lng) {
map.setCenter(new window.TMap.LatLng(lat, lng));
},
setMap() {
const { tableData, currentIndex } = this;
let item = tableData[currentIndex];
if (item) {
this.setCenter(item.latitude, item.longitude);
this.setMarker(item.latitude, item.longitude, item.centerName);
}
},
handleClose() {
this.formShow = false;
},
@ -347,6 +410,9 @@ export default {
margin-bottom: 10px;
text-align: right;
}
.div_map {
margin-bottom: 10px;
}
}
}
.tabs-other-info {

Loading…
Cancel
Save