From b4d2703e653bf702d705b18c20d9edb9066c7c8a Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期三, 03 十一月 2021 17:35:10 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/web/vue-smart-ai

---
 src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue |  151 +++++++++++++++++++++++--------------------------
 1 files changed, 71 insertions(+), 80 deletions(-)

diff --git a/src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue b/src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue
index 18ba306..5dd7411 100644
--- a/src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue
+++ b/src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue
@@ -14,11 +14,10 @@
           </span>
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item
-              v-for="(item, index) in popDownArr"
+              v-for="(item, index) in videoArrs"
               :key="index"
               :command="item"
-              >{{ item.CameraPosition }}</el-dropdown-item
-            >
+            >{{ item.CameraPosition }}</el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
 
@@ -53,13 +52,13 @@
           <div class="v-name-block">
             <div
               class="video-name"
-              :class="{ current: curVideo.id == video.id }"
-              @click="checkVideo(video, index)"
+              :class="{ current: curVideo.GroupID == video.GroupID }"
+              @click="checkVideo(video)"
               v-for="(video, index) in curRoomVideos"
-              :key="video.id"
+              :key="index"
             >
               <i class="el-icon-film"></i>
-              <span>{{ video.VideoDate }}</span>
+              <span>{{ video.StartTime }}</span>
             </div>
           </div>
         </div>
@@ -69,7 +68,7 @@
               class="video-item"
               :ref="`gridVideoItem_${index}`"
               v-for="(item, index) in videoWrapArr"
-              :key="index"
+              :key="item.id"
             >
               <div style="display: none"></div>
               <div class="currentPlayer">
@@ -89,7 +88,7 @@
               class="video-item"
               :ref="`gridVideoItem_${index}`"
               v-for="(item, index) in videoWrapArr"
-              :key="index"
+              :key="item.id"
               @click="checkCurVideo(index)"
               style="position: relative"
               @mouseenter.stop.prevent="videoMouseEnter($event)"
@@ -122,7 +121,7 @@
               <el-tooltip
                 placement="top"
                 v-for="(item, index) in eventMarks"
-                :key="index"
+                :key="item.offset + index"
               >
                 <div slot="content">
                   {{ getTimeStr(item.offset) }}
@@ -131,17 +130,14 @@
                 </div>
                 <div
                   class="self-dot"
+                  :class="getColor(item.text)"
                   :style="{
                     left: (item.offset / maxSecond) * 100 + '%',
                   }"
                   @click="dotJump(item.offset)"
                 ></div>
               </el-tooltip>
-              <el-tooltip
-                placement="top"
-                v-for="(item, index) in labelMarks"
-                :key="index"
-              >
+              <el-tooltip placement="top" v-for="(item, index) in labelMarks" :key="index">
                 <div slot="content">
                   {{ getTimeStr(item.offset) }}
                   <br />
@@ -210,23 +206,14 @@
                 v-show="isUnusual == 1"
                 type="primary"
                 @click="addLabel(curVideo)"
-                >娣诲姞鏍囨敞</el-button
-              >
+              >娣诲姞鏍囨敞</el-button>
             </div>
             <div class="flex-box fixed-height-box">
               <label v-if="!showTable">鏍囨敞淇℃伅:</label>
               <div class="mark-list" v-if="!showTable">
-                <div
-                  class="mark"
-                  v-for="mark in curVideo.LableLst"
-                  :key="mark.ID"
-                >
+                <div class="mark" v-for="mark in curVideo.LableLst" :key="mark.ID">
                   <div class="time">
-                    <span>
-                      {{ pad0(Math.floor(mark.Time / 60)) }}:{{
-                        pad0(mark.Time % 60)
-                      }}
-                    </span>
+                    <span>{{ pad0(Math.floor(mark.Time / 60)) }}:{{ pad0(mark.Time % 60) }}</span>
                     <i class="el-icon-edit" @click="editCurLabel(mark)"></i>
                     <i class="el-icon-delete" @click="removeCurLabel(mark)"></i>
                   </div>
