Explorar o código

fix:监控设备添加弹窗+水文信息点击更改

liu_w601 hai 3 meses
pai
achega
1db8bf9ddd

+ 35 - 0
src/views/components/layerList/index.vue

@@ -421,10 +421,45 @@ export default {
             attr: { ...point }
           })
           graphicsLayer.addGraphic(graphic)
+          let that = this
+          graphic.on(this.mars3d.EventType.click, function () {
+            const pointData = graphic.attr
+            that.fetchUrl(pointData).then((res) => {
+              if (res.code == 4001) {
+                that.$message.warning(JSON.parse(res.msg).resultMsg)
+              } else if (res.code == 400) {
+                that.$message.error(res.msg)
+              } else {
+                const url = res.data.streamUrl
+                that.$set(pointData, 'url', url)
+                that.$globalEventBus.$emit('clickVideoPlay', { point: pointData, visible: true, type: 'click' })
+              }
+            })
+          })
         })
         graphicsLayer.flyTo()
       })
     },
+    fetchUrl(item) {
+      return new Promise((resolve, reject) => {
+        window
+          .requestSDK(
+            '/ttvideo/video/player/getVideoRealtimeUrl',
+            {
+              deviceCode: item.deviceCode,
+              channelCode: item.channelCode,
+              netType: '1',
+              protocolType: 5,
+              streamType: 1
+            },
+            {},
+            'post'
+          )
+          .then(async (res) => {
+            resolve(res)
+          })
+      })
+    },
     removeMonitorData() {
       if (graphicsLayer) {
         graphicsLayer.show = false

+ 1 - 1
src/views/water-station-popup/index.vue

@@ -146,6 +146,7 @@ export default {
   mounted() {
     this.$globalEventBus.$on('clickWaterStation', (data) => {
       this.chartShow = false
+      this.visible = true
       if (data.layer.id == '2-2') {
         this.getMonitoringStatistics(19)
       } else {
@@ -170,7 +171,6 @@ export default {
     },
     getMonitoringStatistics(id) {
       getMonitoringStatistics({ stationId: id }).then((res) => {
-        this.visible = true
         this.chartShow = true
         if (res.data) {
           this.swInfo = res.data.info