hanbaoshan
2021-01-28 262119fd58357f1d930d65a6e3252176d29b2ce5
src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue
@@ -97,7 +97,7 @@
            <el-radio :label="0">无异常</el-radio>
            <el-radio :label="1">有异常</el-radio>
          </el-radio-group>
          <el-button
            icon="el-icon-plus"
            size="mini"
@@ -204,15 +204,15 @@
    }
  },
  watch: {
    'curVideo.LableLst':{
      handler(n,o){
        if(n.length>0){
    'curVideo.LableLst': {
      handler (n, o) {
        if (n.length > 0) {
          this.isUnusual = 1
        }else{
        } else {
          this.isUnusual = 0
        }
      },
      deep:true
      deep: true
    },
    videoDetails: {
      handler (newVal, oldVal) {
@@ -228,16 +228,16 @@
    this.getVideos(this.videoDetails);
  },
  methods: {
    checkCurVideo(index){
      if(this.relativeVideos[index]){
        this.curVideo = this.relativeVideos[index]
    checkCurVideo (index) {
      if (this.relativeVideos[index]) {
        this.curVideo = this.relativeVideos[index];
        this.refreshCurVideoLabel(this.curVideo);
      }
    },
    getVideos (video) {
      let _this = this;
      getRelatedVideoInfo({ UniqeID: video.UniqeID }).then(res => {
        console.log(res)
        res.data.forEach(element => {
          element.marks = _this.mergeMarks(element)
          console.log(element.marks)
@@ -245,10 +245,10 @@
        _this.curVideo = res.data[0];
        _this.videoArrs = res.data;
        _this.relativeVideos = res.data;
        this.$nextTick(()=>{
        this.$nextTick(() => {
          _this.$refs[`player_${_this.curVideo.ID}`][0].init();
        })
      })
    },
    renderLabelOpts () {
@@ -257,15 +257,24 @@
        _this.labelOptions = res.data
      })
    },
    refreshCurVideoLabel (video) {
      getRelatedVideoInfo({ UniqeID: video.UniqeID }).then(res => {
        res.data.forEach(d => {
          if(d.ID === video.ID){
            video.LableLst = d.LableLst
          }
          // let someVideo = _this.videoArrs.find(video => video.ID === d.ID);
          // someVideo.LableLst = d.LableLst
        })
      })
    },
    checkVideo (video, index) {
      this.refreshCurVideoLabel(video);
      this.curVideo = video;
      this.$nextTick(()=>{
      this.$nextTick(() => {
        this.$refs[`player_${this.curVideo.ID}`][0].init();
      })
      if (index > 0 && this.guid == 1) {
        //this.videoWrapArr =
      }
    },
    setGuid (guid) {
@@ -279,12 +288,10 @@
      //     }
      // }
      this.videoWrapArr = Math.pow(guid, 2);
      this.$nextTick(() => {
        for (var i = 0; i < Math.pow(guid, 2); i++) {
          this.$refs[`gridVideoItem_${i}`][0].style.width = this.$refs['playerWrap'].offsetWidth / guid + 'px';
          this.$refs[`gridVideoItem_${i}`][0].style.height = this.$refs['playerWrap'].offsetHeight / guid + 'px';
        }
      })
    },
@@ -305,28 +312,32 @@
          }
        }
      })
      let query = {
        ID: this.selectedLabelId,
        ParentID: this.isCheckAllVideo ? tempArr.join(',') : this.curVideo.ID + '',
        Time: Math.round(this.setLabelTime) + '',
        Codes: this.labelCheckedList.join(','),
        Desc: desc.join(',')
        Desc: desc.join(',')
      };
      editLabel(query).then(rsp => {
        if (rsp && rsp.success) {
          _this.labelDialogVisible = false;
          _this.videoArrs.forEach(video=>{
            video.LableLst = []
          });
          this.$set(_this.curVideo,'LableLst',[]);
          //_this.curVideo.LableLst = [];
          rsp.data.forEach(label=>{
            let someVideo = _this.videoArrs.find(video=>video.ID === label.ParentID);
            someVideo.LableLst.push(label);
            if(label.ParentID == _this.curVideo.ID){
               _this.curVideo.LableLst.push(label)
            }
          })
          //_this.curVideo.LableLst = rsp.data;
          this.$message.success("添加成功")
          // getRelatedVideoInfo({ UniqeID: _this.videoDetails.UniqeID }).then(res => {
          //   res.data.forEach(d => {
          //     let someVideo = _this.videoArrs.find(video => video.ID === d.ID);
          //     someVideo.LableLst = d.LableLst
          //   })
          // })
          this.$message.success("添加成功")
          // 标注
          _this.setMarks(this.curVideo)
        } else {
@@ -344,16 +355,18 @@
    },
    editCurLabel (mark) {
      this.selectedLabelId = mark.ID;
      this.labelCheckedList = mark.Codes.split(",");
      this.labelCheckedList = mark.Codes.split(" ,");
      this.labelDialogVisible = true;
    },
    removeCurLabel (mark) {
      let _this = this;
      delLabel({ ID: mark.ID, ParentID: this.curVideo.ID }).then(rsp => {
        if (rsp && rsp.success) {
          this.curVideo.LableLst = rsp.data;
          _this.curVideo.LableLst = rsp.data;
          this.$message.success("删除成功")
          // 标注
          this.setMarks(this.curVideo)
          debugger
          _this.setMarks(_this.curVideo)
        } else {
          this.$message.warning(rsp.msg)
        }
@@ -469,7 +482,7 @@
          }
        }
      }
      .fixed-height-box{
      .fixed-height-box {
        height: 200px;
        overflow-y: auto;
      }