hanbaoshan
2020-09-24 bb228ead0110a8626a0d0bceeea74522ff1a0a8f
数据栈独立场景显示文件底图
6个文件已修改
304 ■■■■ 已修改文件
src/components/canvas/Dialog.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/canvas/index.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/ai/index/App.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/DataStackInfo.vue 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/LinkageRule.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/SeparateRules.vue 234 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/canvas/Dialog.vue
@@ -97,11 +97,7 @@
          width="960"
          height="540"
          :style="
            `position:static;background:url(${
              snapshot_url
                ? `/httpImage/${snapshot_url}`
                : backImg
            }) 0% 0%/960px 540px no-repeat;`
            `position:static;background:url(${snapshot_url}) 0% 0%/960px 540px no-repeat;`
          "
        ></canvas>
        <p
src/components/canvas/index.vue
@@ -4,10 +4,10 @@
      ref="myCanvas"
      :width="canvasWidth"
      :height="canvasHeight"
      :style="`background:url(${snapshot_url ? `/httpImage/${snapshot_url}` : blackImg}) 100% 100% / 576px 324px; no-repeat; background-size: contain;`"
      :style="`background:url(${canvasBg}) center / 576px 324px no-repeat; background-size: contain;`"
    ></canvas>
    <el-tooltip content="刷新底图" placement="bottom" popper-class="atooltip">
    <el-tooltip content="刷新底图" placement="bottom" popper-class="atooltip" v-if="isShowRefresh">
      <span class="iconfont icongengxin" @click="refresh"></span>
    </el-tooltip>
    <p class="tip" :style="disabled ? `display:block;` : `display:none;`">批量配置方式不允许绘制区域,请选择摄像机进行区域绘制</p>
@@ -21,7 +21,7 @@
      <canvas-dialog
        ref="bigCanvas"
        :canvasDataToChild="canvasData"
        :snapshot_url="snapshot_url"
        :snapshot_url="canvasBg"
        @refresh="refresh"
      ></canvas-dialog>
      <span slot="footer" class="dialog-footer">
