zhangzengfei
2022-07-20 4a800a8fc83c6bd1f86a8e847b079a51a7532c09
src/pages/shuohuangMonitorAnalyze/components/searchForVideoAnalyze.vue
@@ -26,31 +26,40 @@
          v-show="!checkedConfigs.length"
          class="tip"
          style="padding-left: 5px; margin-top: 3px"
        >还未选择筛选条件</span>
        <div class="config-item" v-for="(config, index) in checkedConfigs" :key="index">
          <span class="title">{{ config.title }}</span>&nbsp;:
          >还未选择筛选条件</span
        >
        <div
          class="config-item"
          v-for="(config, index) in checkedConfigs"
          :key="index"
        >
          <span class="title">{{ config.title }}</span
          >&nbsp;:
          <span class="val" v-for="option in config.data" :key="option.id">
            <!-- <template>
              <div>
              </div>
            </template>-->
            <span v-if="option.isChecked" class="val-show">
              {{ option.name }}
              <i>、</i>
            </span>
          </span>
          <i class="el-icon-close remove" @click="removeCheckedConfig(config)"></i>
          <i
            class="el-icon-close remove"
            @click="removeCheckedConfig(config)"
          ></i>
        </div>
        <el-button
          class="clear-config-btn"
          v-if="checkedConfigs.length"
          size="mini"
          @click="clearCheckedConfigs"
        >取消选择</el-button>
          >取消选择</el-button
        >
      </div>
      <div class="optional-config">
        <div class="config" v-for="(config, index) in optionalConfigs" :key="index">
        <div
          class="config"
          v-for="(config, index) in optionalConfigs"
          :key="index"
        >
          <template v-if="config.isShow">
            <div class="title">{{ config.title }}</div>
            <div class="options-wrap">
@@ -59,23 +68,41 @@
                :ref="'options' + config.id"
                :style="{ height: fixedOneLineHeight + 'px' }"
              >
                <div class="option" v-for="(option, index) in config.data" :key="index">
                <div
                  class="option"
                  v-for="(option, index) in config.data"
                  :key="index"
                >
                  <div v-show="config.isMultCheck">
                    <el-checkbox v-model="option.isChecked"></el-checkbox>
                    <span>{{ option.name }}</span>
                  </div>
                  <div v-show="!config.isMultCheck" @click="checkOption(config, option)">
                  <div
                    v-show="!config.isMultCheck"
                    @click="checkOption(config, option)"
                  >
                    <span>{{ option.name }}</span>
                  </div>
                </div>
              </div>
              <div class="btns text-center" v-show="config.isMultCheck">
                <el-button size="mini" @click="cancleMultCheck(config)">取消</el-button>
                <el-button size="mini" type="primary" @click="checkOption(config)">确定</el-button>
                <el-button size="mini" @click="cancleMultCheck(config)"
                  >取消</el-button
                >
                <el-button
                  size="mini"
                  type="primary"
                  @click="checkOption(config)"
                  >确定</el-button
                >
              </div>
            </div>
            <div class="right-btns">
              <div class="more" v-if="config.showMore" @click="showMore(config)">
              <div
                class="more"
                v-if="config.showMore"
                @click="showMore(config)"
              >
                <span>更多</span>&nbsp;
                <i
                  :class="
@@ -98,7 +125,11 @@
        <div class="config" v-if="showAdvance">
          <div class="title">高级选项</div>
          <div>
            <el-menu class="el-menu-demo" mode="horizontal" @select="handleSelect">
            <el-menu
              class="el-menu-demo"
              mode="horizontal"
              @select="handleSelect"
            >
              <el-submenu
                class="config-submenu"
                :popper-append-to-body="false"
@@ -113,7 +144,8 @@
                  :index="index + '-' + ind"
                  @click="checkOption(config, option)"
                  class="highlevel-option"
                >{{ option.name }}</el-menu-item>
                  >{{ option.name }}</el-menu-item
                >
              </el-submenu>
            </el-menu>
          </div>
