heyujie
2021-03-16 03fbaa3ebea4cd30ad798a4ec5c27dbb2c2daf86
src/pages/shuohuangMonitorAnalyze/components/videoAnalyze.vue
@@ -2,6 +2,16 @@
  <div class="video-analyze-content">
    <div class="content-top">
      <div class="grid-check">
       <el-dropdown trigger="click" :popper-append-to-body="false" @command="handleCommand" v-show="showLocChoise">
        <span class="el-dropdown-link">
          {{curCamera}}<i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item v-for="(item,index) in popDownArr" :key="index" :command="item">{{item.Camera}}</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
        <span
          :class="
            guid === 1
@@ -30,19 +40,17 @@
      <div class="video-area">
        <div class="info-list block">
          <p class="title-partment">相关视频</p>
          <!-- <div class="video-name" v-for="video in videoDetails.videoList" :key="video.id">
                  <i class="el-icon-film"></i>
                  <span>{{video.name}}</span>
          </div>-->
          <div
          <div class="v-name-block">
            <div
            class="video-name"
            :class="{ current: curVideo.ID == video.ID }"
            @click="checkVideo(video, index)"
            v-for="(video, index) in relativeVideos"
            v-for="(video, index) in curRoomVideos"
            :key="video.ID"
          >
            <i class="el-icon-film"></i>
            <span>{{ video.Camera }}</span>
            <span>{{ video.VideoDate }}</span>
          </div>
          </div>
        </div>
        <div class="players" ref="playerWrap">
@@ -71,16 +79,20 @@
              v-for="(item, index) in videoWrapArr"
              :key="index"
              @click="checkCurVideo(index)"
              style="position: relative;"
            >
              <template v-if="index <= videoArrs.length - 1">
                <div
                  :class="{ currentPlayer: curVideo.ID == videoArrs[index].ID }"
                  :class="{ currentPlayer: curVideo.ID == videoArrs[index].ID,videoZone:true }"
                  @mouseover="overShowLoc(index)"
                >
                  <!-- @mouseover="" -->
                  <!-- {{videoArrs[index].ID}} -->
                  <!-- <img
                    :src="videoArrs[index].VideoCover"
                    style="width:100px"
                  />-->
                  <div class="pos-desc"  style="position: absolute;top: 5px;left: 10px;color: #fff;z-index: 1;height: fit-content;background-color: black;">{{videoArrs[index].Camera}}</div>
                  <ali-player
                    :source="videoArrs[index].VideoPath"
                    :markers="videoArrs[index].marks"
@@ -90,28 +102,19 @@
              </template>
            </div>
          </template>
          <!-- <div
                  class="video-item"
                  :class="{'active':item.ID==curVideo.ID}"
                  :ref="`gridVideoItem_${index}`"
                  v-for="(item,index) in videoWrapArr"
                  :key="index"
                >
          </div>-->
        </div>
      </div>
    </div>
    <div class="content-bottom">
      <div class="bot-left block">
        <p class="title-partment">快速标注</p>
        <div class="flex-box" style="height: 28px">
      <div class="bot-left ">
        <!-- <p class="title-partment">快速标注</p> -->
         <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="快速标注" name="first"> <div class="flex-box" style="height: 28px">
          <label style="padding-right: 10px">隐患问题:</label>
          <el-radio-group v-model="isUnusual">
            <el-radio :label="0">无异常</el-radio>
            <el-radio :label="1">有异常</el-radio>
          </el-radio-group>
          <el-button
            icon="el-icon-plus"
            size="mini"
@@ -122,8 +125,8 @@
          >
        </div>
        <div class="flex-box fixed-height-box">
          <label>标注信息:</label>
          <div class="mark-list">
          <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="time">
                <span
@@ -139,7 +142,17 @@
              </div>
            </div>
          </div>
        </div>
        </div></el-tab-pane>
            <!-- <div class="flex-box fixed-height-box2"></div> -->
            <dataset-chart style="width:100%" v-if="showTable"></dataset-chart>
          <el-tab-pane label="里程标" name="second">
        </el-tab-pane>
        </el-tabs>
      </div>
      <div class="bot-right block">
        <p class="title-partment">视频详情</p>
