From 488bc04d746bded791dad0bec3551228d2bca78b Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Thu, 02 Jun 2022 10:43:56 +0800
Subject: [PATCH] 海康语音对讲推送

---
 src/views/InstallClent/installClent.vue         |   13 ++++
 src/api/installClent/installClent.js            |    2 
 src/views/Video/video.vue                       |    2 
 public/img/jiank.png                            |    0 
 src/views/dataL/dataL.vue                       |   11 +++
 public/img/baojin.png                           |    0 
 src/components/real-popup/main.vue              |   82 +++++++++++++++++++++++---
 src/views/supervisoryConsole/card.vue           |   23 +++++++
 src/views/clientManagement/clientManagement.vue |   23 +++++--
 src/page/index/logo.vue                         |    1 
 10 files changed, 137 insertions(+), 20 deletions(-)

diff --git a/public/img/baojin.png b/public/img/baojin.png
new file mode 100644
index 0000000..b86ee23
--- /dev/null
+++ b/public/img/baojin.png
Binary files differ
diff --git a/public/img/jiank.png b/public/img/jiank.png
new file mode 100644
index 0000000..c0b6e4c
--- /dev/null
+++ b/public/img/jiank.png
Binary files differ
diff --git a/src/api/installClent/installClent.js b/src/api/installClent/installClent.js
index 68e66c7..3018497 100644
--- a/src/api/installClent/installClent.js
+++ b/src/api/installClent/installClent.js
@@ -42,7 +42,7 @@
 
 export const update = (row) => {
   return request({
-    url: '/api/blade-jfpts/alarm/alarm/update',
+    url: '/api/blade-jfpts/alarm/alarm/submit',
     method: 'post',
     data: row
   })
diff --git a/src/components/real-popup/main.vue b/src/components/real-popup/main.vue
index f2467cb..030779d 100644
--- a/src/components/real-popup/main.vue
+++ b/src/components/real-popup/main.vue
@@ -157,6 +157,7 @@
           <el-col span="12">
             <el-form-item label="监控视频">
               <el-button :class="{ active: isActive }"
+                         v-if="form.manufacturers != 'HK'"
                          type="success"
                          @click.stop="
                   (videoConversationReal = true), (oldVideoSatart = false)
@@ -164,16 +165,17 @@
                          @mousedown.native="aKeyToCall"
                          @mouseup.native="aKeyStopCall">视频通话
               </el-button>
+
               <el-button :class="{ active: isActive }"
+                         v-if="form.manufacturers == 'HK'"
                          type="success"
-                         @click.stop="HKCall(form)"
-              >海康语音通话
+                         @click.stop="
+                  (videoConversationReal = true), (oldVideoSatart = false)
+                "
+                         @mousedown.native="HKCall(form)"
+                         @mouseup.native="HKStopCall(form)">海康语音通话
               </el-button>
-              <el-button :class="{ active: isActive }"
-                         type="success"
-                         @click.stop="HKStopCall(form)"
-              >关闭语音通话
-              </el-button>
+
               <el-button v-show="false"
                          type="primary"
                          @click.stop="
@@ -327,10 +329,10 @@
         szId: 'play_window',
         szBasePath: "/",
         iMaxSplit: 4,
-        iCurrentSplit:  1 ,
+        iCurrentSplit: 1,
         openDebug: true,
         oStyle: {
-          borderSelect:  '#000',
+          borderSelect: '#000',
         }
       });
       // 事件回调绑定
