dedsudiyu 4 天之前
父节点
当前提交
e6d9a8e48c
共有 3 个文件被更改,包括 124 次插入6 次删除
  1. 2 2
      api/request/config.js
  2. 21 1
      pages_manage/api/index.js
  3. 101 3
      pages_manage/views/accessControl/remoteOpen.vue

+ 2 - 2
api/request/config.js

@@ -2,7 +2,7 @@ const config = {
 	/************************************ 后台服务地址 ************************************/
 	
 	// base_url: 'http://192.168.1.43/api', //43服务器
-	// base_url: 'http://192.168.1.8/api',//1.8服务器
+	base_url: 'http://192.168.1.8/api',//1.8服务器
 	// base_url: 'http://192.168.1.9:8080',//柴
 	// base_url: 'http://192.168.1.24:8080',//林总
 	// base_url: 'http://192.168.1.7:8080',//刘波
@@ -15,7 +15,7 @@ const config = {
 	// base_url: 'https://lab.zjznai.com/labNhSystem/',//43服务器高升测试
 	// base_url: 'https://lab.zjznai.com/labTest/',//1.8外网
 	// base_url: 'https://lab.zjznai.com/labapp/',//43服务器线上
-	base_url: 'https://lab.zjznai.com/appTest/',//88服务器线上
+	// base_url: 'https://lab.zjznai.com/appTest/',//88服务器线上
 	// base_url: 'https://lab.zjznai.com/labSystem/', //矿大地址
 	// base_url: 'https://lab.zjznai.com/jdlabSystem/', //交大地址
 	// base_url: 'https://lab.zjznai.com/jndxlabSystem/', //暨大地址

+ 21 - 1
pages_manage/api/index.js

@@ -249,7 +249,7 @@ export function laboratoryApplyAddAddApply(data) {
 		}
 	})
 }
-//远程开门-开门
+//远程开门-开门-电子信息牌
 export function laboratoryApplyRemoteOpenLock(data) {
 	return apiResquest({
 		url: '/laboratory/apply/remoteOpenLock',
@@ -259,6 +259,16 @@ export function laboratoryApplyRemoteOpenLock(data) {
 		}
 	})
 }
+//远程开门-新开门-指定设备ID
+export function laboratoryGreenhouseOpenDoorByDeviceId(data) {
+	return apiResquest({
+		url: '/laboratory/greenhouse/openDoorByDeviceId',
+		method: 'post',
+		data: {
+			...data
+		}
+	})
+}
 //开门5秒后状态查询
 export function applyRemoteOpenLockConfirm(data) {
 	return apiResquest({
@@ -311,5 +321,15 @@ export function laboratoryLabOpenLockLogUpdateLockData(data) {
 		}
 	})
 }
+//远程开门-查询实验室远程开门类型列表
+export function laboratoryGreenhouseDoorList(data) {
+	return apiResquest({
+		url: '/laboratory/greenhouse/doorList',
+		method: 'post',
+		data: {
+			...data
+		}
+	})
+}
 
 

+ 101 - 3
pages_manage/views/accessControl/remoteOpen.vue

@@ -12,7 +12,7 @@
 		<scroll-view scroll-y @scrolltolower="scrollGet" class="list">
 			<view class="list-li" v-for="(item,index) in dataList">
 				<view class="list-li-l">{{item.subName}}{{item.roomNum?'('+item.roomNum+')':''}}</view>
-				<view class="list-li-r" @click="openButton(item)">
+				<view class="list-li-r" @click="laboratoryGreenhouseDoorList(item)">
 					<view class="null-p"></view>
 					<view>开门</view>
 					<view class="null-p"></view>
@@ -44,7 +44,9 @@
 		systemSubjectGetAppSubjectByLogin,
 		laboratoryApplyRemoteOpenLock,
 		applyRemoteOpenLockConfirm,
-		laboratoryLabOpenLockLogUpdateLockData
+		laboratoryLabOpenLockLogUpdateLockData,
+		laboratoryGreenhouseDoorList,
+		laboratoryGreenhouseOpenDoorByDeviceId
 	} from '@/pages_manage/api/index.js'
 	export default {
 		components: {
@@ -105,7 +107,103 @@
 					}
 				});
 			},
-			//开门
+			//查询实验室门锁列表
+			async laboratoryGreenhouseDoorList(item) {
+				let self = this;
+				let obj = {
+					subId: item.subId,
+				}
+				const {
+					data
+				} = await laboratoryGreenhouseDoorList(obj);
+				if (data.code == 200) {
+					if(data.data[0]){
+						if(!data.data[1]){
+							//只返回1条数据时
+							if(data.data[0].code == 'hikAccess'){
+								self.laboratoryGreenhouseOpenDoorByDeviceId(data.data[0].id);
+							}else{
+								self.openClick(item)
+							}
+						}else{
+							//返回多条数据时
+							let list = [];
+							for(let i=0;i<data.data.length;i++){
+								list.push(data.data[i].deviceName)
+							}
+							uni.showActionSheet({
+								itemList: list,
+								success: function(res) {
+									if(data.data[res.tapIndex].code == 'hikAccess'){
+										self.laboratoryGreenhouseOpenDoorByDeviceId(data.data[res.tapIndex].id);
+									}else{
+										self.openClick(item)
+									}
+								},
+								fail: function(res) {
+									// console.log(res.errMsg);
+								}
+							});
+						}
+					}else{
+						uni.showToast({
+							mask: true,
+							icon: "none",
+							position: "center",
+							title: '未找到实验室门锁,请联系管理员',
+							duration: 2000
+						});
+					}
+				}
+			},
+			//新开门
+			async laboratoryGreenhouseOpenDoorByDeviceId(id){
+				let self = this;
+				let obj = {
+					id: id,
+				}
+				const {
+					data
+				} = await laboratoryGreenhouseOpenDoorByDeviceId(obj);
+				if (data.code == 200) {
+					if(data.data){
+						this.$set(this, 'authorizeStatus', 1)
+						this.$set(this, 'successVisible', true)
+						const TIME_COUNT = 5;
+						if (!self.timer) {
+							self.count = TIME_COUNT;
+							self.show = false;
+							self.timer = setInterval(() => {
+								if (self.count > 0 && self.count <= TIME_COUNT) {
+									self.count -= 1;
+								} else {
+									self.successVisible = false;
+									clearInterval(self.timer);
+									self.timer = null;
+								}
+							}, 1000);
+						}
+					}else{
+						this.$set(this, 'authorizeStatus', 2)
+						this.$set(this, 'successVisible', true)
+						const TIME_COUNT = 3;
+						if (!this.timer) {
+							this.count = TIME_COUNT;
+							this.show = false;
+							this.timer = setInterval(() => {
+								if (this.count > 0 && this.count <= TIME_COUNT) {
+									this.count -= 1;
+								} else {
+									self.successVisible = false;
+									clearInterval(this.timer);
+									this.timer = null;
+								}
+							}, 1000);
+						}
+					}
+				}
+			},
+			//旧开门(电子信息牌开门)
 			async openClick(row) {
 				let self = this;
 				let obj = {