From 401524fb5661d57ffb2229d683fe4de85b65fd1c Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 31 八月 2023 17:54:24 +0800
Subject: [PATCH] 生产管理看板+删不需要的文件

---
 src/components/canvas/index.vue |   56 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/src/components/canvas/index.vue b/src/components/canvas/index.vue
index ea4715e..7e4e217 100644
--- a/src/components/canvas/index.vue
+++ b/src/components/canvas/index.vue
@@ -1,13 +1,13 @@
 <template>
-  <div class="s-cavas">
+  <div class="s-cavas" :style="{width:canvasWidth+'px',height:canvasHeight+'px'}">
     <canvas
       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 / ${canvasWidth}px ${canvasHeight}px 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,
@@ -85,6 +93,29 @@
     canvasHeight: {
       type: Number,
       default: 324
+    },
+    showProportion: {
+      type: Number,
+      default: 1.666
+    }
+  },
+  computed: {
+    canvasBg() {
+      if (this.snapshot_url) {
+        // 鏁版嵁鏍堣嚜鍔ㄤ笂浼犲鐞�
+        if (this.snapshot_url.indexOf("/opt/vasystem") == 0) {
+          return this.snapshot_url.replace("/opt/vasystem", "");
+        }
+
+        if (this.sourceType == 2) {
+          return `${this.snapshot_url}`;
+        } else {
+          return `/httpImage/${this.snapshot_url}`;
+        }
+
+      } else {
+        return this.blackImg;
+      }
     }
   },
   data() {
@@ -103,7 +134,7 @@
       ctx: null,
       visible: false,
       baseImg: undefined,
-      showProportion: 1.666
+      //showProportion: 1.666
     };
   },
   watch: {
@@ -144,11 +175,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",
@@ -171,10 +203,11 @@
       this.$nextTick(() => {
         // this.$refs.bigCanvas.delCursor = {}
       })
+
     },
     cancelFunc() {
       this.visible = false;
-      this.$refs.bigCanvas.cancel()
+      this.$refs.bigCanvas.cancel();
       // console.log("鍏抽棴浜�");
     },
     handleOk() {
@@ -198,6 +231,7 @@
       // 椤轰究鐢╁埌鏇村灞傚幓
       this.$emit("fromCanvas", this.$refs.bigCanvas.canvasData);
       // console.log("浣犲ソ", this.canvasData);
+
       this.clickSelect(this.canvasData);
       this.visible = false;
     },
@@ -473,14 +507,14 @@
 };
 </script>
 <style lang="scss" scoped>
-canvas{
+canvas {
   position: absolute;
   top: 0;
   left: 0;
 }
 .s-cavas {
-  width: 576px;
-  height: 324px;
+  // width: 576px;
+  // height: 324px;
   margin-top: 10px;
   position: relative;
   overflow: auto;

--
Gitblit v1.8.0