Browse Source

Merge remote-tracking branch 'remotes/origin/VERSIONS-wenShi(温室)' into SCHOOL-XiBeiNongLin

dedsudiyu 13 hours ago
parent
commit
03b5b62d79

+ 1 - 1
api/request/config.js

@@ -13,7 +13,7 @@ const config = {
 	// base_url: 'http://192.168.1.29:8080',//何成
 	// base_url: 'https://demo.zjznai.com/xzgd/',
 	// base_url: 'https://lab.zjznai.com/labNhSystem/',//43服务器高升测试
-	// base_url: 'https://lab.zjznai.com/labTest/',//1.8外网
+	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/labSystem/', //矿大地址

+ 8 - 0
pages/api/index.js

@@ -538,4 +538,12 @@ export const chemicalAppletSelectStockInfo  = (data) => {
 				method: 'POST',
 				data: { ...data }
     })
+};
+//查询是否是管理员/安全员
+export const systemSubjectCheckIsAdminOrSafeUser = (data) => {
+	return apiResquest({
+		url: `/system/subject/checkIsAdminOrSafeUser`,
+		method: 'GET',
+		data: data,
+	})
 };

+ 17 - 0
pages/views/login/accountLogin.vue

@@ -43,6 +43,7 @@
 		configInfo,
 		getConfigByType,
 		systemAppletRolePermission,
+		systemSubjectCheckIsAdminOrSafeUser,
 		securityDataStatisticsGetUserIdentity
 	} from '@/pages/api/index.js'
 	import {
@@ -125,6 +126,8 @@
 							this.getConfigByType(),
 							//获取权限字段
 							this.systemAppletRolePermission(),
+							//查询是否是管理员/安全员
+							this.systemSubjectCheckIsAdminOrSafeUser(),
 							//查询身份
 							this.securityDataStatisticsGetUserIdentity()
 						]).then((result) => {
@@ -238,6 +241,20 @@
 					uni.setStorageSync('fileBrowseEnvironmentExtranet','https://'+Decrypt(obj.fileBrowseEnvironmentExtranet))
 				}
 			},
