heyang vor 2 Jahren
Ursprung
Commit
5b1d088bfb
2 geänderte Dateien mit 166 neuen und 14 gelöschten Zeilen
  1. 7 0
      api/index.js
  2. 159 14
      pages/emergencyEvacuationBig.vue

+ 7 - 0
api/index.js

@@ -1708,3 +1708,10 @@ export const firedeviceStatusTiming  = (data) => {
         method: 'GET',
     })
 };
+//一键灭火-启动灭火设备
+export const firedeviceStart  = (data) => {
+    return apiResquest({
+        url: `/algorithm/firedevice/outfireapp?subjectId=`+data,
+        method: 'GET',
+    })
+};

+ 159 - 14
pages/emergencyEvacuationBig.vue

@@ -85,7 +85,15 @@
 				 <img  src="@/images/icon_sy_wt.png">
 				 <text style="color: #FF7B1A;">设备已离线,请及时处理。</text>
 			</view>
-			<template v-if="!outfireData.online">
+			<view class="outfire_li" v-if="outfireData.outfireing">
+				 <img  src="@/images/icon_sy_mhwc.png">
+				 <text style="color: #FF2333;">灭火中,灭火程序将于<text>{{conductCountdown}}</text>秒后结束</text>
+			</view>
+			<view class="outfire_li" v-if="outfireEnd">
+				 <img  src="@/images/icon_sy_mhwc.png">
+				 <text style="color: #FF2333;">灭火完成,请您及时补充灭火设备耗材</text>
+			</view>
+			<template v-if="!outfireData.online && !outfireData.outfireing && !outfireEnd">
 				<view class="outfire_li">
 					 <img v-if='!outfireData.smoke' src="@/images/icon_yw_zc.png">
 					 <img v-if='outfireData.smoke' src="@/images/icon_yw_yc.png">
@@ -102,7 +110,7 @@
 					 <text :class="outfireData.fire?'abnormal':'normal'">{{outfireData.fire?'发现火焰':'无火焰'}}</text>
 				</view>
 			</template>
-		  <view :class="!outfireData.online?'outfire_yes_btn':'outfire_no_btn'" @click="outfireFun()">一键灭火</view>
+		  <view  v-if="!outfireData.online && !outfireData.outfireing && !outfireEnd"  :class="!outfireData.online?'outfire_yes_btn':'outfire_no_btn'" @click="outfireFun()">一键灭火</view>
 		</view>
         <!-- 视频部分 -->
         <view class="video-max-box" v-if="urlList[0]">
@@ -121,6 +129,7 @@
           <view @click="closireButton" v-if="!isEvacuate">结束疏散</view>
         </view>
       </view>
+	  <!-- 语音广播-->
       <view class="shade-max-big-box" v-if="broadcastType">
         <view class="null-box" @click="shadeTypeClick()"></view>
         <!-- 语音广播-执行疏散 -->
@@ -146,6 +155,15 @@
           </view>
         </view>
       </view>
+	  <!-- 一键灭火遮罩-->
+	  <view class="shade-outfire" v-if="dialogVisible">
+		   <view class="null-box" @click="dialogOutfire()"></view>
+		   <view class="shade-outfire-n">
+			    <img class="shade-outfire-n-t" src="@/images/icon_mh.png"/>
+				<view class="shade-outfire-n-m">一键灭火启动中,倒计时<text>{{countdown}}</text>秒</view>
+				<view class="shade-outfire-n-b" @click="cancelOutfire()">放弃一键灭火</view>
+		   </view>
+	  </view>
     </view>
   </view>
 </template>
