Bläddra i källkod

事件列表搜索

彭宇 2 år sedan
förälder
incheckning
50a239f11c
2 ändrade filer med 98 tillägg och 6 borttagningar
  1. 2 2
      src/components/supermap.vue
  2. 96 4
      src/views/forest.vue

+ 2 - 2
src/components/supermap.vue

@@ -782,10 +782,10 @@ export default {
       }
     },
     dropLocation: function(lat, lng) { //落点定位
-      this.controlLevel(10)
+      this.controlLevel(15)
       setTimeout(() => {
         this.map.panTo([lat, lng])
-      }, 500)
+      }, 1000)
     },
     controlLevel: function(level) { //控制地图缩放级别
       this.map.setZoom(level)

+ 96 - 4
src/views/forest.vue

@@ -185,10 +185,10 @@
                   <el-input
                     placeholder="请输入内容"
                     prefix-icon="el-icon-search"
-                    v-model="eventSearch">
+                    v-model="eventSearch" @change="searchEvent(eventSearch)">
                   </el-input>
                 </div>
-                <div class="d-l-con padding-box nowrap" v-for="(item,index) in eventList">
+                <div class="d-l-con padding-box nowrap" v-for="(item,index) in eventList" @click="dropLocation(item.latitude,item.longitude)">
                   <div class="bgt-img">
                     <img src="../assets/images/integrated/event-img-sub.png"/>
                   </div>
@@ -387,7 +387,9 @@ export default {
       weatherinformationWeather: '',
       //右侧事件列表
       eventList: [],
-
+      eventListnew: [],
+      eventListAll: [],
+      eventSearch: '',//事件列表搜索
       listCurrentIndex1: '',
       // ----------------------------------事件分类柱状----------------------------------------
       eventKind: {},
@@ -395,7 +397,6 @@ export default {
       reportList: {
         data: []
       },
-      eventSearch: '',//事件列表搜索
       /** ----------------------------------weosocket开始------------------------------------- */
       weosocket: false,
       websock: '',
@@ -421,6 +422,95 @@ export default {
   },
   /** ----------------------------------weosocket结束------------------------------------- */
   methods: {
+    searchEvent(eventSearch) {
+      let that = this
+      //事件列表搜索
+      this.eventListnew = [];
+      if(eventSearch!=null&&eventSearch!=""){
+        for (var i = 0; i < this.eventListAll.length; i++) {
+          if (this.eventListAll[i].reportor.indexOf(eventSearch)>-1) {
+            this.eventListnew.push(this.eventListAll[i]);
+          }
+        }
+        this.eventList=this.eventListnew
+      }else{
+        this.eventList=this.eventListAll
+      }
+      if (this.eventList != null && this.eventList.length > 0) {
+        for (let i = 0; i < this.eventList.length; i++) {
+          let markersMap = {
+            lng: 124.59,
+            lat: 43.02,
+            icon: 'marker',
+            bindPopupHtml: '',
+            click: '',
+            parameter: '',
+            keepBindPopup: false,
+            isAggregation: false
+          }
+          if (this.eventList.length > 50) {
+            markersMap.isAggregation = true
+          }
+          if (this.eventList[i].eventStatusValue == 'forest_event_status_1' || this.eventList[i].eventStatusValue == 'forest_event_status_2' || this.eventList[i].eventStatusValue == 'forest_event_status_3') {
+            markersMap.click = 'showEventDialog'
+            markersMap.icon = 'sj-icon-map-clz'
+            markersMap.isAggregation = false
+          } else if (this.eventList[i].eventStatusValue == 'event_event_status_4') {
+            markersMap.click = 'showEventDialog'
+            markersMap.icon = 'sj-icon-map-wcl'
+          } else if (this.eventList[i].eventStatusValue == 'event_event_status_5') {
+            markersMap.click = 'showEventDialog'
+            markersMap.icon = 'sj-icon-map-wcl'
+          } else if (this.eventList[i].eventStatusValue == 'event_event_status_6') {
+            markersMap.click = 'showEventDialog'
+            markersMap.icon = 'sj-icon-map-wcl'
+          } else {
+            markersMap.click = 'showEventDialog'
+            markersMap.icon = 'sj-icon-map-ywc'
+          }
+          markersMap.parameter = this.eventList[i].eventCode
+          markersMap.lng = this.eventList[i].longitude
+          markersMap.lat = this.eventList[i].latitude
+          markersMap.bindPopupHtml = '<div class="map-tip">' +
+            '<span>' +
+            '                  <div class="d-l-con">' +
+            '                  <div class="d-l-l-text">' +
+            '                  <h4>经纬度:' + this.eventList[i].longitude + ',' + this.eventList[i].latitude + '</h4>' +
+            '                </div>' +
+            '                </div>' +
+            '                </span>' +
+            '<span>' +
+            '                  <div class="d-l-con">' +
+            '                  <div class="d-l-l-text">' +
+            '                  <h4>事件名称:' + this.eventList[i].eventName + '</h4>' +
+            '                </div>' +
+            '                </div>' +
+            '                </span>' +
+            '<span>' +
+            '                  <div class="d-l-con">' +
+            '                  <div class="d-l-l-text">' +
+            '                  <h4>事件时间:' + this.eventList[i].reportTime + '</h4>' +
+            '                </div>' +
+            '                </div>' +
+            '                </span>' +
+            '</div>'
+          that.markersList.push(markersMap)
+        }
+        setTimeout(() => {
+          that.$refs.supermap.clearM(false)
+          that.$refs.supermap.clearM(true)
+          that.$refs.supermap.setMarkers(that.markersList)
+        }, 1000)
+      } else {
+        setTimeout(() => {
+          that.$refs.supermap.clearM(false)
+          that.$refs.supermap.clearM(true)
+        }, 1000)
+      }
+    },
+    dropLocation(lat, lng){
+      this.$refs.supermap.dropLocation(lat, lng)
+    },
     showEventDialog(eventCode) {
       //事件信息弹出
       this.$refs.eventdetailsdialog.showEventDialog(eventCode)
@@ -668,9 +758,11 @@ export default {
     getEventList(day) {
       let that = this
       this.eventList = []
+      this.eventListAll = []
       //右侧获取事件列表
       getEventList({ day: day }).then(res => {
         this.eventList = res.data
+        this.eventListAll = res.data
         that.markersList = []
         if (this.eventList != null && this.eventList.length > 0) {
           for (let i = 0; i < this.eventList.length; i++) {