jiawuxian преди 1 година
родител
ревизия
5cb223bc6a
променени са 2 файла, в които са добавени 15 реда и са изтрити 8 реда
  1. 13 8
      src/views/iot/videoDiagnosis/ProgressBar.vue
  2. 2 0
      src/views/iot/videoDiagnosis/detail.vue

+ 13 - 8
src/views/iot/videoDiagnosis/ProgressBar.vue

@@ -146,7 +146,7 @@ export default {
             prevEnd = endStamp;
           }
 
-          if (totalPercent.toFixed(0) != 1) {
+          if (totalPercent != 1) {
             lostVideo.push({
               key: new Date().valueOf(),
               width: (1 - totalPercent) * 100,
@@ -174,13 +174,15 @@ export default {
     // }
   },
   mounted() {
-    this.canvas = document.getElementById("procanvas");
-    this.ctx = this.canvas.getContext("2d");
-    this.canvas.width = this.$refs.progressbar.offsetWidth;
-    this.canvasW = this.canvas.width;
-    this.canvasH = this.canvas.height;
-    this.nowTime = this.changeTime(new Date().getTime());
-    this.initCanvas();
+    this.$nextTick(() => {
+      this.canvas = document.getElementById("procanvas");
+      this.ctx = this.canvas.getContext("2d");
+      this.canvas.width = this.$refs.progressbar.offsetWidth;
+      this.canvasW = this.canvas.width;
+      this.canvasH = this.canvas.height;
+      this.nowTime = this.changeTime(new Date().getTime());
+      this.initCanvas();
+    });
   },
   methods: {
     // 初始化canvas
@@ -219,6 +221,7 @@ export default {
       var px_per_ms = _this.canvasW / (_this.minute_per_ruler * 60 * 1000); // px/ms
       var px_per_step = _this.graduation_step; // px/格 默认最小值20px
       var min_per_step = px_per_step / px_per_min; // min/格
+
       for (let i = 0; i < _this.minutes_per_step.length; i++) {
         if (min_per_step <= _this.minutes_per_step[i]) {
           //让每格时间在minutes_per_step规定的范围内
@@ -237,6 +240,7 @@ export default {
           break;
         }
       }
+      console.info("add_graduations", _this.canvasW);
       var num_steps = _this.canvasW / px_per_step; //总格数
       var graduation_left;
       var graduation_time;
@@ -246,6 +250,7 @@ export default {
       ); //开始的偏移时间 ms
       var px_offset = ms_offset * px_per_ms; //开始的偏移距离 px
       var ms_per_step = px_per_step / px_per_ms; // ms/step
+
       for (var i = 0; i < num_steps; i++) {
         graduation_left = px_offset + i * px_per_step; // 距离=开始的偏移距离+格数*px/格
         graduation_time = start_timestamp + ms_offset + i * ms_per_step; //时间=左侧开始时间+偏移时间+格数*ms/格

+ 2 - 0
src/views/iot/videoDiagnosis/detail.vue

@@ -82,12 +82,14 @@
               ></Calendar>
             </div>
           </div>
+          <div style="height:10px"></div>
           <el-descriptions
             title="录像完整性"
             :column="3"
             border
             :label-style="labelStyle"
             :contentStyle="content_style"
+            
             v-if="integrity == null || integrity.state == null"
           >
             <el-descriptions-item label="检测结果"> 未知 </el-descriptions-item>