+			//查询是否是管理员/安全员
+			async systemSubjectCheckIsAdminOrSafeUser(){
+				let self = this;
+				const {
+					data
+				} = await systemSubjectCheckIsAdminOrSafeUser();
+				if (data.code == 200) {
+					if(data.data.isSafe || data.data.isAdmin){
+						uni.setStorageSync('subAdmin','1');
+					}else{
+						uni.setStorageSync('subAdmin','0');
+					}
+				}
+			},
 			//查询身份
 			async securityDataStatisticsGetUserIdentity(routeUrl) {
 				let self = this;

+ 63 - 30
pages/views/teacherPage/laboratoryList.vue

@@ -2,8 +2,8 @@
 <template>
 	<view id="laboratoryList">
 		<view class='top-search-value-max-box'>
-			<view class='top-search-value-box' @click="searchValueClick()">
-				<img :src="imagesUrl('commonality/icon_sys_ss@1x.png')">
+			<view class='top-search-value-box'>
+				<img :src="imagesUrl('commonality/icon_sys_ss@1x.png')" @click="searchValueClick()">
 				<input class="input-box" v-model="queryParams.searchValue" 
 							 maxlength="10" placeholder="搜索实验室/房间号"
 							 type="text" @confirm="searchValueClick()">
@@ -14,7 +14,7 @@
 			<view class="top-picker-box">
 				<picker @change="facultyChange" :value="facultyIndex" :range="facultyArray">
 					<view class="picker-view">
-						<view>{{!facultyIndex?'二级单位':facultyArray[facultyIndex]}}</view>
+						<view>{{!facultyIndex&&facultyIndex!=0?'二级单位':facultyArray[facultyIndex]}}</view>
 						<img class="picker-img" :src="imagesUrl('commonality/icon_06.png')" alt="">
 					</view>
 				</picker>
@@ -22,7 +22,7 @@
 			<view class="top-picker-box">
 				<picker @change="subjectChange" :value="subjectIndex" :range="subjectArray">
 					<view class="picker-view">
-						<view>{{!subjectIndex?'分类':subjectArray[subjectIndex]}}</view>
+						<view>{{!subjectIndex&&subjectIndex!=0?'分类':subjectArray[subjectIndex]}}</view>
 						<img class="picker-img" :src="imagesUrl('commonality/icon_06.png')" alt="">
 					</view>
 				</picker>
@@ -30,7 +30,7 @@
 			<view class="top-picker-box">
 				<picker @change="levelChange" :value="levelIndex" :range="levelArray">
 					<view class="picker-view">
-						<view>{{!levelIndex?'分级':levelArray[levelIndex]}}</view>
+						<view>{{!levelIndex&&levelIndex!=0?'分级':levelArray[levelIndex]}}</view>
 						<img class="picker-img" :src="imagesUrl('commonality/icon_06.png')" alt="">
 					</view>
 				</picker>
@@ -64,9 +64,7 @@
 </template>
 
 <script>
-	import {
-		tabBar
-	} from '@/pages/component/tabBar.vue'
+	import tabBar from '@/pages/component/tabBar.vue'
 	import $mqtt from '@/utils/mqtt.min.js';
 	import {
 		config
@@ -94,24 +92,35 @@
 				//分类选择器数据
 				subjectList: [],
 				subjectArray: [],
-				subjectIndex: "",
+				subjectIndex: 0,
 				//级别选择器数据
 				levelList: [],
 				levelArray: [],
-				levelIndex: "",
+				levelIndex: 0,
 				// 查询参数
 				queryParams: {
 					page: 1,
 					pageSize: 10,
 					searchValue:"",
+					deptId:"",
+					typeId:"",
+					levelId:"",
 				},
 			}
 		},
 		onLoad() {
-			this.systemDeptDropList();
-			this.laboratoryClassTypeGetList();
-			this.laboratoryClassLevelGetList();
-			this.getList()
+			Promise.all([
+				this.laboratoryClassTypeGetList(),
+				this.laboratoryClassLevelGetList()
+			]).then((result) => {
+				this.systemDeptDropList();
+			}).catch((error) => {
+				uni.showToast({
+					title: '数据异常,请稍候再试!',
+					icon: "none",
+					duration: 3000
+				});
+			})
 		},
 		onShow() {
 		},
@@ -154,13 +163,32 @@
 					for (let i = 0; i < data.data.length; i++) {
 						list.push(data.data[i].deptName)
 					}
-					this.facultyArray = list;
-					list.unshift('全部');
-					this.facultyList = data.data;
-					this.facultyList.unshift({
-						deptName: "全部",
-						deptId: ""
-					})
+					if(uni.getStorageSync('subAdmin')==1){
+						this.facultyArray.push('我的实验室')
+						this.facultyList.push({
+							deptName: "我的实验室",
+							deptId: "-1"
+						})
+					}
+					if(config.schoolId == uni.getStorageSync('user').position){
+						this.facultyArray.push('全部')
+						this.facultyList.push({
+							deptName: "全部",
+							deptId: ""
+						})
+						this.facultyArray = this.facultyArray.concat(list)
+						this.facultyList = this.facultyArray.concat(data.data)
+					}else{
+						this.facultyArray.push(uni.getStorageSync('userDeptName'))
+						this.facultyList.push({
+							deptName: uni.getStorageSync('userDeptName'),
+							deptId: uni.getStorageSync('userDeptId')
+						})
+					}
+					if(this.facultyList[0]){
+						this.$set(this,'facultyIndex',0);
+						this.getList()
+					}
 				}
 			},
 			//分类下拉列表
@@ -193,10 +221,10 @@
 						list.push(data.data[i].titleName)
 					}
 					this.levelArray = list;
-					list.unshift('全部分');
+					list.unshift('全部分');
 					this.levelList = data.data;
 					this.levelList.unshift({
-						titleName: "全部分",
+						titleName: "全部分",
 						levelId: ""
 					})
 				}