@@ -256,7 +243,7 @@
           </div>
           <div>
             <label>鏃堕棿:</label>
-            <span>{{ videoDetails.VideoDate }}</span>
+            <span>{{ videoDetails.StartTime }}</span>
           </div>
           <div>
             <label>鍙告満 | 鍓徃鏈�:</label>
@@ -283,19 +270,12 @@
       <div class="label-check">
         <p class="label">闅愭偅闂:</p>
         <el-checkbox-group v-model="labelCheckedList">
-          <el-checkbox
-            v-for="item in labelOptions"
-            :key="item.ID"
-            :label="item.ID"
-            >{{ item.Name }}</el-checkbox
-          >
+          <el-checkbox v-for="item in labelOptions" :key="item.ID" :label="item.ID">{{ item.Name }}</el-checkbox>
         </el-checkbox-group>
       </div>
       <div class="btns">
         <el-button @click="cancelLabelChecked" size="small">鍙栨秷</el-button>
-        <el-button @click="submitLabelChecked" size="small" type="primary"
-          >纭畾</el-button
-        >
+        <el-button @click="submitLabelChecked" size="small" type="primary">纭畾</el-button>
       </div>
     </el-dialog>
   </div>
@@ -303,9 +283,6 @@
 
 <script>
 import {
-  getlstInit,
-  updateVideoAnalyze,
-  getlst,
   getRelatedVideoInfo,
   getCarVideos,
   getLabelMap,
@@ -375,7 +352,6 @@
       setLabelTime: 0,
       isCheckAllVideo: 1,
       curRoomVideos: [],
-      popDownArr: [],
       curCamera: "",
       showTable: false,
       showLocChoise: true,
@@ -414,9 +390,13 @@
     },
   },
   mounted() {
+
     this.renderLabelOpts();
+
     this.setGuid(1);
+
     this.getCurVideos(this.videoDetails);
+
     this.getRelatedVideos(this.videoDetails);
   },
   destroyed() {
@@ -491,7 +471,6 @@
       } else {
         this.videoArrs.forEach((v, i) => {
           this.$refs[`player_${v.id}`][0].seek(val);
-          // this.$refs[`player_${v.ID}`][0].play();
           if (i == 0) {
             let curT = this.$refs[`player_${v.id}`][0].getCurrentTime();
           }
@@ -546,11 +525,14 @@
       }
     },
     handleCommand(cmd) {
+      console.log(cmd)
+      console.log(this.$refs)
+
       let _this = this;
       _this.curVideo = cmd;
       _this.curCamera = _this.curVideo.CameraPosition;
-
       _this.$nextTick(() => {
+        console.log(_this.$refs)
         _this.$refs[`player_${_this.curVideo.id}`][0].init();
       });
     },
@@ -574,7 +556,11 @@
           item.marks = _this.mergeMarks(item);
         });
 
+        _this.allCurVideos = res.data;
+
         _this.curVideo = res.data.find((item) => item.id == v.id);
+
+        _this.refreshCurVideoLabel(_this.curVideo)
 
         // 璁剧疆涓嬫媺鑿滃崟閫変腑椤�
         _this.curCamera = _this.curVideo.CameraPosition;
@@ -591,13 +577,9 @@
           _this.maxVideoTime = _this.curVideo.VideoTime;
         }
 
-        _this.videoArrs = res.data.filter((item) => v.GroupID == item.GroupID);
-        _this.allCurVideos = res.data;
-        console.log(_this.allCurVideos);
         _this.curRoomVideos = _this.allCurVideos.filter((item) => {
           return item.IsCab == "0";
         });
-
         _this.$nextTick(() => {
           _this.$refs[`player_${_this.curVideo.id}`][0].init();
           let arr = _this.maxVideoTime.split(":");
@@ -607,56 +589,47 @@
         });
       });
     },
