heyang 10 mēneši atpakaļ
vecāks
revīzija
88efdcaa9c

+ 2 - 10
pages/api/index.js

@@ -229,16 +229,8 @@ export const systemNoticeGetNoticeType  = (data) => {
         data: data,
     })
 };
-//授权开门-查询实验室列表
-export function systemSubjectGetAppSubject(data) {
-	return apiResquest({
-		url: '/system/subject/getAppSubject',
-		method: 'post',
-		data: {
-			...data
-		}
-	})
-}
+
+
 /************************未调试************************/
 
 

+ 41 - 1
pages_manage/api/index.js

@@ -210,6 +210,46 @@ export const laboratoryGradeManageExecute  = (data) => {
         data: data,
     })
 };
-
+/* *门禁授权* */
+//授权开门-查询实验室列表
+export function systemSubjectGetAppSubject(data) {
+	return apiResquest({
+		url: '/system/subject/getAppSubject',
+		method: 'post',
+		data: {
+			...data
+		}
+	})
+}
+//授权开门-查询被授权人
+export function systemUserGetUserInfo(data) {
+	return apiResquest({
+		url: '/system/user/getUserInfo',
+		method: 'post',
+		data: {
+			...data
+		}
+	})
+}
+//授权开门-授权
+export function laboratoryApplyAddAddApply(data) {
+	return apiResquest({
+		url: '/laboratory/apply/addAddApply',
+		method: 'post',
+		data: {
+			...data
+		}
+	})
+}
+//远程开门-开门
+export function laboratoryApplyRemoteOpenLock(data) {
+	return apiResquest({
+		url: '/laboratory/apply/remoteOpenLock',
+		method: 'post',
+		data: {
+			...data
+		}
+	})
+}
 
 

+ 200 - 35
pages_manage/views/accessControl/empowerOpen.vue

@@ -3,12 +3,18 @@
 	<view id="empowerOpen">
 		<view class="page-one" v-if="pageType==1">
 			<view class="header">
-				<input class="header-l" type="text" v-model="newData.subId" placeholder="实验室名称">
+				<view class="header-n">
+					<input class="header-l" type="text" @change="subNameChange()" v-model="getData.searchValue" placeholder="实验室名称">
+					<view class="header-r" v-if="getData.searchValue" @click="clearSearch()" >
+						<img src="@/pages/images/clear.png" />
+					</view>
+					
+				</view>
 			</view>
 			<view class="list">
-				<view class="list-li">
-					<view class="list-li-l">实验室名称(房间号)</view>
-					<view class="list-li-r">授权</view>
+				<view class="list-li" v-for="(item,index) in dataList">
+					<view class="list-li-l">{{item.subName}}({{item.roomNum}})</view>
+					<view class="list-li-r" @click="authorizedClick(item)">授权</view>
 				</view>
 			</view>
 		</view>
@@ -16,19 +22,31 @@
 			<view class="list-tow">
 				<view class="list-tow-li">
 					<view class="list-tow-li-t">被授权人</view>
-					<input class="list-tow-li-b" type="text" v-model="newData.subId" placeholder="">
+					<input class="list-tow-li-b" type="text" @change="authorizedChange()"
+						v-model="getDataTow.searchValue" placeholder="被授权人搜索,最少两个字">
+					<uni-data-picker @change="bindPickerChange" :localdata="dataListTow" ref='picker'>
+					</uni-data-picker>
 				</view>
 				<view class="list-tow-li">
 					<view class="list-tow-li-t">生效时间</view>
 					<view class="time">
-						<view class="time-l">2024/02/04 12:23</view>
+						<view class="example-body">
+
+						</view>
+						<view class="time-l">
+							<uni-datetime-picker type="datetime" hide-second="true" :border="true"
+								v-model="addForm.validBeginTime" @change="changeLog" placeholder="开始时间" />
+						</view>
 						<view class="time-c">-</view>
-						<view class="time-r">2024/02/04 12:23</view>
+						<view class="time-r">
+							<uni-datetime-picker type="datetime" hide-second="true" :border="true"
+								v-model="addForm.validEndTime" @change="changeLog" placeholder="结束时间" />
+						</view>
 					</view>
 				</view>
 			</view>
 		</view>
-		<view class="bottom">
+		<view class="bottom" v-if="pageType==2">
 			<view class="bottom-l" @click="cancelClick()">取消</view>
 			<view class="bottom-r" @click="submitForm()">确定</view>
 		</view>