@@ -124,14 +156,22 @@
      <div class="header-bar clearfix">
        <div class="left">
          <div>
            <el-select v-model="IsFollow" size="mini" @change="filterSearchData">
            <el-select
              v-model="IsFollow"
              size="mini"
              @change="filterSearchData"
            >
              <el-option value label="全部"></el-option>
              <el-option :value="false" label="未关注"></el-option>
              <el-option :value="true" label="已关注"></el-option>
              <el-option :value="'1'" label="未关注"></el-option>
              <el-option :value="'0'" label="已关注"></el-option>
            </el-select>
          </div>
          <div>
            <el-select v-model="IsOperate" size="mini" @change="filterSearchData">
            <el-select
              v-model="IsOperate"
              size="mini"
              @change="filterSearchData"
            >
              <el-option value label="全部"></el-option>
              <el-option value="0" label="未处理"></el-option>
              <el-option value="1" label="已处理"></el-option>
@@ -147,7 +187,11 @@
            >
              <i class="el-icon-menu"></i>
            </div>
            <div class="type" :class="{ current: showType == 'list' }" @click="checkType('list')">
            <div
              class="type"
              :class="{ current: showType == 'list' }"
              @click="checkType('list')"
            >
              <i class="el-icon-s-operation"></i>
            </div>
          </div>
@@ -155,7 +199,14 @@
      </div>
      <div class="content" v-show="showType == 'menu'">
        <el-row :gutter="20">
          <el-col :xs="8" :sm="6" :md="6" :lg="6" v-for="data in tabData" :key="data.id">
          <el-col
            :xs="8"
            :sm="6"
            :md="6"
            :lg="6"
            v-for="data in tabData"
            :key="data.id"
          >
            <div class="card">
              <div class="video-wrap" @click="checkVideoDetail(data)">
                <img :src="data.VideoCover | fixPath" alt />
@@ -172,7 +223,7 @@
                  </div>
                  <div class="flex-box">
                    <label>时间:</label>
                    <span>{{ data.VideoDate }}</span>
                    <span>{{ data.StartTime }}</span>
                  </div>
                  <div class="flex-box">
                    <label>司机 | 副司机:</label>
@@ -180,22 +231,31 @@
                  </div>
                </div>
                <div class="mark-info">
                  <div class="abnormal" v-if="data.LableLst && data.LableLst.length">
                  <div
                    class="abnormal"
                    v-if="data.LableLst && data.LableLst.length"
                  >
                    <span
                      class="abnormal-label"
                      v-for="(label, index) in data.LableLst"
                      :key="index"
                    >
                      {{
                      label.Desc +
                      (index == data.LableLst.length - 1 ? "" : ",")
                        label.Desc +
                        (index == data.LableLst.length - 1 ? "" : ",")
                      }}
                    </span>
                  </div>
                  <div v-else-if=" hasError(data)">
                    <span style="color:orangered;">有异常</span>
                  </div>
                  <div v-else>
                    <span>无异常</span>
                  </div>
                  <div class="event-tag" v-if="data.EventLst && data.EventLst.length">
                  <div
                    class="event-tag"
                    v-if="data.EventLst && data.EventLst.length"
                  >
                    <el-tag
                      size="mini"
                      type="info"
@@ -203,15 +263,25 @@
                      :key="index"
                      style="margin-right: 5px; margin-bottom: 5px"
                      @click="checkEventVideo(label)"
                    >{{ label.Event }}</el-tag>
                      >{{ label.Event }}</el-tag
                    >
                  </div>
                </div>
                <div class="tag-info">
                  <div class="tag" v-for="(tag, index) in data.tags" :key="index">{{ tag }}</div>
                  <div
                    class="tag"
                    v-for="(tag, index) in data.tags"
                    :key="index"
                  >
                    {{ tag }}
                  </div>
                </div>
              </div>
              <div class="star" @click="toggleFollow(data)">
                <i class="iconfont" :class="[data.IsFollow ? 'follow' : '', 'iconguanzhu']"></i>
                <i
                  class="iconfont"
                  :class="[data.IsFollow == '0' ? 'follow' : '', 'iconguanzhu']"
                ></i>
              </div>
            </div>
          </el-col>
