Browse Source

监控中心右键摄像头打开电视墙

JX.LI 2 năm trước cách đây
mục cha
commit
97c9a2d9c7
3 tập tin đã thay đổi với 77 bổ sung62 xóa
  1. 45 36
      src/components/TVWall.vue
  2. 2 0
      src/store/modules/user.js
  3. 30 26
      src/views/monitor.vue

+ 45 - 36
src/components/TVWall.vue

@@ -37,13 +37,14 @@ import { getDahuaVideoServer, getTVWallList } from '@/api/dahua/dahua'
 import { tvCameraList } from '@/api/haikang/haikang'
 import DHWs from '@/dahua/lib/DHWs'
 import { rotation } from '@/api/monitor'
+
+
 /** ----------------------------------摄像头预览结束------------------------------------- */
 export default {
   dicts: ['event_source'],
   components: {},
   data() {
     return {
-      array:[],
       tvListJson: [
         {
         'switchTab': '1',
@@ -282,22 +283,9 @@ export default {
           })
       }
     },
-    playRealMonitorVideo(array) { // 自定义设备树自动播放指定通道编码视频
-      const config = this.ws.config
-      const { loginIp, userCode } = config
-      this.ws.postMessage('playRealMonitorVideo', {
-        loginIp,
-        userCode,
-        params: {
-          ctrlCode: "ctrl1",
-          array: array
-        }
-      })
-
-    },
-
     //火点联动电视墙调用
     showTVWall1(longitude,latitude,tvListJson) {
+
       // let that=this;
       /** ----------------------------------大华摄像头预览开始------------------------------------- */
       this.ws.addEventListener('connectStateChange', data => {
@@ -333,17 +321,20 @@ export default {
                 console.log(tvListJson)
                 const array=[]
                 const array1=[]
-                tvListJson[0].treeLabels.forEach((item,index)=>
+                if (tvListJson!=null)
                 {
-                  if (index!=0)
+                  tvListJson[0].treeLabels.forEach((item,index)=>
                   {
-                    const param =Object.assign({})
-                    param.channelId=item.labelCode
-                    array.push(param)
-                    array1.push(item.labelCode)
-                  }
-
-                })
+                    if (index!=0)
+                    {
+                      const param =Object.assign({})
+                      param.channelId=item.labelCode
+                      array.push(param)
+                      array1.push(item.labelCode)
+                    }
+
+                  })
+                }
                 this.create1(longitude,latitude,tvListJson,array,array1)
                 // var obj=JSON.parse(tvListJson)
               } else {
@@ -369,12 +360,6 @@ export default {
       this.TVWallVisible = true
 
     },
-    rotation(lng,lat,list){
-      rotation(lng,lat,list).then(res => {
-        console.log(res)
-
-      })
-    },
     create1(longitude,latitude,tvListJson,array,array1) { // 调用创建控件接口
       let _this = this
       const params = [
@@ -401,8 +386,32 @@ export default {
       setTimeout(() => {
         _this.rotation(longitude,latitude,array1)
       }, 5000)
+
     },
-    showTVWall() {
+    playRealMonitorVideo(array) { // 自定义设备树自动播放指定通道编码视频
+      const config = this.ws.config
+      const { loginIp, userCode } = config
+      this.ws.postMessage('playRealMonitorVideo', {
+        loginIp,
+        userCode,
+        params: {
+          ctrlCode: "ctrl1",
+          array: array
+        }
+      })
+
+    },
+    rotation(lng,lat,list){
+      console.log(list)
+      rotation(lng,lat,list).then(res => {
+      })
+    },
+    showTVWall(tvListJson,bfArray) {
+      if(tvListJson){
+        this.preview(tvListJson,bfArray);
+        this.TVWallVisible = true;
+        return;
+      }
       // let that=this;
       /** ----------------------------------大华摄像头预览开始------------------------------------- */
       this.ws.addEventListener('connectStateChange', data => {
@@ -440,7 +449,7 @@ export default {
       this.$modal.msgWarning('请重新安装客户端')
     },
     /** 预览按钮操作 */
-    preview() {
+    preview(tvListJson,bfArray) {
       getTVWallList().then(newres => {
         getDahuaVideoServer().then(newResponse => {
           this.ws.detectConnectQt().then(res => {
@@ -464,7 +473,7 @@ export default {
                 if (res) {
                   this.alertLoginSuccess()
                   this.activePanel = 'key2'
-                  this.create(newres.data)
+                  this.create(tvListJson?tvListJson:newres.data,bfArray)
                 } else {
                   this.alertLoginFailed()
                 }
@@ -477,8 +486,8 @@ export default {
       })
     },
 
-    create(tvListJson) { // 调用创建控件接口
-      debugger
+    create(tvListJson,bfArray) { // 调用创建控件接口
+      // debugger
       let _this = this
       const params = [
         {
@@ -500,7 +509,7 @@ export default {
       this.setPos()
       this.customizeTree(tvListJson);
       let length = tvListJson[0].treeLabels.length > 4 ? 5 : tvListJson[0].treeLabels.length;
-      const bfArray = [];
+      bfArray = [];
       for (let i = 1; i < length; i++) {
         bfArray.push({"channelId": tvListJson[0].treeLabels[i].labelCode})
       }

+ 2 - 0
src/store/modules/user.js

@@ -1,5 +1,6 @@
 import { login, logout, getInfo, refreshToken } from '@/api/login'
 import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
+import Cookies from "js-cookie";
 
 const user = {
   state: {
@@ -71,6 +72,7 @@ const user = {
           commit('SET_NAME', user.userName)
           commit('SET_USERID', user.id)
           commit('SET_AVATAR', avatar)
+          Cookies.set('deptId',user.deptId)
           resolve(res)
         }).catch(error => {
           reject(error)

+ 30 - 26
src/views/monitor.vue

@@ -99,7 +99,8 @@
                 :class="{on:listCurrentIndex2 == index}" v-on:click="dropLocation(item.latitude,item.longitude,index)">
                 <div class="d-l-l-text">
                   <i class="iconfont sj-icon-jkzx icon-sxt"></i>
-                  <h4>{{ item.cameraName }}</h4><h4 v-if="onChuan" v-html="cgqData[index]"></h4>
+                  <h4>{{ item.cameraName }}</h4>
+                  <h4 v-if="onChuan" v-html="cgqData[index]"></h4>
                 </div>
               </div>
             </div>
@@ -290,8 +291,8 @@
       }
     },
     methods: {
-      setcgqValue:function(){
-        let that=this
+      setcgqValue: function() {
+        let that = this
         for (let i = 0; i < that.visuForestCloudCameraBOListSearch.length; i++) {
           var color = "green";
           var value = Math.random();
@@ -317,7 +318,7 @@
             value = value + "" + down;
           }
           that.cgqData.push("<span style='color:" + color + "'>" + value + "</span>")
-          if(that.cgqData.length>that.visuForestCloudCameraBOListSearch.length){
+          if (that.cgqData.length > that.visuForestCloudCameraBOListSearch.length) {
             console.log(that.cgqData)
             that.cgqData.splice(0, 1)
           }
@@ -325,30 +326,33 @@
       },
       /* 电视墙替换开始 */
       showTVWall(channelCode, channelName) {
-        // let channelCode = '6044981090191552';
-        // let channelName = '复兴大桥中段-交通事故';
         let tvListJson = [{
-          'switchTab': '1',
-          'treeLabels': [{
-              'labelCode': '123456',
-              'labelName': '视频场景',
-              'parentLabelCode': null
+          "switchTab": "2",
+          "treeLabels": [{
+              "id": null,
+              "labelCode": "999",
+              "labelName": "电视墙",
+              "cameraType": null,
+              "parentLabelCode": ""
             },
             {
-              'labelCode': 'd941adbbd3e64dac92cc448dec5293cd',
-              'labelName': channelName,
-              'parentLabelCode': 123456
+              "id": "spcamera00010",
+              "labelCode": channelCode,
+              "labelName": channelName,
+              "cameraType": "1",
+              "parentLabelCode": "999"
             }
           ],
-          'labelChannels': [{
-            'channelDates': [{
-              'channelCode': channelCode,
-              'channelName': channelName,
-              'channelSn': null,
-              'cameraType': 1,
-              'online': 1
-            }],
-            'labelCode': 'd941adbbd3e64dac92cc448dec5293cd'
+          "labelChannels": [{
+            "labelCode": channelCode,
+            "channelDates": [{
+              "channelCode": channelCode,
+              "channelName": channelName,
+              "channelSn": null,
+              "cameraType": "1",
+              "online": "1",
+              "cameraCode": "1"
+            }]
           }]
         }]
         this.$refs.TVWall.showTVWall(tvListJson, [{
@@ -992,12 +996,12 @@
         }
       },
       /** 预览按钮操作 */
-      preview_废弃(cameraParam) {
+      preview(cameraParam) {
         this.showTVWall(cameraParam.code, cameraParam.name);
       },
 
       /** 预览按钮操作 */
-      preview(cameraParam) {
+      preview_废弃(cameraParam) {
         if (cameraParam.type == '1') {
           getDahuaVideoServer().then(newResponse => {
             console.log(newResponse)
@@ -1208,4 +1212,4 @@
     height: 600px;
     border: 1px solid red;
   }
-</style>
+</style>