@@ -153,7 +171,8 @@
 <script>
 import { config } from '@/api/request/config.js'
 import { lablayout,evacuate,closure,lineEvacuate,getRedis,getDeviceList,textParseUrlIps,laboratoryInfo,
-  getCameraByFloor,lineEvacuateTow,treeselectByUser,getBuilding,getDeviceListBySub,GetStartList,firedeviceStatus,firedeviceStatusTiming} from '@/api/index.js'
+  getCameraByFloor,lineEvacuateTow,treeselectByUser,getBuilding,getDeviceListBySub,
+  GetStartList,firedeviceStatus,firedeviceStatusTiming,firedeviceStart} from '@/api/index.js'
 export default {
   data() {
     return {
@@ -233,18 +252,22 @@ export default {
       videoHardwareNUM:[],//实验室和楼道摄像头编码
 	  outfireData:{},//一键灭火
 	  timer:'',
-	  countdown:'5',
+	  countdown:'',//倒计时
 	  timer2: null,//倒计时
+	  dialogVisible:false,//一键灭火弹出层
+	  
+	  conductCountdown:'',
+	  timer3: null,//倒计时
+	  outfireEnd:false,//灭火结束状态
     }
   },
   onLoad(option) {
 	   let self = this;
 	  //一键灭火正式使用需要注销
-	  this.itemData.subjectId=63
+	  this.itemData.subjectId=85
 	  this.firedeviceStatus();
 	  //定时请求一键灭火设备状态
-	  this.timer=setInterval(self.firedeviceStatusTiming,5000)
-	  this.sendCode()
+	  //this.timer=setInterval(self.firedeviceStatusTiming,5000)
     this.treeselectByUser(option);
     this.getAppExitLine();
     getApp().watch(this.getMqttLineData,'lineData');
@@ -306,9 +329,16 @@ export default {
 	//一键灭火-查询设备状态
 	async firedeviceStatus(){
 		let _this=this;
+		
 	    const {data} = await firedeviceStatus(_this.itemData.subjectId)
 		if(data.code==200){
 			_this.outfireData=data.data
+			//灭火进行中倒计时
+			if(_this.conductCountdown==30){
+				_this.conductCountdown+=data.data.fireDevice.deviceCountDown
+				_this.sendCode2()
+			}
+			
 		}
 	},
 	//一键灭火-查询设备状态
@@ -322,8 +352,28 @@ export default {
 			_this.outfireData.temperature=data.data.temperature
 		}
 	},
+	//启动灭火设备
+	async firedeviceStart(){
+		let _this=this;
+	    const {data} = await firedeviceStart(_this.itemData.subjectId)
+		if(data.code==200){
+			if(data.data.flg){
+				_this.conductCountdown=30;
+				_this.firedeviceStatus();
+				
+			}else{
+				wx.showToast({
+				  title: data.data.msg,
+				  icon: "none",
+				  duration:6000
+				});
+			}
+		}
+	},
+	
 	//一键灭火按钮
 	outfireFun(){
+		let _this=this;
 		uni.showModal({
 			title:"是否确认执行一键灭火?",
 		    content: '该操作存在风险,请您务必确认实验室内人员已安全撤离?',
@@ -332,6 +382,9 @@ export default {
 		    success: function (res) {
 		        if (res.confirm) {
 		            console.log('用户点击确定');
+					_this.dialogVisible=true;
+					_this.countdown=6;
+					_this.sendCode()//倒计时
 		        } else if (res.cancel) {
 		            console.log('用户点击取消');
 		        }
@@ -339,16 +392,28 @@ export default {
 		});
 
 	},
+	//一键灭火弹出层关闭
+	dialogOutfire(){
+		this.dialogVisible=!this.dialogVisible
+		this.clearTimer();  //关闭定时器
+	},
+	//取消一键灭火
+	cancelOutfire(){
+		this.dialogVisible=false;
+		this.clearTimer();  //关闭定时器
+	},
 	 //倒计时
 	sendCode(){
-		this.loading();  //启动定时器
-		this.timer2 = setInterval(() =>{
+		let _this=this;
+		_this.loading();  //启动定时器
+		_this.timer2 = setInterval(() =>{
 			 //创建定时器
-			if(this.countdown === 1){
-				this.clearTimer();  //关闭定时器
+			if(_this.countdown === 1){
+				_this.clearTimer();  //关闭定时器
+				_this.firedeviceStart();//启动灭火设备
 				
 			}else{
-				this.loading();
+				_this.loading();
 			}
 		},1000);
 	},
@@ -358,8 +423,33 @@ export default {
 	},
 	clearTimer(){
 	   //清除定时器
-	   clearInterval(this.timer);
-	   this.timer = null;
+	   clearInterval(this.timer2);
+	   this.timer2 = null;
+	   this.dialogVisible=false;
+	   this.countdown=6;
+	},
+	//进行中倒计时
+	sendCode2(){
+		let _this=this;
+		_this.loading2();  //启动定时器
+		_this.timer3 = setInterval(() =>{
+			 //创建定时器
+			if(_this.conductCountdown === 1){
+				_this.clearTimer2();  //关闭定时器
+				_this.outfireEnd=true;//灭火倒计时结束
+			}else{
+				_this.loading2();
+			}
+		},1000);
+	},
+	loading2(){
+	  //启动定时器
+	  this.conductCountdown--;  //定时器减1
+	},
+	clearTimer2(){
+	   //清除定时器
+	   clearInterval(this.timer3);
+	   this.timer3 = null;
 	},
 	
     //根据账户信息查询学院楼栋数据
@@ -1476,6 +1566,7 @@ export default {
       color:#fff;
       background:#25C95B;
     }
+	/* 语音广播 */
     .shade-max-big-box{
       height:100%;
       width:100%;
@@ -1622,6 +1713,60 @@ export default {
         }
       }
     }
+	/* 一键灭火 */
+	.shade-outfire{
+		height:100%;
+		width:100%;
+		position fixed
+		display flex;
+		flex-direction column
+		z-index:10;
+		background :rgba(0,0,0,0.2);
+		.null-box{
+		  flex:1;
+		}
+		/* 语音广播-执行疏散 */
+		.shade-outfire-n{
+		  width: 625rpx;
+		  height: 450rpx;
+		  background: #FFFFFF;
+		  border-radius: 20rpx;
+		  position: absolute;
+		  top: 370rpx;
+		  left: 62rpx;
+		  .shade-outfire-n-t{
+			  width: 172rpx;
+			  height: 172rpx;
+			  margin: 38rpx 0 0 226rpx;
+		  }
+		  .shade-outfire-n-m{
+			  font-size: 30rpx;
+			  font-family: PingFang SC;
+			  font-weight: 500;
+			  color: #E30000;
+			  line-height: 84rpx;
+			  text-align: center
+			  border-bottom: 1px solid #E0E0E0;
+			  >text{
+				   font-size: 40rpx;
+			  }
+		  }
+		  .shade-outfire-n-b{
+			  width: 402rpx;
+			  height: 82rpx;
+			  background: #FFFFFF;
+			  border: 2rpx solid #0183FA;
+			  border-radius: 10rpx;
+			  font-size: 28rpx;
+			  line-height: 82rpx;
+			  font-family: PingFang SC;
+			  font-weight: 500;
+			  color: #0183FA;
+			  text-align: center;
+			  margin: 30rpx 0 0 112rpx;
+		  }
+		}
+	}
   }
   .setUpEvacuation-bottom-button{
     width:650rpx;