From ce3b404a5983f03a56ad9cd65a4ae2352db2ba77 Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期五, 06 十一月 2020 14:15:56 +0800
Subject: [PATCH] 集群树节点状态切换查询参数treeNodes错误修复

---
 src/components/canvas/index.vue |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/src/components/canvas/index.vue b/src/components/canvas/index.vue
index b8ac906..c26ef7b 100644
--- a/src/components/canvas/index.vue
+++ b/src/components/canvas/index.vue
@@ -4,10 +4,10 @@
       ref="myCanvas"
       :width="canvasWidth"
       :height="canvasHeight"
-      :style="`background:url(${snapshot_url ? `/httpImage/${snapshot_url}` : blackImg}) 100% 100% / 576px 324px; no-repeat; background-size: contain;`"
+      :style="`background:url(${canvasBg}) center / 576px 324px no-repeat; background-size: contain;`"
     ></canvas>
 
-    <el-tooltip content="鍒锋柊搴曞浘" placement="bottom" popper-class="atooltip">
+    <el-tooltip content="鍒锋柊搴曞浘" placement="bottom" popper-class="atooltip" v-if="isShowRefresh">
       <span class="iconfont icongengxin" @click="refresh"></span>
     </el-tooltip>
     <p class="tip" :style="disabled ? `display:block;` : `display:none;`">鎵归噺閰嶇疆鏂瑰紡涓嶅厑璁哥粯鍒跺尯鍩燂紝璇烽�夋嫨鎽勫儚鏈鸿繘琛屽尯鍩熺粯鍒�</p>
@@ -21,7 +21,7 @@
       <canvas-dialog
         ref="bigCanvas"
         :canvasDataToChild="canvasData"
-        :snapshot_url="snapshot_url"
+        :snapshot_url="canvasBg"
         @refresh="refresh"
       ></canvas-dialog>
       <span slot="footer" class="dialog-footer">
@@ -47,6 +47,14 @@
     isGB28181: {
       default: false,
       type: Boolean
+    },
+    isShowRefresh: {
+      default: true,
+      type: Boolean
+    },
+    sourceType: {
+      default: 1,
+      type: Number
     },
     isShowDrawArrow: {
       default: false,
@@ -87,6 +95,19 @@
       default: 324
     }
   },
+  computed: {
+    canvasBg() {
+      if (this.snapshot_url) {
+        if (this.sourceType == 2) {
+          return `${this.snapshot_url}`
+        } else {
+          return `/httpImage/${this.snapshot_url}`
+        }
+      } else {
+        return this.blackImg;
+      }
+    }
+  },
   data() {
     return {
       blackImg: require("../../assets/img/baseimg.png"),
@@ -103,7 +124,7 @@
       ctx: null,
       visible: false,
       baseImg: undefined,
-      showProportion: 1.71
+      showProportion: 1.666
     };
   },
   watch: {
@@ -144,11 +165,12 @@
       // this.$emit('changeBaseImg',this.currentCameraId)
       this.$emit('changeLoading', true)
       if (this.currentCameraId) {
+        let _this = this;
         await updateSnapshot(this.currentCameraId)
           .then(res => {
-            if (res.data.cameraId === this.currentCameraId) {
+            if (res.data.cameraId === _this.currentCameraId) {
               this.baseImg = res.data.snapshotUrl;
-              this.$emit('refresh', res.data.snapshotUrl)
+              this.$emit('refresh', res.data.snapshotUrl, _this.currentCameraId)
               this.$forceUpdate()
               this.$notify({
                 type: "success",
@@ -473,7 +495,7 @@
 };
 </script>
 <style lang="scss" scoped>
-canvas{
+canvas {
   position: absolute;
   top: 0;
   left: 0;

--
Gitblit v1.8.0