zhangzengfei
2020-11-05 f2fcae7c31b8a0bbbcc6298865d7340e488f61f3
修改事件声音配置
7个文件已修改
222 ■■■■■ 已修改文件
src/pages/cameraAccess/components/CameraInfo.vue 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/DataStackInfo.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/SceneRule.vue 119 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/SeparateRules.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/scene/Editor.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/scene/SlideScene.vue 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cameraAccess/components/CameraInfo.vue
@@ -61,9 +61,10 @@
        </el-col>
        <el-col :span="9" :offset="1">
          <el-form-item label="事件声音">
            <div class="flex-wrap" style="margin-left:-10px">
            <div class="flex-wrap" style="margin-top: 10px;">
              <el-switch v-model="form.voiceEnable" :width="50"></el-switch>
              <el-select
              <!-- 屏蔽声音选择,调整到场景 -->
              <!-- <el-select
                v-model="voice"
                placeholder="选择声音"
                size="small"
@@ -88,7 +89,7 @@
                  class="el-icon-video-pause"
                  style="font-size:26px; vertical-align:middle; color:#409eff"
                ></i>
              </span>
              </span>-->
            </div>
          </el-form-item>
        </el-col>
@@ -362,14 +363,14 @@
      // console.log(list, "sensor")
      // id为空,新增摄像机
      if (this.form.voiceEnable && this.form.voiceId === "") {
        this.$notify({
          type: "error",
          message: "请选择一个事件声音"
        });
      // if (this.form.voiceEnable && this.form.voiceId === "") {
      //   this.$notify({
      //     type: "error",
      //     message: "请选择一个事件声音"
      //   });
        return;
      }
      //   return;
      // }
      this.$refs[formName].validate(async valid => {
        if (valid) {
@@ -399,6 +400,11 @@
                  message: "摄像机信息修改失败!"
                });
              }
            }).catch(err => {
              this.$notify({
                type: "error",
                message: err.data
              });
            });
          } else {
            this.form.areaid = this.addParentId;
src/pages/cameraAccess/components/DataStackInfo.vue
@@ -271,8 +271,12 @@
    <template v-for="stack in DataStackPool.dirs">
      <!-- 文件上传组件 -->
      <file-uploader :ref="`uploader_${stack.id}`" :key="stack.id" v-show="activeName === 'uploading' && stack.id == DataStackPool.selectedDir.id" :sourceType="stack.type" />
      <!-- <file-uploader ref="uploader" v-show="activeName === 'uploading'" /> -->
      <file-uploader
        :ref="`uploader_${stack.id}`"
        :key="stack.id"
        v-show="activeName === 'uploading' && stack.id == DataStackPool.selectedDir.id"
        :sourceType="stack.type"
      />
    </template>
    <!-- 文件预览 -->
    <el-dialog title="查看文件" :visible.sync="previewDialog" width="500px">
@@ -435,7 +439,6 @@
        this.$root.$children[0].$children[1].$refs['sepRule'].getStackFiles();
      }
    },
  },
  methods: {
    preview (row) {
@@ -852,19 +855,19 @@
    vertical-align: middle;
  }
  .snapshot-video {
    background: url('/images/cameraAccess/video.png');
    background: url("/images/cameraAccess/video.png");
    background-repeat: round;
  }
  .snapshot-image {
    background: url('/images/cameraAccess/image.png');
    background: url("/images/cameraAccess/image.png");
    background-repeat: round;
  }
  .snapshot-audio {
    background: url('/images/cameraAccess/audio.png');
    background: url("/images/cameraAccess/audio.png");
    background-repeat: round;
  }
  .snapshot-files {
    background: url('/images/cameraAccess/files.png');
    background: url("/images/cameraAccess/files.png");
    background-repeat: round;
  }
}
src/pages/cameraAccess/components/SceneRule.vue
@@ -46,6 +46,33 @@
          <el-form-item label="场景描述">
            <el-input v-model="sceneForm.desc" type="textarea" size="mini"></el-input>
          </el-form-item>
          <el-form-item label="事件声音">
            <el-select
              v-model="sceneForm.voice"
              placeholder="空"
              size="small"
              value-key="id"
              @change="selSound"
            >
              <el-option v-for="item in soundList" :key="item.id" :label="item.name" :value="item"></el-option>
            </el-select>
            <span
              @click="togglePlayer"
              style="cursor:pointer; margin-left:20px"
              v-show="sceneForm.voiceId.length"
            >
              <i
                v-if="togglePlay"
                class="el-icon-video-play"
                style="font-size:26px; vertical-align:middle; color:#409eff"
              ></i>
              <i
                v-else
                class="el-icon-video-pause"
                style="font-size:26px; vertical-align:middle; color:#409eff"
              ></i>
            </span>
          </el-form-item>
        </div>
      </div>
      