@@ -364,6 +366,16 @@
     },
     methods: {
       HKCall(e) {
+        this.isActive = true;
+        var that = this;
+        if (this.recorder == null) {
+          this.recorder = new Recorder({
+            sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
+            sampleRate: 8000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
+            numChannels: 1, // 声道,支持 1 或 2, 默认是1
+            // compiling: false,(0.x版本中生效,1.x增加中)  // 是否边录边转换,默认是false
+          });
+        }
         axios({
           method: "get",
           url: `/api/blade-jfpts/equipment/equipment/EquimentVoice?`,
@@ -377,6 +389,16 @@
           this.player.JS_StartTalk(url).then(
             () => {
               console.log('talkStart success')
+              // 一键呼叫相关函数
+              that.recorder.start().then(
+                () => {
+                  // 开始录音
+                },
+                (error) => {
+                  // 出错了
+                  console.log(`${error.name} : ${error.message}`);
+                }
+              );
             },
             e => {
               console.error(e)
@@ -386,9 +408,47 @@
         });
       },
       HKStopCall() {
+        this.isActive = false;
+        var that = this;
         this.player.JS_StopTalk().then(
-          () => { console.log('talkStop success') },
-          e => { console.error(e) }
+          () => {
+            console.log('talkStop success')
+            var formData = new FormData();
+            // that.recorder.downloadWAV("新文件");
+
+            var blob = that.recorder.getPCMBlob(); //获取pcm格式音频数据
+            //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData
+            var newbolb = new Blob([blob], {type: "audio/pcm"});
+            var fileOfBlob = new File([newbolb], new Date().getTime() + ".pcm");
+            formData.append("file", fileOfBlob);
+
+            var wavBlob = that.recorder.getWAVBlob();
+
+            var wavformData = new FormData();
+            var wavform = new File([wavBlob], new Date().getTime() + ".wav");
+            wavformData.append("file", wavform);
+            console.log(
+              wavBlob,
+              wavform,
+              wavformData,
+              wavformData.entries(),
+              132
+            );
+            axios({
+              method: "post",
+              url: "/api/blade-jfpts/xlfeedback/xlfeedback/put-objecty",
+              data: wavformData,
+              params: {
+                jid: that.form.id,
+              },
+            }).then((resdata) => {
+
+              console.log(resdata);
+            });
+          },
+          e => {
+            console.error(e)
+          }
         )
       },
       realOpenVideoDialog() {
diff --git a/src/page/index/logo.vue b/src/page/index/logo.vue
index dc91434..c53f978 100644
--- a/src/page/index/logo.vue
+++ b/src/page/index/logo.vue
@@ -810,6 +810,7 @@
           //执行重连
           that.websocketStart();
         };
+
       } else {
         console.log("WebSocket连接没有建立成功!!");
       }
diff --git a/src/views/InstallClent/installClent.vue b/src/views/InstallClent/installClent.vue
index 2a692e8..da30151 100644
--- a/src/views/InstallClent/installClent.vue
+++ b/src/views/InstallClent/installClent.vue
@@ -136,6 +136,12 @@
               searchSpan: 4,
               prop: "alarmPeople",
               width: 90,
+              type: "tree",
+              props: {
+                label: "title",
+                value: "key"
+              },
+              dicUrl: "/api/blade-system/dept/Batrees",
             },
             {
               label: "联系方式",
@@ -151,8 +157,15 @@
               prop: "bz",
             },
             {
+              label: "设备名称",
+              searchSpan: 3,
+              search: true,
+              prop: "rname",
+            },
+            {
               label: "设备编号",
               searchSpan: 3,
+              search: true,
               width: 130,
               prop: "deviceNumber",
             },
diff --git a/src/views/Video/video.vue b/src/views/Video/video.vue
index 921ceb3..fa39917 100644
--- a/src/views/Video/video.vue
+++ b/src/views/Video/video.vue
@@ -26,6 +26,8 @@
   },
   methods: {
     getData() {
+
+
       this.reportUrl =
         "./realVideo/realtime-view-videos.html?channelNumber=" +
         this.$route.query.channelNumber +
diff --git a/src/views/clientManagement/clientManagement.vue b/src/views/clientManagement/clientManagement.vue
index 429a91a..b80cc8f 100644
--- a/src/views/clientManagement/clientManagement.vue
+++ b/src/views/clientManagement/clientManagement.vue
@@ -365,6 +365,16 @@
               ]
             },
             {
+              label: "设备类型",
+              prop: "deviceType",
+              width: 150,
+              rules: [{
+                required: true,
+                message: "请输入设备类型",
+                trigger: "blur"
+              }]
+            },
+            {
               label: "使用方",
               prop: "deptName",
               display: false
@@ -743,12 +753,13 @@
             this.form.jd = val.longitude;
             //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
             var address = val.formattedAddress.toString();
-            if(address.search("县") != -1){
-                this.form.street = address.substring(address.indexOf("县")+1,address.length);
-            }
-            if(address.search("区") != -1){
-              this.form.street = address.substring(address.indexOf("区")+1,address.length);
-            }
+            this.form.street = address;
+            // if(address.search("县") != -1){
+            //     this.form.street = address.substring(address.indexOf("县")+1,address.length);
+            // }
+            // if(address.search("区") != -1){
+            //   this.form.street = address.substring(address.indexOf("区")+1,address.length);
+            // }
           }
         },
         immediate: true,
