|
@@ -223,6 +223,7 @@
|
|
|
import { subjectInfo,mangerVoice } from "@/apiDemo/laboratory/subject";
|
|
|
import vueQr from 'vue-qr'
|
|
|
// V3
|
|
|
+ import mqtt from 'mqtt'
|
|
|
import { controlsRestrictVerify } from '@/utils/index'
|
|
|
import qrCodeDialog from "@/components/qrCodeDialog/index.vue"
|
|
|
import mpegtsVideo from '@/components/mpegtsVideo/mpegtsVideo.vue'
|
|
@@ -355,13 +356,15 @@
|
|
|
laboratorySubRelInfoGetSubRelByCheckHazard({ infoId:this.subjectData.infoId }).then(response => {
|
|
|
this.$set(this,'checkInData',response.data);
|
|
|
})
|
|
|
-
|
|
|
//视频查询
|
|
|
if(!controlsRestrictVerify('subHardwareControl')){
|
|
|
this.$set(this,'videoType',false);
|
|
|
}else{
|
|
|
this.$set(this,'videoType',true);
|
|
|
}
|
|
|
+ //mqtt订阅
|
|
|
+ this.sensorOffMQTT('on');
|
|
|
+ this.hardwareOffMQTT('on');
|
|
|
|
|
|
},
|
|
|
//播放文字
|
|
@@ -448,7 +451,7 @@
|
|
|
this.sensorClient.on("connect", e =>{
|
|
|
this.sensorClient.subscribe(this.sensorMtOpic+self.subjectData.subId, (err) => {
|
|
|
if (!err) {
|
|
|
- // console.log("订阅成功:" + this.mtOpic+self.$parent.subId);
|
|
|
+ // console.log("订阅成功:" + this.sensorMtOpic+self.subjectData.subId);
|
|
|
}else{
|
|
|
// console.log("连接错误:" + err);
|
|
|
}
|
|
@@ -479,7 +482,7 @@
|
|
|
sensorOffMQTT(type){
|
|
|
let self = this;
|
|
|
if(self.sensorClient.unsubscribe){
|
|
|
- self.sensorClient.unsubscribe(self.hardwareMtOpic+self.subjectData.subId, error => {
|
|
|
+ self.sensorClient.unsubscribe(this.sensorMtOpic+self.subjectData.subId, error => {
|
|
|
if (error) {
|
|
|
// console.log('mqtt关闭连接错误:', error)
|
|
|
}
|
|
@@ -500,9 +503,9 @@
|
|
|
password:localStorage.getItem('mqttPassword')
|
|
|
});
|
|
|
this.hardwareClient.on("connect", e =>{
|
|
|
- this.hardwareClient.subscribe(this.mtOpic+self.$parent.subId, (err) => {
|
|
|
+ this.hardwareClient.subscribe(self.hardwareMtOpic+self.subjectData.subId, (err) => {
|
|
|
if (!err) {
|
|
|
- // console.log("订阅成功:" + this.mtOpic+self.$parent.subId);
|
|
|
+ // console.log("订阅成功:" + self.hardwareMtOpic+self.subjectData.subId);
|
|
|
}else{
|
|
|
// console.log("连接错误:" + err);
|
|
|
}
|
|
@@ -527,7 +530,7 @@
|
|
|
hardwareOffMQTT(type){
|
|
|
let self = this;
|
|
|
if(self.hardwareClient.unsubscribe){
|
|
|
- self.hardwareClient.unsubscribe(self.mtOpic+self.$parent.subId, error => {
|
|
|
+ self.hardwareClient.unsubscribe(self.hardwareMtOpic+self.subjectData.subId, error => {
|
|
|
if (error) {
|
|
|
// console.log('mqtt关闭连接错误:', error)
|
|
|
}
|