@@ -50,8 +68,10 @@
 		config
 	} from '@/api/request/config.js'
 	import {
-		systemSubjectGetAppSubject
-	} from '@/pages/api/index.js'
+		systemSubjectGetAppSubject,
+		systemUserGetUserInfo,
+		laboratoryApplyAddAddApply
+	} from '@/pages_manage/api/index.js'
 	export default {
 		components: {
 
@@ -60,18 +80,28 @@
 			return {
 				pageType: 1,
 				baseUrl: config.base_url,
+				datetimesingle: '',
 				newData: {
 
 				},
-				addForm:{
-					
+				currentDate: '',
+				addForm: {
+					userId: '',
+					subId: '',
+					validBeginTime: '',
+					validEndTime: '',
+				},
+				getData: {
+					searchValue: '',
+					adminId: uni.getStorageSync('userId'),
 				},
-				getData:{
-					searchValue:'',
-					adminId:uni.getStorageSync('userId'),
+				getDataTow: {
+					searchValue: '',
+					labId: '',
 				},
-				dataList:[],
-				authorizeStatus:2,//1成功 2失败
+				dataList: [],
+				dataListTow: [], //被授权人
+				authorizeStatus: 0, //1成功 2失败
 				successVisible: false,
 				timer: null,
 				count: '',
@@ -86,9 +116,63 @@
 
 		},
 		mounted() {
+			this.currentDate = this.getdate();
 			this.systemSubjectGetAppSubject();
 		},
 		methods: {
+			changeLog(e) {
+				console.log('change事件:', e);
+			},
+			getdate() {
+				var date = new Date();
+				var seperator1 = "-";
+				var year = date.getFullYear();
+				var month = date.getMonth() + 1;
+				var strDate = date.getDate();
+
+				if (month >= 1 && month <= 9) {
+					month = "0" + month;
+				}
+				if (strDate >= 0 && strDate <= 9) {
+					strDate = "0" + strDate;
+				}
+				var currentdate = year + "-" + month + "-" + strDate;
+				return currentdate;
+			},
+			//被授权人搜索
+			async authorizedChange() {
+				let self = this
+				self.dataListTow = []
+				const {
+					data
+				} = await systemUserGetUserInfo(this.getDataTow)
+				if (data.code == 200) {
+					data.data.forEach(function(item) {
+						self.dataListTow.push({
+							text: item.userName,
+							value: item.userId,
+						})
+					})
+					self.$refs.picker.show()
+				}
+			},
+			bindPickerChange: function(e) {
+				let self = this;
+				console.log('picker发送选择改变,携带值为', e.detail.value)
+				let data = e.detail.value;
+				data.forEach(function(item) {
+					self.addForm.userName = item.text
+					self.addForm.userId = item.value
+
+				})
+			},
+			//授权点击
+			authorizedClick(row) {
+				this.$set(this, 'pageType', 2)
+				this.$set(this.getDataTow, 'labId', row.subId)
+				this.$set(this.addForm, 'subId', row.subId)
+
+			},
 			//获取实验室
 			async systemSubjectGetAppSubject() {
 				let self = this;
@@ -96,19 +180,48 @@
 					data
 				} = await systemSubjectGetAppSubject(this.getData);
 				if (data.code == 200) {
-					this.dataList=data.data;
+					this.dataList = data.data;
 				}
 			},
-			cancelClick(){
-				
+			//实验室搜索
+			subNameChange() {
+				this.systemSubjectGetAppSubject();
+			},
+			//实验室搜索框清除
+			clearSearch(){
+				this.getData.searchValue='';
+				this.systemSubjectGetAppSubject();
+			},
+			cancelClick() {
+				this.$set(this, 'pageType', 1)
 			},
-			submitForm(){
-				this.$set(this,'successVisible',true)
-				this.getCode();
+			//授权提交
+			async submitForm() {
+				let self = this;
+				let obj={
+					userId:this.addForm.userId,
+					subId: this.addForm.subId,
+					validBeginTime:this.addForm.validBeginTime.replace(' ','T')+':00',
+					validEndTime:this.addForm.validEndTime.replace(' ','T')+':59',
+				}
+				const {
+					data
+				} = await laboratoryApplyAddAddApply(obj);
+				if (data.code == 200) {
+					this.$set(this, 'authorizeStatus', 1)
+					this.$set(this, 'successVisible', true)
+					this.getCode();
+				}else{
+					this.$set(this, 'authorizeStatus', 2)
+					this.$set(this, 'successVisible', true)
+					this.getCode();
+				}
+
+
 			},
 			//关闭弹框倒计时
 			getCode() {
-				let self=this;
+				let self = this;
 				const TIME_COUNT = 3;
 				if (!this.timer) {
 					this.count = TIME_COUNT;
@@ -117,7 +230,7 @@
 						if (this.count > 0 && this.count <= TIME_COUNT) {
 							this.count -= 1;
 						} else {
-							self.successVisible=false;
+							self.successVisible = false;
 							clearInterval(this.timer);
 							this.timer = null;
 						}
@@ -142,15 +255,34 @@
 				padding: 20rpx 30rpx;
 				box-sizing: border-box;
 				border-bottom: 1rpx solid #D8D8D8;
-
-				.header-l {
+				
+				.header-n{
+					position: relative;
 					width: 690rpx;
 					height: 80rpx;
 					border-radius: 10rpx 10rpx 10rpx 10rpx;
 					border: 1rpx solid #E0E0E0;
-					padding: 20rpx;
+					padding-left: 20rpx;
 					box-sizing: border-box;
+					.header-l {
+						width: 590rpx;
+						height: 80rpx;
+					}
+					.header-r{
+						position: absolute;
+						top: 0rpx;
+						right: 0rpx;
+						width: 68rpx;
+						height: 80rpx;
+						>img{
+							width: 24rpx;
+							height: 24rpx;
+							margin-top: 24rpx;
+							margin-left: 24rpx;
+						}
+					}
 				}
+				
 			}
 
 			.list {
@@ -182,6 +314,9 @@
 						line-height: 39rpx;
 					}
 				}
+				.list-li:last-child{
+					border-bottom: none;
+				}
 			}
 
 		}
@@ -210,6 +345,8 @@
 						height: 80rpx;
 						border-radius: 10rpx 10rpx 10rpx 10rpx;
 						border: 1rpx solid #E0E0E0;
+						padding-left: 20rpx;
+						box-sizing: border-box;
 					}
 
 					.time {
@@ -219,18 +356,18 @@
 						width: 690rpx;
 						height: 80rpx;
 						border-radius: 10rpx 10rpx 10rpx 10rpx;
-						border: 1rpx solid #E0E0E0;
+						//border: 1rpx solid #E0E0E0;
 
 						.time-l {
 							height: 80rpx;
 							width: 324rpx;
-							border-right: 1rpx solid #E0E0E0;
 							font-family: PingFang SC, PingFang SC;
 							font-weight: 400;
 							font-size: 28rpx;
 							color: #333333;
 							line-height: 80rpx;
 							text-align: center;
+						
 						}
 
 						.time-c {
@@ -238,13 +375,14 @@
 							width: 40rpx;
 							text-align: center;
 							line-height: 80rpx;
+							//border-top: 1rpx solid #E0E0E0;
+							//border-bottom: 1rpx solid #E0E0E0;
 						}
 
 						.time-r {
 							height: 80rpx;
 							width: 324rpx;
-							background: #E0E0E0;
-							border-left: 1rpx solid #E0E0E0;
+							//background: #E0E0E0;
 							font-family: PingFang SC, PingFang SC;
 							font-weight: 400;
 							font-size: 28rpx;
@@ -313,12 +451,14 @@
 				display: flex;
 				flex-direction: column;
 				align-items: center;
-				.panel-t{
+
+				.panel-t {
 					width: 80rpx;
 					height: 80rpx;
 					margin: 40rpx 0 18rpx 0;
 				}
-				.panel-m{
+
+				.panel-m {
 					font-family: PingFang SC, PingFang SC;
 					font-weight: 400;
 					font-size: 30rpx;
@@ -326,7 +466,8 @@
 					line-height: 42rpx;
 					margin-bottom: 8rpx;
 				}
-				.panel-b{
+
+				.panel-b {
 					font-family: PingFang SC, PingFang SC;
 					font-weight: 400;
 					font-size: 30rpx;
@@ -336,4 +477,28 @@
 			}
 		}
 	}
+
+	/deep/.input-value-border {
+		display: none !important;
+	}
+</style>
+<style>
+	.uni-date-x .icon-calendar {
+		padding-left: 3px;
+		display: none !important;
+	}
+
+	.uni-date__x-input {
+		height: 74rpx !important;
+		line-height: 74rpx !important;
+		font-size: 28rpx !important;
+	}
+	
+	.uni-date__icon-clear{
+		height: 74rpx !important;
+		font-size: 28rpx !important;
+	}
+	.uni-date__icon-clear text{
+		font-size: 32rpx !important;
+	}
 </style>

+ 60 - 8
pages_manage/views/accessControl/remoteOpen.vue

@@ -4,7 +4,7 @@
 		<view class="page-one" v-if="pageType==1">
 			<view class="header">
 				<view class="header-n">
-					<input class="header-l" type="text" v-model="getData.searchValue" placeholder="实验室名称">
+					<input class="header-l" type="text" @change="subNameChange()" v-model="getData.searchValue" placeholder="实验室名称">
 					<view class="header-r" v-if="getData.searchValue" @click="clearSearch()" >
 						<img src="@/pages/images/clear.png" />
 					</view>
@@ -12,9 +12,9 @@
 				</view>
 			</view>
 			<view class="list">
-				<view class="list-li">
-					<view class="list-li-l">实验室名称(房间号)</view>
-					<view class="list-li-r">开门</view>
+				<view class="list-li" v-for="(item,index) in dataList">
+					<view class="list-li-l">{{item.subName}}({{item.roomNum}})</view>
+					<view class="list-li-r" @click="openClick(item)">开门</view>
 				</view>
 			</view>
 		</view>
@@ -35,6 +35,10 @@
 	import {
 		config
 	} from '@/api/request/config.js'
+	import {
+		systemSubjectGetAppSubject,
+		laboratoryApplyRemoteOpenLock,
+	} from '@/pages_manage/api/index.js'
 	export default {
 		components: {
 
@@ -43,8 +47,9 @@
 			return {
 				pageType: 1,
 				baseUrl: config.base_url,
-				getData:{
-					searchValue:'',
+				getData: {
+					searchValue: '',
+					adminId: uni.getStorageSync('userId'),
 				},
 				newData: {
 
@@ -52,6 +57,7 @@
 				addForm:{
 					
 				},
+				dataList:[],
 				authorizeStatus:2,//1成功 2失败
 				successVisible: false,
 				timer: null,
@@ -65,11 +71,48 @@
 		},
 		onShow() {
 
+		},
+		mounted() {
+			this.systemSubjectGetAppSubject();
 		},
 		methods: {
+			//开门
+			async openClick(row){
+				let self = this;
+				let obj={
+					labId:row.subId,
+				}
+				const {
+					data
+				} = await laboratoryApplyRemoteOpenLock(obj);
+				if (data.code == 200) {
+					this.$set(this, 'authorizeStatus', 1)
+					this.$set(this, 'successVisible', true)
+					this.getCode();
+				}else{
+					this.$set(this, 'authorizeStatus', 2)
+					this.$set(this, 'successVisible', true)
+					this.getCode();
+				}
+			},
+			//获取实验室
+			async systemSubjectGetAppSubject() {
+				let self = this;
+				const {
+					data
+				} = await systemSubjectGetAppSubject(this.getData);
+				if (data.code == 200) {
+					this.dataList = data.data;
+				}
+			},
+			//实验室搜索
+			subNameChange() {
+				this.systemSubjectGetAppSubject();
+			},
+			//实验室搜索框清除
 			clearSearch(){
-				console.log(111)
 				this.getData.searchValue='';
+				this.systemSubjectGetAppSubject();
 			},
 			cancelClick(){
 				
@@ -124,7 +167,7 @@
 					padding-left: 20rpx;
 					box-sizing: border-box;
 					.header-l {
-						width: 630rpx;
+						width: 590rpx;
 						height: 80rpx;
 					}
 					.header-r{
@@ -133,6 +176,12 @@
 						right: 0rpx;
 						width: 68rpx;
 						height: 80rpx;
+						>img{
+							width: 24rpx;
+							height: 24rpx;
+							margin-top: 24rpx;
+							margin-left: 24rpx;
+						}
 					}
 				}
 				
@@ -167,6 +216,9 @@
 						line-height: 39rpx;
 					}
 				}
+				.list-li:last-child{
+					border-bottom: none;
+				}
 			}
 
 		}