@@ -229,16 +299,31 @@
        ></el-pagination>
      </div>
      <div class="content" v-show="showType == 'list'">
        <el-table :data="tableData" fit ref="elTable" @row-click="checkVideoDetail">
        <el-table
          :data="tableData"
          fit
          ref="elTable"
          @row-click="checkVideoDetail"
        >
          <el-table-column label="名称" prop="VideoName" sortable width="500">
            <template slot-scope="scope" style="cursor: pointer">
              <div>{{ scope.row.VideoName }}</div>
            </template>
          </el-table-column>
          <el-table-column label="大小" prop="VideoSize" sortable></el-table-column>
          <el-table-column label="修改日期" prop="VideoUpdateDate" sortable></el-table-column>
          <el-table-column label="创建日期" prop="VideoCreateDate" sortable></el-table-column>
          <el-table-column label="大小" prop="VideoSize" sortable>
            <template slot-scope="scope" style="cursor: pointer">
              <div>
                {{ Math.round(+scope.row.VideoSize / (1024 * 1024)) + " MB" }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            label="视频时间"
            prop="StartTime"
            sortable
          ></el-table-column>
          <!-- <el-table-column label="创建日期" prop="VideoCreateDate" sortable></el-table-column> -->
          <el-table-column label="操作">
            <template slot-scope="scope">
@@ -246,11 +331,13 @@
                <div class="star">
                  <i
                    class="iconfont"
                    :class="[scope.row.IsFollow ? 'follow' : '', 'iconguanzhu']"
                    :class="[
                      scope.row.IsFollow == '0' ? 'follow' : '',
                      'iconguanzhu',
                    ]"
                    @click.stop="toggleFollow(scope.row)"
                  ></i>
                </div>
                <!-- <i class="el-icon-star-off" @click="toggleFollow(scope.row)"></i> -->
              </div>
            </template>
          </el-table-column>
@@ -289,7 +376,10 @@
            <span>播放视频</span>
          </div>
        </div>
        <video-analyze v-if="videoDialogVisible" :videoDetails="selectedVideo" />
        <video-analyze
          v-if="videoDialogVisible"
          :videoDetails="selectedVideo"
        />
      </el-dialog>
      <!-- </div> -->
@@ -311,11 +401,9 @@
<script>
import {
  getlstInit,
  updateVideoAnalyze,
  updateFollow,
  getlst,
  getRelatedVideoInfo,
  getLabelMap,
  delLabel,
  getEventVideo,
} from "@/api/shuohuang";
import VideoAnalyze from "./videoAnalyze";
@@ -329,11 +417,11 @@
  filters: {
    fixPath(str) {
      if (!str || str == undefined) {
        return ""
        return "";
      }
      return str.replace("/opt/vasystem", "")
    }
      return str.replace("/opt/vasystem", "");
    },
  },
  data() {
    return {
@@ -341,7 +429,7 @@
      keyword: "",
      IsFollow: "",
      searchTime: [
        new Date(2020, 0, 1, 0, 0, 0),
        new Date(2021, 0, 1, 0, 0, 0),
        new Date(2021, 11, 31, 23, 59, 59),
      ],
      curTabPage: 1,
@@ -390,7 +478,6 @@
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              //start.setHours(0,0,0);
              picker.$emit("pick", [start, end]);
            },
          },
