Explorar el Código

报备申请增加了查询权限相关逻辑

dedsudiyu hace 6 días
padre
commit
6d5738ec6c

+ 8 - 0
pages_hazardousWasteRecycling/api/index.js

@@ -114,6 +114,14 @@ export const hwmsAppRegisterApprovalAdd = (data) => {
 		data: { ...data }
 	})
 };
+// 查询实验室与人员是否有报备权限
+export const hwmsAppRegisterApprovalFindBySubIdAndUserId = (data) => {
+	return apiResquest({
+		url: `/hwms/app/registerApproval/findBySubIdAndUserId`,
+		method: 'POST',
+		data: { ...data }
+	})
+};
 //权限-下拉列表
 export const hwmsPermConfigList = (data) => {
 	return apiResquest({

+ 78 - 4
pages_hazardousWasteRecycling/views/permissionApply/addPage.vue

@@ -1,10 +1,11 @@
 <!-- 权限申请新增 -->
 <template>
 	<view class="permissionApplyAddPage">
-		<view class="check-big-box">
+		<view class="check-big-box" v-if="!dialogRulesType">
 			<view class="check-text-p">*</view>
 			<view class="check-title-p">所需权限</view>
 			<view class="check-box" @click="checkButton(item)"
+				v-if="!item.checkSwitch"
 				v-for="(item,index) in permConfigList" :key="index">
 				<img v-if="!item.checkType" class="left-box" :src="imagesUrl('commonality/icon_12.png')">
 				<img v-if="item.checkType" class="left-box" :src="imagesUrl('commonality/icon_13.png')">
@@ -33,7 +34,8 @@
 			<view class="text-color-p" v-if="subject.subName">{{subject.buildName}} - {{subject.floorName}} - {{subject.roomNum}}</view>
 			<view class="text-color-p" v-if="subject.subName">实验室负责人:{{subject.adminName}}</view>
 		</view>
-		<view class="submit-button-p" style="margin-top:60rpx;" @click="submitButton()">立 即 申 请</view>
+		<view class="submit-button-p" style="margin-top:60rpx;" v-if="!dialogRulesType" @click="submitButton()">立 即 申 请</view>
+		<view class="submit-button-p-2" style="margin-top:60rpx;" v-if="dialogRulesType">您已申请了该实验室所有权限</view>
 		<!-- 实验室选择页面 -->
 		<view class="pageTwo" v-if="pageType == 2">
 			<view class="pageTwo-input-box">
@@ -61,6 +63,7 @@
 		laboratorySubRelInfoGetRelList,
 	} from '@/api/index.js'
 	import {
+		hwmsAppRegisterApprovalFindBySubIdAndUserId,
 		hwmsPermConfigList,
 		hwmsAppRegisterApprovalAdd,
 	} from '@/pages_hazardousWasteRecycling/api/index.js'
@@ -80,6 +83,7 @@
 					checkType2:true
 				},
 				permConfigList:[],
+				dialogRulesType:false,
 			}
 		},
 		onLoad(option) {
@@ -172,6 +176,7 @@
 				if (data.code == 200) {
 					for(let i=0;i<data.data.length;i++){
 						data.data[i].checkType = true;
+						data.data[i].checkSwitch = false;
 					}
 					this.$set(this,'permConfigList',data.data);
 				}
@@ -209,8 +214,66 @@
 			},
 			//实验室选择
 			checkClick(item) {
-				this.$set(this, "subject", item);
-				this.inputClick(1);
+				this.hwmsAppRegisterApprovalFindBySubIdAndUserId(item);
+			},
+			//查询实验室与人员是否有报备权限
+			async hwmsAppRegisterApprovalFindBySubIdAndUserId(item){
+				let self = this;
+				let obj = {
+					subId:item.subId,
+					userId:uni.getStorageSync('userId'),
+				}
+				const {
+					data
+				} = await hwmsAppRegisterApprovalFindBySubIdAndUserId(obj)
+				if (data.code == 200) {
+					if(data.data[0]){
+						let dataList = [];
+						for(let i=0;i<data.data.length;i++){
+							let permId = data.data[i].permId.split(',');
+							dataList = dataList.concat(permId)
+						}
+						for(let i=0;i<dataList.length;i++){
+							for(let o=0;o<self.permConfigList.length;o++){
+								if(dataList[i]==self.permConfigList[o].id){
+									self.permConfigList[o].checkSwitch = true
+								}
+							}
+						}
+						let newList = [];
+						for(let o=0;o<self.permConfigList.length;o++){
+							if(!self.permConfigList[o].checkSwitch){
+								newList.push(self.permConfigList[o].id)
+								self.permConfigList[o].checkType = true;
+							}else{
+								self.permConfigList[o].checkType = false;
+							}
+						}
+						if(newList[0]){
+							this.$set(this,'dialogRulesType',false);
+						}else{
+							this.$set(this,'dialogRulesType',true);
+						}
+					}else{
+						for(let i = 0;i<self.permConfigList.length;i++){
+							self.permConfigList[i].checkSwitch = false;
+						}
+						this.$set(this,'dialogRulesType',false);
+					}
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					this.$set(this, "subject", item);
+					this.inputClick(1);
+				}
 			},
 		},
 	}
@@ -287,6 +350,17 @@
 			margin:20rpx 175rpx;
 			border-radius:10rpx;
 		}
+		.submit-button-p-2{
+			background-color:#999;
+			color:#fff;
+			width:500rpx;
+			height:80rpx;
+			line-height:80rpx;
+			text-align: center;
+			font-size:30rpx;
+			margin:20rpx 125rpx;
+			border-radius:10rpx;
+		}
 		
 		.pageTwo {
 			flex: 1;