@@ -221,18 +249,23 @@
 				})
 			},
 			searchValueClick(){
-				this.$set(this.queryParams,'page',1);
-				this.$nextTick(() => {
-					this.getList();
-				})
+				if(this.facultyList[0]){
+					this.$set(this.queryParams,'page',1);
+					this.$nextTick(() => {
+						this.getList();
+					})
+				}
 			},
 			//获取实验室列表
 			async getList() {
+				if(!this.facultyList[0]||uni.getStorageSync('userType')==2){
+					return
+				}
 				let self = this;
 				let obj = JSON.parse(JSON.stringify(this.queryParams));
-				obj.deptId = this.facultyIndex ? this.facultyList[this.facultyIndex].deptId : '';
-				obj.typeId = this.subjectIndex ? this.subjectList[this.subjectIndex].typeId : '';
-				obj.levelId = this.levelIndex ? this.levelList[this.levelIndex].levelId : '';
+				obj.deptId = this.facultyIndex||this.facultyIndex==0 ? this.facultyList[this.facultyIndex].deptId : '';
+				obj.typeId = this.subjectIndex||this.subjectIndex==0 ? this.subjectList[this.subjectIndex].typeId : '';
+				obj.levelId = this.levelIndex||this.levelIndex==0 ? this.levelList[this.levelIndex].levelId : '';
 				const {
 					data
 				} = await laboratoryAppletSubList(obj);

+ 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 = {

+ 17 - 10
pages_manage/views/accessQualification/accessQualificationInfo.vue

@@ -1,6 +1,6 @@
 <!-- 准入资格申请详情 -->
 <template>
-	<view id="accessQualificationInfo">
+	<view id="accessQualificationInfo" v-show="showType">
 		<view class="user-info-box">
 			<view class="user-info-box-min">
 				<view>实验室:</view>
@@ -97,6 +97,7 @@
 				itemData: {},
 				type: 0,
 				applyId: '',
+				showType:false,
 			}
 		},
 		onLoad(option) {
@@ -156,11 +157,14 @@
 					});
 					let homeType = false;
 					let list = getCurrentPages();
-					for(let i=0;i<list.length;i++){
-						if(list[i].route.indexOf('home') != -1){
-							homeType = true;
-						}
+					if(list[1]){
+						homeType = true;
 					}
+					// for(let i=0;i<list.length;i++){
+					// 	if(list[i].route.indexOf('home') != -1){
+					// 		homeType = true;
+					// 	}
+					// }
 					if(homeType){
 						setTimeout(function() {
 							uni.navigateBack();
@@ -274,11 +278,14 @@
 					//判断链接跳转逻辑
 					let homeType = false;
 					let list = getCurrentPages();
-					for(let i=0;i<list.length;i++){
-						if(list[i].route.indexOf('home') != -1){
-							homeType = true;
-						}
+					if(list[1]){
+						homeType = true;
 					}
+					// for(let i=0;i<list.length;i++){
+					// 	if(list[i].route.indexOf('home') != -1){
+					// 		homeType = true;
+					// 	}
+					// }
 					if(!homeType){
 						if(data.data.labSecurityApply.auditStatus != 0){
 							uni.showToast({
@@ -349,7 +356,7 @@
 						}
 					}
 					this.$set(this, 'newData', data.data)
-					console.log(this.newData)
+					this.$set(this, 'showType', true)
 				}
 
 			},

+ 1 - 1
pages_manage/views/laboratory/iotControl.vue

@@ -10,7 +10,7 @@
 		<!-- 传感器监测 -->
 		<view class="small-title" v-if="sensorData[0]">
 			<view></view>
-			<view>传感器监测</view>
+			<view>环境感知</view>
 		</view>
 		<view class="sensor">
 			<view v-for="(item,index) in sensorData" :key="index">

+ 2 - 2
pages_manage/views/laboratory/safetyCardScan.vue

@@ -24,8 +24,8 @@
 				<view class="lab-info-c">
 					<view class="lab-info-c-t">
 						<view class="lab-info-c-t-l">{{newData.subName}}</view>
-						<view class="lab-info-c-t-r"
-							:style="'border:1rpx solid '+newData.levelColor+';background:'+newData.levelColorTow+';'">
+						<view class="lab-info-c-t-r" v-if="newData.levelName&&newData.typeName"
+						:style="'border:1rpx solid '+newData.levelColor+';background:'+newData.levelColorTow+';'">
 							<text
 								:style="'border-right:1rpx solid '+newData.levelColor+';color:'+newData.levelColor+';'">{{newData.levelName?newData.levelName:''}}</text>
 							<text