@@ -47,6 +47,14 @@
    isGB28181: {
      default: false,
      type: Boolean
    },
    isShowRefresh: {
      default: true,
      type: Boolean
    },
    sourceType: {
      default: 1,
      type: Number
    },
    isShowDrawArrow: {
      default: false,
@@ -87,6 +95,19 @@
      default: 324
    }
  },
  computed:{
    canvasBg(){
      if(this.snapshot_url){
        if(this.sourceType == 2){
          return `/files/${this.snapshot_url}`
        }else{
          return `/httpImage/${this.snapshot_url}`
        }
      }else{
        return this.blackImg;
      }
    }
  },
  data() {
    return {
      blackImg: require("../../assets/img/baseimg.png"),
src/pages/ai/index/App.vue
@@ -28,7 +28,7 @@
                        <div class="mask flex-center">
                          <div class="info-onmask">
                            <div>当前版本:{{item.version}}</div>
                            <div>远端版本:{{item.remoteVersion}}</div>
                            <div>最新版本:{{item.remoteVersion}}</div>
                          </div>
                          <el-button type="primary" class="bot-btn" @click="donwload(item)">升级</el-button>
                        </div>
src/pages/cameraAccess/components/DataStackInfo.vue
@@ -105,7 +105,7 @@
        </el-tooltip>
        <!-- 文件上传 -->
        <el-button type="primary" size="small" @click="handleUpload">
        <el-button type="primary" size="small" :disabled="!DataStackPool.selectedDir.id" @click="handleUpload">
          上传
          <i class="el-icon-upload el-icon--right"></i>
        </el-button>
@@ -129,10 +129,20 @@
        <template slot-scope="{row}">
          <div :class="snapshotClass">
            <el-image
              v-show="row.snapshot_url !== ''"
              v-if="row.type==1"
              style="width: 30x; height: 30px"
              :src="'/httpImage/' + row.snapshot_url"
              fit="fill"
              :preview-src-list="['/httpImage/' + row.snapshot_url]"
            >
              <div slot="error" :class="snapshotClass"></div>
            </el-image>
            <el-image
              v-if="row.type==2"
              style="width: 30x; height: 30px"
              :src="`/files/${row.identifier}.jpg`"
              fit="fill"
              :preview-src-list="[`/files/${row.identifier}.jpg`]"
            >
              <div slot="error" :class="snapshotClass"></div>
            </el-image>
@@ -254,7 +264,8 @@
    <!-- 文件预览 -->
    <el-dialog title="查看文件" :visible.sync="previewDialog" width="500px">
      <video :src="videoUrl" controls style="margin-top: 12px;">您的浏览器不支持 video 标签。</video>
      <video v-if="videoUrl" :src="videoUrl" controls style="margin-top: 12px;">您的浏览器不支持 video 标签。</video>
      <el-image v-if="imgUrl" :src="imgUrl"></el-image>
    </el-dialog>
    <el-dialog title="移动/复制" :visible.sync="fileDialog" width="500px">
@@ -364,6 +375,7 @@
  data() {
    return {
      videoUrl: "",
      imgUrl: "",
      previewDialog: false,
      fileDialog: false,
      isDisabled: true,
@@ -403,9 +415,13 @@
  },
  methods: {
    preview(row) {
      if (this.form.type === 1) {
        this.previewDialog = true;
      if (row.type === 1) {
        this.videoUrl = "/files/" + row.identifier + ".mp4"
      }else if(row.type===2){
        this.imgUrl = "/files/" + row.identifier + ".jpg"
      }
    },
    // 清空输入框
@@ -429,6 +445,7 @@
      this.fileList = [];
    },
    selectDir(node) {
      debugger
      if (node.id === "") {
        return
      }
@@ -451,6 +468,8 @@
      this.total = 0;
      this.multipleSelection = []; // 清空选中状态
      this.initFetchListTask();
      this.videoUrl = '';
      this.imgUrl = '';
    },
    initFetchListTask() {
      const uid = Math.round(Math.random() * 1000);
@@ -477,6 +496,7 @@
          // 定时刷新会清空选中状态,在这里恢复
          this.fileList.forEach(row => {
            //this.polygonDatas.push({snapshot_url:row.snapshot_url})
            if (this.multipleSelection.indexOf(row.id) !== -1) {
              this.$nextTick(() => {
                this.$refs.multipleTable.toggleRowSelection(row);
@@ -553,6 +573,7 @@
      this.multipleSelection = [];
    },
    handleUpload() {
      console.log(this.DataStackPool.selectedDir.id)
      console.log(this.$refs.uploader.$refs.button.$refs.btn.click())
    },
    handleRefrashFileList(val) {
@@ -719,6 +740,10 @@
  .el-form-item__label {
    text-align: left;
  }
  .el-button--primary.is-disabled{
    background-color: #9eb4f0 !important;
    border-color: #9eb4f0 !important;
  }
  .label {
    color: #606266;
    font-size: 14px;
src/pages/cameraAccess/components/LinkageRule.vue
@@ -208,7 +208,7 @@
      this.$nextTick(() => {
        this.Carmeras = [];
        this.loading = false;
        this.showSysInfo = true
        this.showSysInfo = true;
        if (this.TreeDataPool.treeActiveName == 'dataStack') {
          this.TreeDataPool.checkedLocalVedio.forEach(camera => {
            this.Carmeras.push(new VideoRuleData(camera.id));
src/pages/cameraAccess/components/SeparateRules.vue
@@ -15,11 +15,7 @@
            </span>
          </div>
          <div
            v-if="Camera.analytics"
            class="flex-box"
            v-show="cameraType === 'camera'"
          >
          <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'">
            <span class="label" >处理方式</span>
            <toggle-button
              :value="Camera.dealWay"
@@ -31,11 +27,7 @@
            />
          </div>
          <div
            v-if="Camera.analytics"
            class="flex-box"
            v-show="cameraType === 'camera'"
          >
          <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'">
            <span class="label" >分辨率</span>
            <el-select
              v-model="Camera.selectResolution"
@@ -57,10 +49,7 @@
            <span class="label" >智能计算节点: {{ Camera.runServerName}}</span>
          </div>
          <div
            v-if="Camera.analytics"
            class="flex-box"
          >
          <div v-if="Camera.analytics" class="flex-box">
            <span class="label">算法快速通道</span>
            <div class="channel flex-box" >
              <el-tooltip
@@ -133,6 +122,7 @@
              >{{ Camera.camearInfo.alias ? Camera.camearInfo.alias: Camera.camearInfo.name }}</b>
            </div>
            <div class="img-box">
              <template v-if="TreeDataPool.treeActiveName == 'camera'">
              <polygon-canvas
                class="cavas"
                ref="canvas"
@@ -152,6 +142,58 @@
                @changeLoading="changeLoading"
                @refresh="refresh"
              ></polygon-canvas>
              </template>
              <template v-else>
                <div style="width:100%" v-loading='getStackFileLoading'>
                  <swiper
                    ref="swiper"
                    :auto-update="true"
                    :options="canvasSwiperOption"
                    @slideChange="swiperSlideChange"
                    class="swiper-box-container2"
                    style="width:100%"
                  >
                    <swiper-slide v-for="(data, index) in swipercanvasData" :key="index">
                      <div>
                        <b
                          class="video-title"
                          style="font-size:14px;margin-top:-10px"
                        >{{ data.name }}</b>
                        <polygon-canvas
                          class="cavas"
                          ref="canvas"
                          v-if="showCanvas"
                          v-loading="loading"
                          element-loading-text="刷新中,请稍等..."
                          element-loading-background="rgba(0, 0, 0, 0.8)"
                          :isShowDrawArrow="false"
                          :isShowRefresh="false"
                          :sourceType="data.type"
                          :disabled="false"
                          :snapshot_url="data.baseImg"
                          :canvasDataShow="Camera.canvasData"
                          :currentCameraId="data.stackId"
                          :loading="data.loading"
                          :canvasWidth="canvasWidth"
                          :canvasHeight="canvasHeight"
                          @fromCanvas="getCanvasData"
                          @changeLoading="changeLoading"
                        ></polygon-canvas>
                      </div>
                    </swiper-slide>
                  </swiper>
                  <div class="swiper-local-prev" v-show="swipercanvasData.length>1" @click="prevClick">
                    <div class="icon-btn" slot="button-prev">
                      <i class="iconfont iconzuo"></i>
                    </div>
                  </div>
                  <div class="swiper-local-next" v-show="swipercanvasData.length>1" @click="nextClick">
                    <div class="icon-btn" slot="button-next">
                      <i class="iconfont iconyou1"></i>
                    </div>
                  </div>
                </div>
              </template>
            </div>
          </div>
          <div style="float:left;width:calc(10% - 90px);height:100%;"></div>
@@ -192,7 +234,7 @@
} from '@/api/scene'
import { changeRunType } from "@/api/pollConfig";
import { findAllFileByStackId } from "@/api/localVedio";
import VideoRuleData from "@/Pool/VideoRuleData";
import TimeSlider from "./TimeSlider";
@@ -201,6 +243,8 @@
import Sysinfo from "@/components/subComponents/SystemInfo";
import SceneRule from "./SceneRule";
import SlideScene from "./scene/SlideScene";
import { duration } from 'moment';
export default {
  components: {
@@ -228,6 +272,18 @@
      loading: false,
      Camera: new VideoRuleData(),
      runType: -1,
      getStackFileLoading: false,
      canvasSwiperOption: {
        grabCursor: true,
        pagination: {
          el: ".swiper-pagination",
          type: "fraction"
        },
        navigation: {
          nextEl: ".swiper-local-next",
          prevEl: ".swiper-local-prev"
        }
      },
      swiperOption: {
        slidesPerView: 5,
        spaceBetween: 8,
@@ -249,15 +305,107 @@
      showSysInfo: false,
      showCanvas: true,
      canvasWidth: 576,
      canvasHeight: 324
      canvasHeight: 324,
      stackId: '',
      swiperIndex: 0,
      swipercanvasData: [],
      stackFilesPage: 1,
      stackFilesSize: 5,
    };
  },
  mounted() {
    this.mockAsync();
    this.PollData.statistics();
  },
  },
  watch: {
    'Camera.cameraId':{
      handler(n,o){
        if (n) {
          if (this.TreeDataPool.treeActiveName == "dataStack") {
            this.stackFilesPage = 1;
            this.stackFilesSize = 5;
            this.stackId = n;
            if(this.stackId){
              this.swipercanvasData = [];
              this.getStackFiles()
            }
          }
        }
      }
    }
  },
  methods: {
    prevClick(){
      console.log(this.swiperIndex)
      console.log(this.$refs.swiper.swiper.activeIndex)
      if(this.swiperIndex == 0){
        console.log('本次分页的第一条')
        //请求上一页
        if(this.stackFilesPage > 1){
          this.stackFilesPage--;
          this.getStackFiles();
        }else{
          this.$message({
            type:'info',
            message:'当前已是第一页'
          });
        }
      }
    },
    nextClick(){
      console.log(this.swiperIndex)
      console.log(this.$refs.swiper.swiper.activeIndex)
      if(this.swiperIndex == this.swipercanvasData.length-1){
        console.log('最后一张,加载更多')
        //请求下一页
        this.stackFilesPage++;
        this.getStackFiles();
      }
    },
    getStackFiles () {
      this.getStackFileLoading = true;
      findAllFileByStackId({ name: '', stackId: this.stackId, page: this.stackFilesPage, size: this.stackFilesSize, type: 0 }).then(res => {
        if (res && res.success ) {
          if(res.data.dataList.length > 0){
            this.swipercanvasData = [];
            this.swipercanvasData = res.data.dataList.map(item => {
              return {
                name: item.name,
                stackId: item.stack_id,
                baseImg: item.type == 2 ? `/files/${item.identifier}.jpg` : item.snapshot_url,
                type: item.type,
                id: item.id,
                loading: false
              }
            });
            this.swiperIndex = 0;
            this.$refs.swiper.swiper.activeIndex = 0;
          }else{
            console.log(this.swipercanvasData)
            this.$message({
              type:'info',
              message:'已无更多数据!'
            });
          }
        }else{
          console.log(this.swipercanvasData)
          this.$message({
            type:'error',
            message:'数据请求失败,请稍后重试!'
          });
        }
        this.getStackFileLoading = false;
      }).catch(e => {
        console.log(e);
        this.getStackFileLoading = false;
      });
    },
    swiperSlideChange () {
      this.swiperIndex = this.$refs.swiper.swiper.activeIndex;
    },
    mockAsync() {
      setTimeout(() => {
        this.mockSceneData = [
@@ -306,6 +454,7 @@
        this.loading = false;
        this.Camera.cameraId = id;
        await this.Camera.update();
        debugger
      }
      this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id;
@@ -318,6 +467,7 @@
      })
    },
    saveSceneRule(groupRule) {
      const payload = { ...groupRule }
      payload.cameraIds = [this.Camera.cameraId];
@@ -474,6 +624,47 @@
};
</script>
<style lang="scss">
.el-message--info .el-message__content{
  color: #999;
}
.swiper-container {
  margin-left: auto;
  margin-right: auto;
  position: relative;
  overflow: hidden;
  list-style: none;
  padding: 0;
  z-index: 1;
}
.swiper-local-prev,
.swiper-local-next {
  width: 40px;
  height: 40px;
  position: absolute;
  background: #8888;
  top: 40%;
  z-index: 99;
  border-radius: 4em;
  outline: none;
  .icon-btn {
    color: rgb(255, 255, 255);
    text-align: center;
    line-height: 38px;
    cursor: pointer;
  }
}
.swiper-local-prev {
  left: 10px;
}
.swiper-local-prev:hover {
  background: #666;
}
.swiper-local-next {
  left: 90%;
}
.swiper-local-next:hover {
  background: #666;
}
.s-separate-rules {
  width: 100%;
  padding: 13px 0 20px;
@@ -495,11 +686,11 @@
        height: 30px;
        .flex-box{
          .label{
            &+label,&+div{
            & + label,
            & + div {
              margin-left: 10px;
              line-height: 1;
            }
          }
        }
      }
@@ -517,7 +708,7 @@
  }
  .devide{
    height: 10px;
    background: #E9EBF2;
    background: #e9ebf2;
  }
  .top {
    width: 100%;
@@ -611,6 +802,7 @@
    .swiper-next-border:hover {
      background: #666;
    }
    .top-right {
      float: right;
      width: 54%;
@@ -819,7 +1011,7 @@
  }
}
.el-loading-spinner {
  background: url("/images/cameraAccess/loading.gif") no-repeat;
  background: url('/images/cameraAccess/loading.gif') no-repeat;
  top: 50%;
  margin-top: -21px;
  width: calc(100% - 260px) !important;