diff --git a/src/views/dataL/dataL.vue b/src/views/dataL/dataL.vue
index 969b15a..7710cb1 100644
--- a/src/views/dataL/dataL.vue
+++ b/src/views/dataL/dataL.vue
@@ -1229,6 +1229,17 @@
             }
           });
       }else{
+        var res = that.a;
+        if (res.deviceName.indexOf("(象湖院区)") != -1 || res.deviceName.indexOf("(东湖院区)") != -1){
+          debugger
+          var dom = document.getElementById(
+            "real_video_conversationDataL"
+          );
+          dom.src = res.netType;
+          dom.play();
+          return;
+        }
+
         var newAxios = axios.create({
           baseURL: "https://web.byisf.com:18000",
           withCredentials: false,
diff --git a/src/views/supervisoryConsole/card.vue b/src/views/supervisoryConsole/card.vue
index 80d268f..5a380b1 100644
--- a/src/views/supervisoryConsole/card.vue
+++ b/src/views/supervisoryConsole/card.vue
@@ -17,6 +17,9 @@
       <div class="radio">
         <el-radio-group v-model="radio" @change="siteStatus">
           <el-radio label="全部">全部</el-radio>
+          <el-radio label="一键求助">一键求助</el-radio>
+          <el-radio label="一键报警">一键报警</el-radio>
+          <el-radio label="监控设备">监控设备</el-radio>
           <el-radio label="仅显示预警设备">仅显示预警设备</el-radio>
           <el-radio label="仅显示设备掉线">仅显示设备掉线</el-radio>
           <el-radio label="仅显示设备故障">仅显示设备故障</el-radio>
@@ -93,7 +96,9 @@
               }}
             </div>
 
-            <img src="/img/alarm.png" alt="" />
+            <img v-if="item.deviceType == '监控设备'" src="/img/jiank.png" alt="" />
+            <img v-if="item.deviceType == '一键报警'" src="/img/baojin.png" alt="" />
+            <img v-if="item.deviceType == '一键求助'" src="/img/alarm.png" alt="" />
 
             <div class="bot">
               <span>
@@ -219,8 +224,22 @@
         //   });
         // }
 
-        var d = f.concat(a.concat(c.concat(b)));
+        if (this.radio == "一键求助") {
+          res.data.data.forEach((item) => {
+            if (item.deviceType.indexOf("一键求助") != -1) c.push(item);
+          });
+        } else if (this.radio == "一键报警") {
+          res.data.data.forEach((item) => {
+            if (item.deviceType.indexOf("一键报警") != -1) c.push(item);
+          });
+        } else if (this.radio == "监控设备") {
+          res.data.data.forEach((item) => {
+            if (item.deviceType.indexOf("监控设备") != -1) c.push(item);
+          });
+        }
 
+        var d = f.concat(a.concat(c.concat(b)));
+        this.count = [];
         d.forEach((item) => {
           this.count.push(item);
         });

--
Gitblit v1.9.3