@@ -157,8 +170,8 @@
            <span>{{ videoDetails.VideoDate }}</span>
          </div>
          <div>
            <label>司机|副司机:</label>
            <span>{{ videoDetails.Driver1 }}|{{ videoDetails.Driver2 }}</span>
            <label>司机 | 副司机:</label>
            <span>{{ videoDetails.Driver1 }} | {{ videoDetails.Driver2 }}</span>
          </div>
        </div>
      </div>
@@ -169,14 +182,16 @@
      :visible="labelDialogVisible"
      @close="labelDialogVisible = false"
      :append-to-body="false"
        :modal="false"
    >
      <div class="label-radio">
      <!-- <div class="label-radio">
        <p class="label">选择将要标注的视频:</p>
        <el-radio-group v-model="isCheckAllVideo">
          <el-radio :label="1">标注在全部位置的视频段</el-radio>
          <el-radio :label="0">仅标注选中的视频段</el-radio>
        </el-radio-group>
      </div>
      </div> -->
      <div class="label-check">
        <p class="label">隐患问题:</p>
        <el-checkbox-group v-model="labelCheckedList">
@@ -204,16 +219,19 @@
  updateVideoAnalyze,
  getlst,
  getRelatedVideoInfo,
  getCarVideos,
  getLabelMap,
  delLabel,
  editLabel,
} from "@/api/shuohuang";
import DatasetChart from './charts/datasetForVideo';
import AliPlayer from "./aliPlayer/index";
export default {
  name: "VideoAnalyze",
  components: {
    AliPlayer,
    DatasetChart,
  },
  props: {
    videoDetails: {
@@ -231,12 +249,19 @@
      isUnusual: "",
      videoArrs: [],
      relativeVideos: [],
      allCurVideos:[],
      labelCheckedList: [],
      videoWrapArr: [],
      labelOptions: [],
      selectedLabelId: "",
      setLabelTime: 0,
      isCheckAllVideo: 1,
      curRoomVideos:[],
      popDownArr:[],
      curCamera:"",
      showTable:false,
      showLocChoise:true,
      activeName:"first",
    };
  },
  watch: {
@@ -252,18 +277,37 @@
    },
    videoDetails: {
      handler(newVal, oldVal) {
        this.getVideos(newVal);
        this.getCurVideos(newVal);
      },
      deep: true,
    },
  },
  mounted() {
    console.log("analyze mount");
    this.renderLabelOpts();
    this.setGuid(1);
    this.getVideos(this.videoDetails);
    this.getCurVideos(this.videoDetails);
    this.getRelatedVideos(this.videoDetails)
  },
  methods: {
    handleClick(instance){
      if (instance.name=="second") {
        this.showTable=true
      }else{
        this.showTable=false
      }
    },
    handleCommand(cmd){
      this.curCamera = cmd.Camera
      this.curRoomVideos = this.allCurVideos.filter(item=>{
        return item.Camera == cmd.Camera
      })
      this.curVideo= this.curRoomVideos.find(item=>{
        return item.UniqeID == this.curVideo.UniqeID
      })
       this.$nextTick(() => {
          _this.$refs[`player_${_this.curVideo.ID}`][0].init();
        });
    },
    zeroize(val) {
      return val < 10 ? "0" + val : val;
    },
@@ -273,21 +317,39 @@
        this.refreshCurVideoLabel(this.curVideo);
      }
    },
    getVideos(video) {
    getCurVideos(v){
      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);
        });
        _this.curVideo = res.data.find((item) => item.ID == video.ID);
        //_this.curVideo = res.data[0];
        _this.videoArrs = res.data;
        _this.relativeVideos = res.data;
        this.$nextTick(() => {
      getCarVideos({
        TrainNumber:v.TrainNumber,
        CarNumber:v.CarNumber,
        Driver1:v.Driver1,
      }).then(res=>{
        res.data.forEach(item=>{
          item.marks = _this.mergeMarks(item)
        })
        _this.curVideo=res.data.find((item) => item.ID == v.ID)
        // debugger
        _this.videoArrs = res.data.filter(item=> v.UniqeID== item.UniqeID);
        _this.allCurVideos = res.data;
        _this.curRoomVideos = _this.allCurVideos.filter(item=>{
          return item.Camera == "司机室"
        })
         this.$nextTick(() => {
          _this.$refs[`player_${_this.curVideo.ID}`][0].init();
        });
      })
    },
    getRelatedVideos(video) {
      let _this = this;
      getRelatedVideoInfo({ UniqeID: video.UniqeID }).then((res) => {
        let arr = []
        let map = {}
        res.data.forEach(item=>{
          this.popDownArr.push(item)
        })
        if (this.popDownArr.length) {
          this.curCamera=this.popDownArr[0].Camera
        }
      });
    },
    renderLabelOpts() {
@@ -308,8 +370,11 @@
      });
    },
    checkVideo(video, index) {
      // debugger
      this.refreshCurVideoLabel(video);
      this.curVideo = video;
      this.videoArrs = this.allCurVideos.filter(item=> video.UniqeID== item.UniqeID);
      this.$nextTick(() => {
        this.$refs[`player_${this.curVideo.ID}`][0].init();
      });
@@ -318,6 +383,11 @@
    setGuid(guid) {
      let _this = this;
      this.guid = guid;
      if (guid==1) {
        this.showLocChoise=true
      }else{
        this.showLocChoise=false
      }
      // for(var i = 0; i < Math.pow(guid,2); i++){
      //   if(i>this.videoArrs.length-1){
      //       this.videoWrapArr[i] = this.videoArrs[i]
@@ -342,9 +412,9 @@
    submitLabelChecked() {
      let _this = this;
      let tempArr = [];
      if (this.isCheckAllVideo == 1) {
      // if (this.isCheckAllVideo == 1) {
        tempArr = this.videoArrs.map((video) => video.ID);
      }
      // }
      let desc = this.labelCheckedList.map((lableId) => {
        for (let label of this.labelOptions) {
          if (label.ID == lableId) {
@@ -355,9 +425,7 @@
      let query = {
        ID: this.selectedLabelId,
        ParentID: this.isCheckAllVideo
          ? tempArr.join(",")
          : this.curVideo.ID + "",
        ParentID:  tempArr.join(","),
        ParentUniqID: this.curVideo.UniqeID + "",
        Time: Math.round(this.setLabelTime) + "",
        Codes: this.labelCheckedList.join(","),
@@ -443,15 +511,30 @@
<style lang="scss" >
.video-analyze-content {
  margin: 0;
  padding: 15px;
    padding: 6px 15px 15px 15px;
  text-align: left;
  .content-top {
    margin-bottom: 10px;
    .grid-check {
      text-align: right;
      margin-bottom: 6px;
         margin-bottom: 3px;
      position: relative;
      .el-dropdown{
        position: absolute;
        top: -4px;
        left: 200px;
      }
      .el-dropdown-link {
        cursor: pointer;
        color: #409EFF;
      }
      .el-icon-arrow-down {
        font-size: 12px;
      }
      span {
        font-size: 20px;
          font-size: 17px;
        color: #cacaca;
        padding-left: 12px;
        cursor: pointer;
@@ -463,8 +546,14 @@
    .video-area {
      display: flex;
      .info-list {
        width: 160px;
       width: 180px;
        margin-right: 10px;
        .v-name-block{
          height: 484px;
            overflow: auto;
        }
        .video-name {
          cursor: pointer;
          color: #777;
@@ -478,14 +567,16 @@
        }
      }
      .players {
        width: 960px;
        height: 540px;
          width: 940px;
        height: 530px;
        display: flex;
        flex-wrap: wrap;
        .video-item {
          background: black;
          border: 1px solid #fff;
          box-sizing: border-box;
          & > div {
            height: 100%;
            & > div {
@@ -508,6 +599,14 @@
    display: flex;
    .bot-left {
      flex: 1;
      padding: 0px 15px 8px 15px;
      background: #fff;
    border-radius: 3px;
    .el-tabs__header {
    padding: 0;
    position: relative;
    margin: 0 0 10px;
}
      .flex-box {
        align-items: baseline;
        label {
@@ -537,6 +636,10 @@
        height: 200px;
        overflow-y: auto;
      }
      .fixed-height-box2 {
        height: 228px;
        overflow-y: auto;
      }
    }
    .bot-right {
      width: 210px;
@@ -551,7 +654,7 @@
  .label-dialog {
    .el-dialog {
      width: 700px !important;
      height: 670px !important;
      height: 558px  !important;
      .el-dialog__header {
        height: 20px;
      }