浏览代码

事件定位

qinhouyu 2 年之前
父节点
当前提交
70ce97a7d9
共有 2 个文件被更改,包括 59 次插入61 次删除
  1. 11 9
      src/components/eventLocation.vue
  2. 48 52
      src/components/supermap.vue

+ 11 - 9
src/components/eventLocation.vue

@@ -294,6 +294,10 @@ export default {
     /** ----------------------------------摄像头预览结束------------------------------------- */
   },
   methods: {
+    showLatLng(lat, lng) {
+      this.longitude=lng
+      this.latitude=lat
+    },
     getCurrentDataStr() {
       let date = new Date()
       let y = date.getFullYear()
@@ -303,15 +307,6 @@ export default {
       d = d < 10 ? '0' + d : d
       return y + '-' + m + '-' + d
     },
-    cancelEventLocationShow() {
-      if (this.oWebControl != null) {
-        this.oWebControl.JS_HideWnd()   // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
-        this.oWebControl.JS_Disconnect().then(function() {  // 断开与插件服务连接成功
-          },
-          function() {  // 断开与插件服务连接失败
-          })
-      }
-    },
     showEventDialog(eventCode) {
       //事件信息弹出
       this.$refs.eventdetailsdialog.showEventDialog(eventCode)
@@ -325,6 +320,7 @@ export default {
         return
       }
       this.activeName = 'event'
+      this.$refs.eventLocationSupermap.dropLocation(this.latitude,this.longitude,10)
       let marker = [{
         lng: this.longitude,
         lat: this.latitude,
@@ -416,6 +412,8 @@ export default {
           setTimeout(() => {
             that.$refs.eventLocationSupermap.clearM(false)
             that.$refs.eventLocationSupermap.clearM(true)
+            that.$refs.eventLocationSupermap.clearP()
+
             that.$refs.eventLocationSupermap.setMarkers(that.markersList)
             that.$refs.eventLocationSupermap.setMarkers(marker)
           }, 1000)
@@ -423,6 +421,8 @@ export default {
           setTimeout(() => {
             that.$refs.eventLocationSupermap.clearM(false)
             that.$refs.eventLocationSupermap.clearM(true)
+            that.$refs.eventLocationSupermap.clearP()
+
             that.$refs.eventLocationSupermap.setMarkers(marker)
           }, 1000)
         }
@@ -600,6 +600,8 @@ export default {
       this.$modal.msgWarning('请重新安装客户端')
     },
     cancelEventLocationShow() {
+      this.longitude=""
+      this.latitude=""
       if (this.oWebControl != null) {
         this.oWebControl.JS_HideWnd()   // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
         this.oWebControl.JS_Disconnect().then(function() {  // 断开与插件服务连接成功

+ 48 - 52
src/components/supermap.vue

@@ -8,22 +8,21 @@
     >
       <div id="toolbar" v-if="isdynamicPlotting" class="panel panel-primary" v-show="mapToolShowBH" key="mapFlash"
            style="position:absolute;z-index: 9999;top:4rem;left: 1rem; border-radius: 4px; width: fit-content;height:635px;overflow-y:scroll;background:#040b1f">
-
-      <div class="panel-heading" id="panelheading">
-        <h5 style=" color: #2bacf7;font-size: 1rem;padding:.5rem;">鼠标标绘</h5>
-      </div>
-      <div class="panel-body content" id="panelbodycontent" style="margin-bottom: .5rem;padding-right: .5rem;">
-        <div align="right" class="button-group">
-          <el-button type="success" @click="PlottingDrawCancel">取消标绘</el-button>
-          &nbsp;&nbsp;
-          <el-button type="success" @click="clearLayers">清空标绘</el-button>
+        <div class="panel-heading" id="panelheading">
+          <h5 style=" color: #2bacf7;font-size: 1rem;padding:.5rem;">鼠标标绘</h5>
         </div>
-      </div>
-      <div id="plottingPanel">
-        <div id="plotPanel" style="width: 15rem;height:50%;overflow-y:scroll;">
+        <div class="panel-body content" id="panelbodycontent" style="margin-bottom: .5rem;padding-right: .5rem;">
+          <div align="right" class="button-group">
+            <el-button type="success" @click="PlottingDrawCancel">取消标绘</el-button>
+            &nbsp;&nbsp;
+            <el-button type="success" @click="clearLayers">清空标绘</el-button>
+          </div>
+        </div>
+        <div id="plottingPanel">
+          <div id="plotPanel" style="width: 15rem;height:50%;overflow-y:scroll;">
+          </div>
         </div>
       </div>
-    </div>
     </transition-group>
     <div id="toolbar-heat" v-if="isheatPlotting" class="panel panel-primary"
          style="position:absolute;z-index: 9999; padding: 1rem; bottom:3rem;right: 1rem; border-radius: 4px; width: fit-content;height:fit-content;overflow-y:scroll;background:#040b1f">
@@ -113,7 +112,6 @@ export default {
   name: 'sookaSuperMap',
   data() {
     return {
-      mapToolShowBH:false,
       windDirection:'',
       windSpeed:null,
       plottingdrawControl: null,
@@ -319,8 +317,6 @@ export default {
     }
   },
   props: {
-    mapToolShowBH:false,
-
     mapDiv: null,
     codes: null,
     mapSite: {},
@@ -328,7 +324,8 @@ export default {
     isSideBySide: false,
     showLatLng: null,
     showAreaLatLng: null,
-    showLineLatLng: null
+    showLineLatLng: null,
+    mapToolShowBH:false,
   },
   methods: {
     /** ----------------------------------火势蔓延  开始------------------------------------- */
@@ -719,12 +716,11 @@ export default {
         spiderfyOnMaxZoom: true
       })
       if (!isSideBySide) { //只有一个地图
-        if (this.codes.length != 1) {
+        if (_that.codes.length != 1) {
           modal.msgError('请输入一个地图code!')
           return
         }
-        getSuperMap(this.codes).then(resp => {
-
+        getSuperMap(_that.codes).then(resp => {
           let mapList = resp.data
           if (mapList != null && mapList.length > 0) {
             let url = mapList[0].url
@@ -755,10 +751,10 @@ export default {
               logoControl: logoControl
             }
             let loadConfiguration = Object.assign(defaultConfigure, mapSite)
-            this.map = window.L.map(this.mapDiv, loadConfiguration)
+            _that.map = window.L.map(_that.mapDiv, loadConfiguration)
 
             //鼠标双击落点
-            if (this.showLatLng != undefined) {
+            if (_that.showLatLng != undefined) {
               let icon = new window.L.Icon({
                 iconUrl: iconList['marker'],
                 iconSize: [48, 48],
@@ -767,21 +763,21 @@ export default {
                 shadowSize: [41, 41]
               })
 
-              this.map.on('dblclick', function(e) {
+              _that.map.on('dblclick', function(e) {
                 _that.clearP()
                 _that.showLatLng(e.latlng.lat, e.latlng.lng)
                 let marker = window.L.marker([e.latlng.lat, e.latlng.lng], {
                   icon: icon
-                }).addTo(this.map)
+                }).addTo(_that.map)
                 _that.latLngLayers.push(marker)
                 _that.latLngGroup = window.L.layerGroup(_that.latLngLayers)
-                this.map.addLayer(_that.latLngGroup)
+                _that.map.addLayer(_that.latLngGroup)
               })
             }
             //鼠标绘制区域
-            if (this.showAreaLatLng != undefined) {
+            if (_that.showAreaLatLng != undefined) {
               var editableLayers = new window.L.FeatureGroup()
-              this.map.addLayer(editableLayers)
+              _that.map.addLayer(editableLayers)
               let options = {
                 position: 'topleft',
                 draw: {
@@ -799,8 +795,8 @@ export default {
                 }
               }
               var drawControl = new window.L.Control.Draw(options)
-              this.map.addControl(drawControl)
-              this.map.on(window.L.Draw.Event.CREATED, function(e) {
+              _that.map.addControl(drawControl)
+              _that.map.on(window.L.Draw.Event.CREATED, function(e) {
                 let editableLayer = e.layer
                 let layerType = e.layerType
                 editableLayer.on('dblclick', function(e) {
@@ -814,9 +810,9 @@ export default {
               })
             }
             //鼠标绘制线段
-            if (this.showLineLatLng != undefined) {
+            if (_that.showLineLatLng != undefined) {
               var editableLayers = new window.L.FeatureGroup()
-              this.map.addLayer(editableLayers)
+              _that.map.addLayer(editableLayers)
               let options = {
                 position: 'topleft',
                 draw: {
@@ -834,8 +830,8 @@ export default {
                 }
               }
               var drawControl = new window.L.Control.Draw(options)
-              this.map.addControl(drawControl)
-              this.map.on(window.L.Draw.Event.CREATED, function(e) {
+              _that.map.addControl(drawControl)
+              _that.map.on(window.L.Draw.Event.CREATED, function(e) {
                 let editableLayer = e.layer
                 let layerType = e.layerType
                 editableLayer.on('dblclick', function(e) {
@@ -849,15 +845,15 @@ export default {
             }
             // url = 'https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China_4326'
 
-            window.L.supermap.tiledMapLayer(url).addTo(this.map)
+            window.L.supermap.tiledMapLayer(url).addTo(_that.map)
           }
         })
       } else { //卷帘地图
-        if (this.codes.length != 2) {
+        if (_that.codes.length != 2) {
           modal.msgError('请输入两个地图code!')
           return
         }
-        getSuperMap(this.codes).then(resp => {
+        getSuperMap(_that.codes).then(resp => {
           let mapList = resp.data
           if (mapList != null && mapList.length == 2) {
             let stamenurl = mapList[0].url
@@ -890,9 +886,9 @@ export default {
             }
 
             let loadConfiguration = Object.assign(defaultConfigure, mapSite)
-            this.map = window.L.map(this.mapDiv, loadConfiguration)
+            _that.map = window.L.map(_that.mapDiv, loadConfiguration)
             //鼠标双击落点
-            if (this.showLatLng != undefined) {
+            if (_that.showLatLng != undefined) {
               let icon = new window.L.Icon({
                 iconUrl: iconList['marker'],
                 iconSize: [48, 48],
@@ -901,21 +897,21 @@ export default {
                 shadowSize: [41, 41]
               })
 
-              this.map.on('dblclick', function(e) {
+              _that.map.on('dblclick', function(e) {
                 _that.clearP()
                 _that.showLatLng(e.latlng.lat, e.latlng.lng)
                 let marker = window.L.marker([e.latlng.lat, e.latlng.lng], {
                   icon: icon
-                }).addTo(this.map)
+                }).addTo(_that.map)
                 _that.latLngLayers.push(marker)
                 _that.latLngGroup = window.L.layerGroup(_that.latLngLayers)
-                this.map.addLayer(_that.latLngGroup)
+                _that.map.addLayer(_that.latLngGroup)
               })
             }
             //鼠标绘制区域
-            if (this.showAreaLatLng != undefined) {
+            if (_that.showAreaLatLng != undefined) {
               var editableLayers = new window.L.FeatureGroup()
-              this.map.addLayer(editableLayers)
+              _that.map.addLayer(editableLayers)
               let options = {
                 position: 'topleft',
                 draw: {
@@ -933,8 +929,8 @@ export default {
                 }
               }
               var drawControl = new window.L.Control.Draw(options)
-              this.map.addControl(drawControl)
-              this.map.on(window.L.Draw.Event.CREATED, function(e) {
+              _that.map.addControl(drawControl)
+              _that.map.on(window.L.Draw.Event.CREATED, function(e) {
                 let editableLayer = e.layer
                 let layerType = e.layerType
                 editableLayer.on('dblclick', function(e) {
@@ -948,9 +944,9 @@ export default {
               })
             }
             //鼠标绘制线段
-            if (this.showLineLatLng != undefined) {
+            if (_that.showLineLatLng != undefined) {
               var editableLayers = new window.L.FeatureGroup()
-              this.map.addLayer(editableLayers)
+              _that.map.addLayer(editableLayers)
               let options = {
                 position: 'topleft',
                 draw: {
@@ -968,8 +964,8 @@ export default {
                 }
               }
               var drawControl = new window.L.Control.Draw(options)
-              this.map.addControl(drawControl)
-              this.map.on(window.L.Draw.Event.CREATED, function(e) {
+              _that.map.addControl(drawControl)
+              _that.map.on(window.L.Draw.Event.CREATED, function(e) {
                 let editableLayer = e.layer
                 let layerType = e.layerType
                 editableLayer.on('dblclick', function(e) {
@@ -982,9 +978,9 @@ export default {
               })
             }
 
-            let stamenLayer = window.L.supermap.tiledMapLayer(stamenurl).addTo(this.map)
-            let osmLayer = window.L.supermap.tiledMapLayer(osmurl).addTo(this.map)
-            L.control.sideBySide(stamenLayer, osmLayer).addTo(this.map)
+            let stamenLayer = window.L.supermap.tiledMapLayer(stamenurl).addTo(_that.map)
+            let osmLayer = window.L.supermap.tiledMapLayer(osmurl).addTo(_that.map)
+            L.control.sideBySide(stamenLayer, osmLayer).addTo(_that.map)
           }
         })
       }