@@ -74,13 +101,7 @@
          :header-cell-style="{background:'#f8f8f8',color:'#222222'}"
        >
          <el-table-column label="序号" type="index" align="center" ></el-table-column>
          <el-table-column
            label="场景名称"
            prop="scene_name"
            align="center"
            show-overflow-tooltip
          ></el-table-column>
          <el-table-column label="场景名称" prop="scene_name" align="center" show-overflow-tooltip></el-table-column>
          <el-table-column label="策略" prop="group_text" align="center" min-width="350px">
            <template slot-scope="scope">
              <span v-html="scope.row.group_text"></span>
@@ -107,7 +128,12 @@
                  @click="handleEdit(scope.row)"
                ></i>
              </el-tooltip>
              <el-tooltip content="删除" :hide-after="700" placement="top" popper-class="atooltipgroup_">
              <el-tooltip
                content="删除"
                :hide-after="700"
                placement="top"
                popper-class="atooltipgroup_"
              >
                <i
                  class="iconfont iconshanchu4 btn-icon"
                  style="font-size: 28px; color:red;"
@@ -130,6 +156,7 @@
} from '@/api/scene'
import RuleEditor from "@/components/subComponents/RuleEditor";
import SceneEditor from "./scene/Editor";
import { getSoundList } from "@/api/event";
export default {
  name: "SceneRuleEditor",
@@ -181,7 +208,10 @@
  },
  mounted() {
    // window.addEventListener('resize', this.windowSizeChange)
    this.getSounds();
    this.eventAudio.addEventListener("ended", () => {
      this.togglePlay = true
    })
  },
  data() {
    return {
@@ -194,14 +224,54 @@
        desc: "",
        template_id: "",
        time_rule_id: "",
        voice: {},
        voiceId: ""
      },
      templateSdks: [],
      templateRules: "",
      ruleList: [],
      sceneNameStore: []
      sceneNameStore: [],
      eventAudio: new Audio(),
      soundList: [],
      togglePlay: true
    }
  },
  methods: {
    getSounds() {
      getSoundList().then(res => {
        if (res.success) {
          this.soundList = [{ id: "", name: "空", path: "" }].concat(res.data.list)
        }
      }).catch(
        e => console.log(e)
      )
    },
    selSound(sound) {
      this.soundPath = sound.path;
      this.sceneForm.voiceId = sound.id;
      this.togglePlay = true;
      this.eventAudio.pause()
      this.$forceUpdate()
      // this.eventAudio.
    },
    togglePlayer() {
      if (!this.soundPath) {
        this.$notify({
          type: 'info',
          message: '请先选择一个声音!'
        })
        return false;
      }
      this.eventAudio.src = this.soundPath;
      if (this.togglePlay) {
        this.eventAudio.play();
        this.togglePlay = false
      } else {
        this.eventAudio.pause()
        this.togglePlay = true
      }
      // this.togglePlay = !this.togglePlay
    },
    bubbleSort(arr) {
      for (var i = arr.length - 1; i > 0; i--) {
        for (var j = 0; j < i; j++) {
@@ -233,13 +303,13 @@
        desc: "",
        template_id: "",
        time_rule_id: "",
        voice: {},
        voiceId: ""
      };
      this.$refs.sceneEditor.cleanRule();
      this.$refs.sceneEditor.getSdkConnection();
    },
    handleCreate() {
      console.log(this.DataStackPool.selectedDir.id, this.TreeDataPool.treeActiveName == 'dataStack')
      if (this.linkRule && this.TreeDataPool.selectedNodes.length < 2) {
        this.$notify({
          type: "warning",
@@ -261,7 +331,6 @@
      }
      this.editScene = true;
      this.cleanForm();
      console.log(this.tableRuleList)
      //初始化场景名称
      var pattern = /^场景\s*\d+\s*$/;
@@ -280,8 +349,9 @@
    },
    handleEdit(scene) {
      this.sceneForm = scene;
      this.sceneForm.voice = this.soundList.find(o => o.id === scene.voiceId);
      this.editScene = true;
      let selectedTpl = {};
      this.sceneTemplates.forEach((t) => {
@@ -296,24 +366,7 @@
    },
    selectTemplate() {
      let selectedTpl = {};
      this.sceneTemplates.forEach((t) => {
        if (t.id == this.sceneForm.template_id) {
          selectedTpl = t;
        }
      })
      // 设置默认参数, 时间规则取第一个
      this.sceneForm.time_rule_id = this.VideoManageData.TimeRules[0].id;
      this.sceneForm.scene_name = selectedTpl.name;
      this.sceneForm.desc = selectedTpl.desc;
      this.templateSdks = selectedTpl.sdks;
      this.templateRules = selectedTpl.rules;
    },
    validateForm() {
      if (!this.sceneForm.scene_name.trim()) {
        this.$notify({
          type: 'warning',
@@ -336,7 +389,6 @@
      return true
    },
    saveSceneRule() {
      if (!this.validateForm()) {
        return
      }
@@ -344,6 +396,7 @@
      this.sceneForm.rules = editorResp.rules;
      this.sceneForm.id = editorResp.id;
      this.sceneForm.group_text = editorResp.text;
      this.onSaveScene(this.sceneForm);
    },
    handleDelScene(groupRule) {
@@ -410,7 +463,7 @@
        }
      }
      textarea {
        height: 143px;
        height: 92px;
      }
    }
    .right {
src/pages/cameraAccess/components/SeparateRules.vue
@@ -28,21 +28,9 @@
          </div>
          <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'">
            <span class="label">分辨率</span>
            <el-select
              v-model="Camera.selectResolution"
              placeholder="请选择"
              size="mini"
              style="width: 134px;
                margin-left:10px;"
            >
              <el-option
                v-for="item in Camera.resolutionOption"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
            <span
              class="label"
            >分辨率: {{Camera.resolutionOption.find(o=>o.value === Camera.selectResolution).label}}</span>
          </div>
          <div v-if="Camera.analytics" class="flex-box">
src/pages/cameraAccess/components/scene/Editor.vue
@@ -516,7 +516,6 @@
  },
  methods: {
    getSdkConnection() {
      console.log(this.VideoManageData.Dictionary)
      this.sdkConnects = this.VideoManageData.Dictionary['RULECOMPUTEBETWEEN'].map(r => {
        return {
@@ -656,12 +655,10 @@
        }
      })
      console.log(argObj.valueOptions)
    },
    setOptArgValueOptions(optArg) {
      let alias = optArg.alias;
      console.log(this.VideoManageData.Dictionary[alias])
      optArg.valueOptions = this.VideoManageData.Dictionary[alias].map(r => {
        return {
          name: r.name,
@@ -839,7 +836,6 @@
      //sdkItem.sdk_id = sdkItem.sdkObj.id;
      if (resetArgs) {
        sdkItem.argDef = JSON.parse(sdkItem.sdkObj.argDef)
        console.log(sdkItem.argDef)
        //取出默认参数
        sdkItem.defaultArg = sdkItem.argDef.filter(
          arg => !arg.config.isOptional
@@ -1579,7 +1575,6 @@
          }
        })
        console.log(group_text)
      }
      groupRule.text = group_text
src/pages/cameraAccess/components/scene/SlideScene.vue
@@ -1,7 +1,12 @@
<template>
  <div class="swiper-box">
    <p class="task-tip" v-if="sceneData.length == 0 ">暂无场景,请开始创建</p>
    <swiper ref="sceneSwiper" v-if="sceneData.length>=1" :options="swiperOption" class="swiper-box-container">
    <swiper
      ref="sceneSwiper"
      v-if="sceneData.length>=1"
      :options="swiperOption"
      class="swiper-box-container"
    >
      <swiper-slide v-for="item in sceneData" :key="item.id+'s'">
        <div class="wrap-box" >
          <div class="inner">
@@ -11,7 +16,11 @@
                  <!-- <svg class="icon" aria-hidden="true" style="font-size:4rem;">
                    <use :xlink:href="`#${item.rules[0].icon}`" />
                  </svg> -->
                  <img class="baseImg" :src="item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${item.rules[0].icon_blob}`" alt="">
                  <img
                    class="baseImg"
                    :src="item.rules[0].icon_blob && item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${item.rules[0].icon_blob}`"
                    alt
                  />
                </div>
              </div>
              <div class="double" v-else-if="item.rules.length==2">
@@ -19,7 +28,11 @@
                  <!-- <svg class="icon" aria-hidden="true" style="font-size:2rem;">
                    <use :xlink:href="`#${rule.icon}`" />
                  </svg> -->
                  <img class="baseImg" :src="item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`" alt="">
                  <img
                    class="baseImg"
                    :src="item.rules[0].icon_blob &&item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    alt
                  />
                </div>
              </div>
              <div class="third" v-else-if="item.rules.length==3">
@@ -27,7 +40,11 @@
                  <!-- <svg class="icon" aria-hidden="true" style="font-size:2rem;">
                    <use :xlink:href="`#${rule.icon}`" />
                  </svg> -->
                  <img class="baseImg" :src="item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`" alt="">
                  <img
                    class="baseImg"
                    :src="item.rules[0].icon_blob &&item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    alt
                  />
                </div>
              </div>
              <div class="four" v-else-if="item.rules.length==4">
@@ -35,7 +52,11 @@
                  <!-- <svg class="icon" aria-hidden="true" style="font-size:2rem;">
                    <use :xlink:href="`#${rule.icon}`" />
                  </svg> -->
                  <img class="baseImg" :src="item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`" alt="">
                  <img
                    class="baseImg"
                    :src="item.rules[0].icon_blob && item.rules[0].icon_blob.indexOf(',')>0?item.rules[0].icon_blob:`data:image/png;base64,${rule.icon_blob}`"
                    alt
                  />
                </div>
              </div>
            </div>
@@ -239,7 +260,7 @@
          left: 50%;
          transform: translate(-50%, -50%);
          box-shadow: none;
          width: 100%
          width: 100%;
        }
      }
      .double {
vue.config.js
@@ -79,8 +79,8 @@
        changeOrigin: true,
      },
      "/data/api-v/app/findAllApp": {
        target: '/',
        // target: 'http://localhost:8080/',
        // target: '/',
        target: 'http://localhost:8080/',
        changeOrigin: true,
        pathRewrite: {
          '^/data/api-v/app/findAllApp': 'apps.json'