|
@@ -205,8 +205,11 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
- import { laboratoryBigViewGetBuildByBigView,laboratoryBigViewGetFloorByBigView,laboratoryBigViewHazardCensus,
|
|
|
|
- iotBigViewStatisticsHardwareDeviceType,iotBigViewDeviceList,laboratoryBigViewOnLineUserList } from "@/api/emergencyManagement/index";
|
|
|
|
|
|
+ import mqtt from 'mqtt'
|
|
|
|
+ import { laboratoryBigViewGetBuildByBigView,laboratoryBigViewGetFloorByBigView,
|
|
|
|
+ laboratoryBigViewHazardCensus, iotBigViewStatisticsHardwareDeviceType,
|
|
|
|
+ iotBigViewDeviceList,laboratoryBigViewOnLineUserList,
|
|
|
|
+ laboratoryExitLineGetRedisEvacuation } from "@/api/emergencyManagement/index";
|
|
import { laboratoryBigViewSelectTriggerInfo } from "@/api/commonality/permission";
|
|
import { laboratoryBigViewSelectTriggerInfo } from "@/api/commonality/permission";
|
|
import mpegtsVideo from '@/components/mpegtsVideo/mpegtsVideo.vue'
|
|
import mpegtsVideo from '@/components/mpegtsVideo/mpegtsVideo.vue'
|
|
export default {
|
|
export default {
|
|
@@ -257,6 +260,15 @@
|
|
checkSubId:null,
|
|
checkSubId:null,
|
|
//优先显示的提示
|
|
//优先显示的提示
|
|
checkPlanId:null,
|
|
checkPlanId:null,
|
|
|
|
+ //疏散灯
|
|
|
|
+ lightOpic:"iot/hardware/evacuationLight/floor/",
|
|
|
|
+ lightClient:{},
|
|
|
|
+ //疏散
|
|
|
|
+ evacuateOpic:"lab/floor/exit/line",
|
|
|
|
+ evacuateClient:{},
|
|
|
|
+ //预案
|
|
|
|
+ planOpic:'lab/risk/plan/change',
|
|
|
|
+ planClient:{},
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created () {
|
|
created () {
|
|
@@ -298,6 +310,15 @@
|
|
this.iotBigViewDeviceList();
|
|
this.iotBigViewDeviceList();
|
|
//获取楼层-危险源统计;
|
|
//获取楼层-危险源统计;
|
|
this.laboratoryBigViewHazardCensus();
|
|
this.laboratoryBigViewHazardCensus();
|
|
|
|
+ this.offLightMQTT('on')
|
|
|
|
+ //判断是否已有链接
|
|
|
|
+ if(!this.evacuateClient.unsubscribe){
|
|
|
|
+ this.offEvacuateMQTT('on');
|
|
|
|
+ }
|
|
|
|
+ //判断是否已有链接
|
|
|
|
+ if(!this.planClient.unsubscribe){
|
|
|
|
+ this.offPlanMQTT('on');
|
|
|
|
+ }
|
|
},
|
|
},
|
|
//切换楼层
|
|
//切换楼层
|
|
clickFloor(item,index){
|
|
clickFloor(item,index){
|
|
@@ -466,6 +487,8 @@
|
|
}
|
|
}
|
|
//获取预警列表
|
|
//获取预警列表
|
|
this.laboratoryBigViewSelectTriggerInfo();
|
|
this.laboratoryBigViewSelectTriggerInfo();
|
|
|
|
+ //获取疏散数据
|
|
|
|
+ this.laboratoryExitLineGetRedisEvacuation();
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -532,6 +555,45 @@
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ //查询当前楼栋楼层下发生的疏散数据
|
|
|
|
+ laboratoryExitLineGetRedisEvacuation(){
|
|
|
|
+ let self = this;
|
|
|
|
+ let obj = {
|
|
|
|
+ buildId:this.buildId,
|
|
|
|
+ floorId:this.floorId,
|
|
|
|
+ }
|
|
|
|
+ laboratoryExitLineGetRedisEvacuation(obj).then(response => {
|
|
|
|
+ if(response.data.doorPointNames){
|
|
|
|
+ for(let o=0;o<self.mapList.length;o++){
|
|
|
|
+ if(self.mapList[o].type == 2){
|
|
|
|
+ for(let x=0;x<self.mapList[o].lightList.length;x++){
|
|
|
|
+ let num = 0;
|
|
|
|
+ for(let i=0;i<response.data.lightPointSet.length;i++){
|
|
|
|
+ if(response.data.lightPointSet[i]){//处理后端返回的异常的NULL
|
|
|
|
+ if(self.mapList[o].type == 2){
|
|
|
|
+ if(self.mapList[o].lightList[x].key == response.data.lightPointSet[i].key){
|
|
|
|
+ num++
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ self.mapList[o].lightList[x].openType = num != 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for(let i=0;i<response.data.doorPointNames.length;i++){
|
|
|
|
+ for(let o=0;o<self.mapList.length;o++){
|
|
|
|
+ if(self.mapList[o].type == 3){
|
|
|
|
+ if(response.data.doorPointNames[i] == self.mapList[o].key){
|
|
|
|
+ self.mapList[o].roomCheckType = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
//获取楼层-智能物联设备列表;
|
|
//获取楼层-智能物联设备列表;
|
|
iotBigViewStatisticsHardwareDeviceType(){
|
|
iotBigViewStatisticsHardwareDeviceType(){
|
|
iotBigViewStatisticsHardwareDeviceType({floorId:this.floorId}).then(response => {
|
|
iotBigViewStatisticsHardwareDeviceType({floorId:this.floorId}).then(response => {
|
|
@@ -775,6 +837,137 @@
|
|
try{m+=s1.split(".")[1].length}catch(e){}
|
|
try{m+=s1.split(".")[1].length}catch(e){}
|
|
try{m+=s2.split(".")[1].length}catch(e){}
|
|
try{m+=s2.split(".")[1].length}catch(e){}
|
|
return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
|
|
return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
|
|
|
|
+ },/*********************************** MQTT相关 *********************************/
|
|
|
|
+ //疏散-MQTT连接
|
|
|
|
+ offEvacuateMQTT(type){
|
|
|
|
+ let self = this;
|
|
|
|
+ if(self.evacuateClient.unsubscribe){
|
|
|
|
+ self.evacuateClient.unsubscribe(self.evacuateOpic, error => {
|
|
|
|
+ if (error) {
|
|
|
|
+ // console.log('mqtt关闭连接错误:', error)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ self.evacuateClient.end();
|
|
|
|
+ this.$set(this,'evacuateClient',{});
|
|
|
|
+ }
|
|
|
|
+ //判断传入参数如果存在 发起一次新的连接
|
|
|
|
+ if(type){
|
|
|
|
+ this.evacuateMQTT();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //疏散-MQTT订阅
|
|
|
|
+ evacuateMQTT(){
|
|
|
|
+ let self = this;
|
|
|
|
+ this.evacuateClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
|
|
|
|
+ username: localStorage.getItem('mqttUser'),
|
|
|
|
+ password:localStorage.getItem('mqttPassword')
|
|
|
|
+ });
|
|
|
|
+ this.evacuateClient.on("connect", e =>{
|
|
|
|
+ this.evacuateClient.subscribe(self.evacuateOpic, (err) => {
|
|
|
|
+ if (!err) {
|
|
|
|
+ console.log("疏散-订阅成功:" + self.evacuateOpic);
|
|
|
|
+ }else{
|
|
|
|
+ // console.log("疏散-连接错误:" + err);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this.evacuateClient.on("message", (topic, message) => {
|
|
|
|
+ if (message){
|
|
|
|
+ console.log('疏散-message');
|
|
|
|
+ //获取当前楼层数据
|
|
|
|
+ this.laboratoryBigViewGetFloorByBigView();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //疏散灯-MQTT连接
|
|
|
|
+ offLightMQTT(type){
|
|
|
|
+ let self = this;
|
|
|
|
+ if(self.lightClient.unsubscribe){
|
|
|
|
+ self.lightClient.unsubscribe(self.lightOpic+self.floorId, error => {
|
|
|
|
+ if (error) {
|
|
|
|
+ // console.log('mqtt关闭连接错误:', error)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ self.lightClient.end();
|
|
|
|
+ this.$set(this,'lightClient',{});
|
|
|
|
+ }
|
|
|
|
+ //判断传入参数如果存在 发起一次新的连接
|
|
|
|
+ if(type){
|
|
|
|
+ this.lightMQTT();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //疏散灯-MQTT订阅
|
|
|
|
+ lightMQTT(){
|
|
|
|
+ let self = this;
|
|
|
|
+ this.lightClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
|
|
|
|
+ username: localStorage.getItem('mqttUser'),
|
|
|
|
+ password:localStorage.getItem('mqttPassword')
|
|
|
|
+ });
|
|
|
|
+ this.lightClient.on("connect", e =>{
|
|
|
|
+ this.lightClient.subscribe(self.lightOpic+self.floorId, (err) => {
|
|
|
|
+ if (!err) {
|
|
|
|
+ console.log("疏散灯-订阅成功:" + self.lightOpic+self.floorId);
|
|
|
|
+ }else{
|
|
|
|
+ // console.log("疏散灯-连接错误:" + err);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this.lightClient.on("message", (topic, message) => {
|
|
|
|
+ if (message){
|
|
|
|
+ console.log('疏散灯-message',message);
|
|
|
|
+ let data = JSON.parse(message)
|
|
|
|
+ for(let i=0;i<self.mapList.length;i++){
|
|
|
|
+ if(self.mapList[i].type == 2){
|
|
|
|
+ for(let o=0;o<self.mapList[i].lightList.length;o++){
|
|
|
|
+ if(data.hardwareNo == self.mapList[i].lightList[o].configName){
|
|
|
|
+ self.$set(self.mapList[i].lightList[o],'openType',data.operatingState);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //预案-MQTT连接
|
|
|
|
+ offPlanMQTT(type){
|
|
|
|
+ let self = this;
|
|
|
|
+ if(self.planClient.unsubscribe){
|
|
|
|
+ self.planClient.unsubscribe(self.planOpic, error => {
|
|
|
|
+ if (error) {
|
|
|
|
+ // console.log('mqtt关闭连接错误:', error)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ self.planClient.end();
|
|
|
|
+ this.$set(this,'planClient',{});
|
|
|
|
+ }
|
|
|
|
+ //判断传入参数如果存在 发起一次新的连接
|
|
|
|
+ if(type){
|
|
|
|
+ this.planMQTT();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //预案-MQTT订阅
|
|
|
|
+ planMQTT(){
|
|
|
|
+ let self = this;
|
|
|
|
+ this.planClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
|
|
|
|
+ username: localStorage.getItem('mqttUser'),
|
|
|
|
+ password:localStorage.getItem('mqttPassword')
|
|
|
|
+ });
|
|
|
|
+ this.planClient.on("connect", e =>{
|
|
|
|
+ this.planClient.subscribe(self.planOpic, (err) => {
|
|
|
|
+ if (!err) {
|
|
|
|
+ console.log("预案-订阅成功:" + self.evacuateOpic);
|
|
|
|
+ }else{
|
|
|
|
+ // console.log("预案-连接错误:" + err);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this.planClient.on("message", (topic, message) => {
|
|
|
|
+ if (message){
|
|
|
|
+ console.log('预案-message',message);
|
|
|
|
+ //获取当前楼层数据
|
|
|
|
+ this.laboratoryBigViewGetFloorByBigView();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
//退出全屏
|
|
//退出全屏
|
|
exitfull() {
|
|
exitfull() {
|
|
@@ -802,6 +995,13 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ beforeDestroy() {
|
|
|
|
+ //清除MQTT
|
|
|
|
+ let self = this;
|
|
|
|
+ self.offEvacuateMQTT();
|
|
|
|
+ self.offLightMQTT();
|
|
|
|
+ self.offPlanMQTT();
|
|
|
|
+ },
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|