-    getRelatedVideos(video) {
-      let _this = this;
-      getRelatedVideoInfo({ GroupID: video.GroupID }).then((res) => {
-        res.data.forEach((item) => {
-          _this.popDownArr.push(item);
-        });
-        // _this.popDownArr = res.data
-        if (_this.popDownArr.length) {
-          _this.curCamera = _this.popDownArr[0].CameraPosition;
-        }
-      });
-      _this.popDownArr;
-    },
     renderLabelOpts() {
       let _this = this;
       getLabelMap().then((res) => {
         _this.labelOptions = res.data;
       });
     },
-    refreshCurVideoLabel(video) {
-      let _this = this;
-      _this.popDownArr = [];
-      getRelatedVideoInfo({ GroupID: video.GroupID }).then((res) => {
-        res.data.forEach((item) => {
-          _this.popDownArr.push(item);
-          if (item.ID === video.ID) {
-            video.LableLst = item.LableLst;
-          }
-        });
-      });
-      _this.popDownArr;
+    getColor(text){
+      if (text.indexOf('杩涘嚭绔�')>-1) {
+        return 'yellow'
+      }
+      if (text.indexOf('淇″彿鏈�')>-1) {
+        return 'purple'
+      }
+      if (text.indexOf('杩囧垎鐩�')>-1) {
+        return 'blue'
+      }
+      return ''
     },
-    checkVideo(video, index) {
+    refreshCurVideoLabel(video) {
+      let arr = [video]
+      this.videoArrs = arr.concat(this.allCurVideos.filter(v => {
+        return v.GroupID == video.GroupID && v.id != video.id
+      }))
+    },
+    checkVideo(video) {
+      console.log(video)
       this.refreshCurVideoLabel(video);
       this.curVideo = video;
       this.eventMarks = []
       this.labelMarks = []
       video.marks.forEach((item) => {
-         if (item.type == 0) {
+        if (item.type == 0) {
           this.eventMarks.push(item);
         } else {
           this.labelMarks.push(item);
         }
       })
 
-      this.videoArrs = this.allCurVideos.filter(
-        (item) => video.GroupID == item.GroupID
-      );
       this.$nextTick(() => {
         this.$refs[`player_${this.curVideo.id}`][0].init();
+        console.log(this.$refs)
       });
     },
     setGuid(guid) {
@@ -672,14 +645,11 @@
       this.videoWrapArr = Math.pow(guid, 2);
       this.$nextTick(() => {
         for (var i = 0; i < Math.pow(guid, 2); i++) {
-          console.log(`calc(` + 100 / guid + `% -10px)`);
           this.$refs[`gridVideoItem_${i}`][0].style.width =
             `calc(` + 100 / guid + `%)`;
           this.$refs[`gridVideoItem_${i}`][0].style.height =
             `calc(` + 100 / guid + `%)`;
-          // this.$refs["playerWrap"].offsetHeight / guid + "px";
         }
-        // console.log(this.$refs[`player_${this.videoArrs[index].ID}`]);
       });
     },
     cancelLabelChecked() {
@@ -692,9 +662,13 @@
     submitLabelChecked() {
       let _this = this;
       let tempArr = [];
+      let isAdd  = false
       tempArr = this.videoArrs.map((video) => video.id);
       let desc = this.labelCheckedList.map((lableId) => {
         for (let label of this.labelOptions) {
+          if (label.Name=='鏈墜姣�') {
+            isAdd=true
+          }
           if (label.ID == lableId) {
             return label.Name;
           }
@@ -727,6 +701,11 @@
           // 鏍囨敞
           _this.setMarks(_this.curVideo);
           _this.$parent.$parent.filterSearchData();
+
+          if (isAdd) {
+            let num = sessionStorage.getItem("shoubiNum")
+          sessionStorage.setItem("shoubiNum", num?+num+1:1 )
+          }
         } else {
           _this.$message.warning(rsp.msg);
         }
@@ -916,6 +895,18 @@
               -webkit-transform: translateX(-50%);
               transform: translateX(-50%);
             }
+            .yellow{
+              background-color: yellow;
+
+            }
+            .purple{
+              background-color: purple;
+
+            }
+            .blue{
+              background-color: blue;
+
+            }
             .label-dot {
               position: absolute;
               height: 8px;

--
Gitblit v1.8.0