dedsudiyu hace 3 meses
padre
commit
0a6aca74e2
Se han modificado 2 ficheros con 182 adiciones y 103 borrados
  1. 2 2
      api/request/config.js
  2. 180 101
      pages_manage/views/accessControl/remoteOpen.vue

+ 2 - 2
api/request/config.js

@@ -10,7 +10,7 @@ const config = {
 	// base_url: 'http://192.168.1.39:8080',//高升
 	// base_url: 'http://192.168.1.29:8080',//何成
 	// base_url: 'https://demo.zjznai.com/xzgd/',
-	// 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/labSystem/', //矿大地址
 	// base_url: 'https://lab.zjznai.com/jdlabSystem/', //交大地址
@@ -18,7 +18,7 @@ const config = {
 	// base_url: 'https://lab.zjznai.com/api/', //暨大化材
 	// base_url: 'https://lab.zjznai.com/kdwclabSystem/', //矿大文昌地址
     //base_url: 'https://znyj.zjznai.suda.edu.cn/labSystem/', //苏大临时地址
-	base_url: 'https://labcontrol.nwafu.edu.cn/api/', //西北农林
+	// base_url: 'https://labcontrol.nwafu.edu.cn/api/', //西北农林
 	// base_url: 'http://172.16.0.65/api/', //西北农林
 	//base_url: 'https://lab.zjznai.com/labapp/', //43测试
 }

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

@@ -1,23 +1,28 @@
 <!-- 远程开门 -->
 <template>
 	<view id="empowerOpen">
-		<view class="page-one" v-if="pageType==1">
-			<view class="header">
-				<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 class="header">
+			<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 class="list">
-				<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>
+		<scroll-view scroll-y @scrolltolower="scrollGet" class="list">
+			<!-- <img class="null-img" v-if="!dataList[0]" src="@/pages_manage/images/null-data-1.png"> -->
+			<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="openButton(item)">
+					<view class="null-p"></view>
+					<view>开门</view>
+					<view class="null-p"></view>
 				</view>
 			</view>
-		</view>
+			<view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
+			<view class="get-data-null-p" v-else="getDataType">- 滑动加载更多 -</view>
+		</scroll-view>
 		<view class="success" v-if="successVisible">
 			<view class="null-box" @click="closeTip()"></view>
 			<view class="panel">
@@ -47,22 +52,25 @@
 			return {
 				pageType: 1,
 				baseUrl: config.base_url,
-				getData: {
-					searchValue: '',
-					adminId: uni.getStorageSync('userId'),
-				},
 				newData: {
 
 				},
-				addForm:{
-					
+				addForm: {
+
 				},
-				dataList:[],
-				authorizeStatus:2,//1成功 2失败
+				dataList: [],
+				authorizeStatus: 2, //1成功 2失败
 				successVisible: false,
 				timer: null,
 				count: '',
-
+				total: 0,
+				getData: {
+					page: 1,
+					pageSize: 20,
+					searchValue: '',
+					adminId: uni.getStorageSync('userId'),
+				},
+				getDataType: false,
 
 			}
 		},
@@ -76,11 +84,24 @@
 			this.systemSubjectGetAppSubject();
 		},
 		methods: {
+			openButton(row) {
+				let self = this;
+				uni.showModal({
+					content: '确定对 ' + row.subName + ' 进行远程开门操作?',
+					cancelColor: "#999",
+					confirmColor: "#0183FA",
+					success: function(res) {
+						if (res.confirm) {
+							self.openClick(row);
+						}
+					}
+				});
+			},
 			//开门
-			async openClick(row){
+			async openClick(row) {
 				let self = this;
-				let obj={
-					labId:row.subId,
+				let obj = {
+					labId: row.subId,
 				}
 				const {
 					data
@@ -89,12 +110,24 @@
 					this.$set(this, 'authorizeStatus', 1)
 					this.$set(this, 'successVisible', true)
 					this.getCode();
-				}else{
+				} else {
 					this.$set(this, 'authorizeStatus', 2)
 					this.$set(this, 'successVisible', true)
 					this.getCode();
 				}
 			},
+			//滚动加载事件
+			scrollGet() {
+				let self = this;
+				if (self.total / self.getData.pageSize <= self.getData.page) {
+					this.$set(this, 'getDataType', true);
+				} else {
+					this.getData.page += 1;
+					this.$nextTick(() => {
+						this.systemSubjectGetAppSubject();
+					})
+				}
+			},
 			//获取实验室
 			async systemSubjectGetAppSubject() {
 				let self = this;
@@ -102,28 +135,41 @@
 					data
 				} = await systemSubjectGetAppSubject(this.getData);
 				if (data.code == 200) {
-					this.dataList = data.data;
+					if (self.getData.page == 1) {
+						this.dataList = data.data.records;
+						this.total = data.data.total;
+						if (data.data.total / self.getData.pageSize <= self.getData.page) {
+							this.$set(this, 'getDataType', true);
+						}
+					} else {
+						this.dataList = [...this.dataList, ...data.data.records]
+						this.total = data.data.total;
+						if (data.data.total / self.getData.pageSize <= self.getData.page) {
+							this.$set(this, 'getDataType', true);
+						}
+					}
 				}
 			},
 			//实验室搜索
 			subNameChange() {
+				this.$set(this, 'getDataType', false);
+				this.$set(this, 'dataList', []);
+				this.$set(this, 'total', 0);
+				this.$set(this.getData, 'page', 1);
 				this.systemSubjectGetAppSubject();
 			},
 			//实验室搜索框清除
-			clearSearch(){
-				this.getData.searchValue='';
+			clearSearch() {
+				this.$set(this, 'getDataType', false);
+				this.$set(this, 'dataList', []);
+				this.$set(this, 'total', 0);
+				this.$set(this.getData, 'page', 1);
+				this.$set(this.getData, 'searchValue', '');
 				this.systemSubjectGetAppSubject();
 			},
-			cancelClick(){
-				
-			},
-			submitForm(){
-				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;
@@ -132,7 +178,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;
 						}
@@ -148,82 +194,112 @@
 
 <style lang="stylus" scoped>
 	#empowerOpen {
+		height: 100%;
+		display flex;
+		flex-direction column;
 
-		.page-one {
-			.header {
-				width: 749rpx;
-				height: 120rpx;
-				background: #FFFFFF;
-				padding: 20rpx 30rpx;
+		.header {
+			width: 749rpx;
+			height: 120rpx;
+			background: #FFFFFF;
+			padding: 20rpx 30rpx;
+			box-sizing: border-box;
+			border-bottom: 1rpx solid #D8D8D8;
+
+			.header-n {
+				position: relative;
+				width: 690rpx;
+				height: 80rpx;
+				border-radius: 10rpx 10rpx 10rpx 10rpx;
+				border: 1rpx solid #E0E0E0;
+				padding-left: 20rpx;
 				box-sizing: border-box;
-				border-bottom: 1rpx solid #D8D8D8;
-				
-				.header-n{
-					position: relative;
-					width: 690rpx;
+
+				.header-l {
+					width: 590rpx;
 					height: 80rpx;
-					border-radius: 10rpx 10rpx 10rpx 10rpx;
-					border: 1rpx solid #E0E0E0;
-					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;
-						}
+				}
+
+				.header-r {
+					position: absolute;
+					top: 0rpx;
+					right: 0rpx;
+					width: 68rpx;
+					height: 80rpx;
+
+					>img {
+						width: 24rpx;
+						height: 24rpx;
+						margin-top: 24rpx;
+						margin-left: 24rpx;
 					}
 				}
-				
 			}
 
-			.list {
-				padding: 0 30rpx;
-				box-sizing: border-box;
-				background: #fff;
+		}
+
+		.list {
+			flex: 1;
+			overflow-y scroll;
+			padding: 0 30rpx;
+			box-sizing: border-box;
+			background: #fff;
+
+			.list-li {
+				// height: 90rpx;
+				display: flex;
+				// justify-content: space-between;
+				// align-items: center;
+				border-bottom: 1rpx solid #D8D8D8;
+
+				.list-li-l {
+					flex: 1;
+					font-family: PingFang SC, PingFang SC;
+					font-weight: 400;
+					font-size: 30rpx;
+					color: #333333;
+					line-height: 40rpx;
+					padding: 25rpx 25rpx 25rpx 0;
+				}
 
-				.list-li {
-					height: 90rpx;
+				.list-li-r {
+					font-family: PingFang SC, PingFang SC;
+					font-weight: 400;
+					font-size: 28rpx;
+					color: #0183FA;
+					line-height: 90rpx;
 					display: flex;
-					justify-content: space-between;
-					align-items: center;
-					border-bottom: 1rpx solid #D8D8D8;
+					flex-direction: column;
+					text-align: right;
+					width: 80rpx;
 
-					.list-li-l {
+					.null-p {
 						flex: 1;
-						font-family: PingFang SC, PingFang SC;
-						font-weight: 400;
-						font-size: 30rpx;
-						color: #333333;
-						line-height: 42rpx;
-					}
-
-					.list-li-r {
-						font-family: PingFang SC, PingFang SC;
-						font-weight: 400;
-						font-size: 28rpx;
-						color: #0183FA;
-						line-height: 39rpx;
 					}
 				}
-				.list-li:last-child{
-					border-bottom: none;
-				}
 			}
 
+			.list-li:last-child {
+				border-bottom: none;
+			}
+		}
+
+		.null-img {
+			display block;
+			width: 276rpx;
+			height: 321rpx;
+			position absolute;
+			top: 200rpx;
+			left: 238rpx;
+		}
+
+		.get-data-null-p {
+			text-align: center;
+			line-height: 100rpx;
+			padding-bottom: 80px;
+			color: #999;
 		}
 
-		
 		.success {
 			height: 100%;
 			width: 100%;
@@ -249,12 +325,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;
@@ -262,7 +340,8 @@
 					line-height: 42rpx;
 					margin-bottom: 8rpx;
 				}
-				.panel-b{
+
+				.panel-b {
 					font-family: PingFang SC, PingFang SC;
 					font-weight: 400;
 					font-size: 30rpx;
@@ -272,4 +351,4 @@
 			}
 		}
 	}
-</style>
+</style>