浏览代码

页面提交

wang_xy 4 天之前
父节点
当前提交
74676f8862
共有 2 个文件被更改,包括 30 次插入2 次删除
  1. 1 0
      src/api/components/supermap.js
  2. 29 2
      src/views/useCenter.vue

+ 1 - 0
src/api/components/supermap.js

@@ -40,6 +40,7 @@ export const iconList = {
   'marker': require('@/assets/icons/supermap/marker.png'),
   'positioning': require('@/assets/icons/supermap/positioning.png'), // 地图选点照片
   'hzqy': require('@/assets/icons/supermap/hz_qy.png'),
+  'area': require('@/assets/images/sentinel/hz_qy2.png'),
   'sj-icon-event': require('@/assets/images/sentinel/hz_qy.png'),
   'sj-icon-event-yingji': require('@/assets/images/sentinel/hz_qy4.png'),
 }

+ 29 - 2
src/views/useCenter.vue

@@ -166,9 +166,36 @@ export default {
   },
   methods: {
     getCommunityByDeptId(id){
+      let that = this;
       getCommunityByDeptId(id).then(req => {
-        this.botIndex=id
-        this.communityList = req.data;
+        that.botIndex=id
+        that.communityList = req.data;
+        const markersList = []
+        if (req.data != null && req.data.length > 0) {
+          for (let i = 0; i < req.data.length; i++) {
+            let markersMap = {
+              lng: 124.59,
+              lat: 43.02,
+              icon: 'area',
+              bindPopupHtml: '',
+              click: 'openDetails',
+              parameter: req.data[i],
+              keepBindPopup: false,
+              isAggregation: false
+            }
+            markersMap.lng = req.data[i].longitude
+            markersMap.lat = req.data[i].latitude
+            markersList.push(markersMap);
+          }
+          setTimeout(() => {
+            that.$parent.$refs.supermap.clearM()
+            that.$parent.$refs.supermap.setMarkers(markersList)
+          }, 1000)
+        } else {
+          setTimeout(() => {
+            that.$parent.$refs.supermap.clearM()
+          }, 1000)
+        }
       })
     },
     dropLocation(lat, lng) {