@@ -428,10 +515,15 @@
  },
  methods: {
    checkEventVideo(label) {
      if (label.LKGID != "") {
        this.$message.warning("该事件没有相关联的视频");
        return;
      }
      this.eventDialogVisible = true;
      this.curEventDetail = label;
      let _this = this;
      getEventVideo({ Event: label.Event, LkgID: label.ParentID }).then(
      getEventVideo({ event: label.Event, videoId: label.VideoIds }).then(
        (res) => {
          _this.eventVideoArr = res.data;
          _this.curEvName = label.Event;
@@ -439,12 +531,20 @@
      );
    },
    closeDial() {
      this.videoDialogVisible = false
      this.selectedVideo = {}
      this.videoDialogVisible = false;
      this.selectedVideo = {};
    },
    handleTabSizeChange(size) {
      this.tabPageSize = size;
      this.filterSearchData();
    },
    hasError(data){
      if (!data.EventLst||data.EventLst.length==0) {
        return false
      }
      const t =  data.EventLst.some((x) => x.state==0)
      return t && data.IsOperate=="1"
    },
    handleTableSizeChange(size) {
      this.tablePageSize = size;
@@ -456,14 +556,6 @@
    //二级查询
    filterSearchData() {
      let _this = this;
      let isFollow = "";
      if (this.IsFollow === "") {
        isFollow = "";
      } else if (!!this.IsFollow) {
        isFollow = "1";
      } else {
        isFollow = "0";
      }
      let query = {
        KeyWord: this.keyword,
        StartDate: this.searchTime[0],
@@ -473,7 +565,7 @@
        PageSize:
          this.showType == "list" ? this.tablePageSize : this.tabPageSize,
        IsDetail: this.showType == "list",
        IsFollow: isFollow,
        IsFollow: this.IsFollow ,
        IsOperate: this.IsOperate,
      };
      let filterQuerys = [];
@@ -499,7 +591,7 @@
          _this.tabData = _this.tabData.map(function (item) {
            const set = new Set();
            item.LableLst.forEach(function (label) {
              label.Desc.split(",").forEach(function (d) {
              label.Desc.split(",").forEach(function (d) {
                set.add(d);
              });
            });
@@ -510,11 +602,16 @@
            item.LableLst = lblst;
            return item;
          });
          _this.tabData
        }
      });
    },
    //一级查询
    init() {
      if (this.checkedConfigs.length) {
        this.filterSearchData()
        return
      }
      let _this = this;
      let query = {
        KeyWord: this.keyword,
@@ -528,6 +625,18 @@
        IsFollow: this.IsFollow,
        IsOperate: this.IsOperate,
      };
      let filterQuerys = [];
      this.checkedConfigs.forEach((config) => {
        let checkedOpts = config.data.filter((option) => option.isChecked);
        if (checkedOpts.length) {
          var linkOpts = checkedOpts.map((opt) => opt.name);
          linkOpts = linkOpts.join(",");
          let obj = {};
          obj[config.NameEn] = linkOpts;
          filterQuerys.push(obj);
        }
      });
      Object.assign(query, ...filterQuerys);
      this.optionalConfigs = [];
      this.highLevelConfigs = [];
      getlstInit(query).then((res) => {
@@ -540,7 +649,7 @@
          _this.tabData = _this.tabData.map(function (item) {
            const set = new Set();
            item.LableLst.forEach(function (label) {
              label.Desc.split(",").forEach(function (d) {
              label.Desc.split(",").forEach(function (d) {
                set.add(d);
              });
            });
@@ -552,15 +661,8 @@
            return item;
          });
        }
        res.filterlst.forEach((config) => {
          this.$set(config, "isShow", true);
          // config.data = Object.keys(config.Node).map(key => {
          //   let obj = {};
          //   obj.name = key;
          //   obj.id = config.Node[key]
          //   return obj
          // });
          config.data = config.Node.map((item) => {
            let obj = {};
            obj.name = item[0];
@@ -592,33 +694,26 @@
              config.showMore = false;
            }
          });
          console.log(this.optionalConfigs);
        });
      });
    },
    toggleFollow(data) {
      data.IsFollow = !data.IsFollow;
      this.updataVideo(data);
      if (data.IsFollow) {
      data.IsFollow == "0" ? (data.IsFollow = "1") : (data.IsFollow = "0");
      updateFollow({
        id: data.id,
        IsFollow: data.IsFollow,
      }).then((res) => {
        this.$notify({
          type: "success",
          message: "已添加关注!",
          message: data.IsFollow == "0" ? "已添加关注!" : "已取消关注!",
        });
      }
    },
    updataVideo(data) {
      let _this = this;
      updateVideoAnalyze(data).then((res) => {
        //二级查询
      });
    },
    checkVideoDetail(data) {
      let _this = this;
      _this.selectedVideo = data;
      _this.videoDialogVisible = true;
    },
    checkFollow() { },
    checkType(type) {
      this.showType = type;
      this.filterSearchData();
@@ -649,15 +744,11 @@
        option.isChecked = true;
      }
      this.checkedConfigs.push(config);
      config.isShow = false;
      config.isMultCheck = false;
      if (config.IsAdvanced) {
        this.showAdvance = false;
      }
      // this.$nextTick(() => {
      //   this.$set(config, 'isShow', false)
      // })
    },
    cancleMultCheck(config) {
@@ -666,7 +757,7 @@
        opt.isChecked = false;
      });
    },
    handleSelect(key, keyPath) { },
    handleSelect(key, keyPath) {},
    showMore(config) {
      config.isShowMore = !config.isShowMore;
      this.$refs[`options${config.id}`][0].style.height = config.isShowMore
@@ -721,43 +812,42 @@
      };
    },
    resize(el, binding, vnode) {
      const dragDom = el.querySelector('.el-dialog')
      dragDom.style.overflow = 'hidden'
      let minWidth = 400
      let minHeight = 300 //
      const dragDom = el.querySelector(".el-dialog");
      dragDom.style.overflow = "hidden";
      let minWidth = 400;
      let minHeight = 300; //
      // 拉伸
      let resizeEl = document.createElement('div')
      dragDom.appendChild(resizeEl) // 在弹窗右下角加上一个10-10px的控制块
      resizeEl.style.cursor = 'nwse-resize'
      let resizeEl = document.createElement("div");
      dragDom.appendChild(resizeEl); // 在弹窗右下角加上一个10-10px的控制块
      resizeEl.style.cursor = "nwse-resize";
      // resizeEl.style.cursor = 'se-resize'
      resizeEl.style.position = 'absolute'
      resizeEl.style.height = '12px'
      resizeEl.style.width = '12px'
      resizeEl.style.right = '0px'
      resizeEl.style.bottom = '0px' //鼠标拉伸弹窗
      resizeEl.style.background = 'url("/images/desktop/resize.png") no-repeat' //鼠标拉伸弹窗
      resizeEl.style.position = "absolute";
      resizeEl.style.height = "12px";
      resizeEl.style.width = "12px";
      resizeEl.style.right = "0px";
      resizeEl.style.bottom = "0px"; //鼠标拉伸弹窗
      resizeEl.style.background = 'url("/images/desktop/resize.png") no-repeat'; //鼠标拉伸弹窗
      resizeEl.onmousedown = (e) => {
        // 记录初始x位置
        const clientX = e.clientX // 鼠标按下,计算当前元素距离可视区的距离
        const disX = e.clientX - resizeEl.offsetLeft
        const disY = e.clientY - resizeEl.offsetTop
        const clientX = e.clientX; // 鼠标按下,计算当前元素距离可视区的距离
        const disX = e.clientX - resizeEl.offsetLeft;
        const disY = e.clientY - resizeEl.offsetTop;
        document.onmousemove = function (e) {
          e.preventDefault() // 移动时禁用默认事件 // 通过事件委托,计算移动的距离
          e.preventDefault(); // 移动时禁用默认事件 通过事件委托,计算移动的距离
          const x = e.clientX - disX + (e.clientX - clientX) //这里 由于elementUI的dialog控制居中的,所以水平拉伸效果是双倍
          const y = e.clientY - disY //比较是否小于最小宽高
          dragDom.style.width = x > minWidth ? `${x}px` : minWidth + 'px'
          dragDom.style.height =
            y > minHeight ? `${y}px` : minHeight + 'px'
        } //拉伸结束
          const x = e.clientX - disX + (e.clientX - clientX); //这里 由于elementUI的dialog控制居中的,所以水平拉伸效果是双倍
          const y = e.clientY - disY; //比较是否小于最小宽高
          dragDom.style.width = x > minWidth ? `${x}px` : minWidth + "px";
          dragDom.style.height = y > minHeight ? `${y}px` : minHeight + "px";
        }; //拉伸结束
        document.onmouseup = function (e) {
          document.onmousemove = null
          document.onmouseup = null
        }
      }
          document.onmousemove = null;
          document.onmouseup = null;
        };
      };
    },
  },
};
@@ -765,7 +855,6 @@
<style lang="scss">
.search-for-video-analyze {
  //padding: 20px 30px;
  //出横向滚动条
  padding: 20px 40px;
  .flex-box {
@@ -897,8 +986,6 @@
        }
        .config-submenu {
          .el-menu--horizontal {
            //max-width: 700px;
            //overflow-x: auto;
            left: 20px !important;
            & > ul {
              flex-wrap: wrap;
@@ -975,10 +1062,6 @@
      margin: 0 -30px;
      margin-bottom: -30px;
      padding: 0;
      // .el-row {
      //   display: flex;
      //   flex-wrap: wrap;
      // }
      .el-table__row {
        cursor: pointer;
      }
@@ -1012,9 +1095,6 @@
            width: 100%;
            height: 100%;
            object-fit: contain;
            // width: 100%;
            // max-height: 200px;
            // border-radius: 3px;
          }
        }
        .video-info {
@@ -1090,15 +1170,12 @@
      top: -22px;
    }
    .dialog-video {
      // z-index: 2020 !important;
      .el-dialog {
        width: 1180px;
        // height: 893px;
      }
      .el-dialog__body {
        background: #eaeaea;
        padding: 0;
        // height: 100%;
        height: inherit;
      }
      .el-dialog__header {
@@ -1142,8 +1219,6 @@
.window-view {
  width: 100%;
  height: auto;
  // height: 100%;
  // min-height: 684px;
  overflow: auto;
  z-index: 2000;
}