Procházet zdrojové kódy

fix: 修复权限查询逻辑并优化设备列表显示

修复QueryPermission.js中嵌套权限查询逻辑错误
优化equipList2页面设备列表为空时的显示处理
调整shuifeizs页面样式和初始化逻辑
在imgList页面使用时间格式化函数显示时间
allen před 20 hodinami
rodič
revize
e97641183e

+ 6 - 12
pages/cb/shuifeizsFirst/shuifeizs.vue

@@ -25,11 +25,11 @@
       </view>
     </view>
     <view class="irrMode">
-      <view class="irrMode__header">
+      <view class="irrMode__header" v-if="irrigatedAreaList.length">
         <view @click="changeMode('1')" :class="workStatus == '1' ? 'active' : ''">施肥模式</view>
         <view @click="changeMode('0')" :class="workStatus == '0' ? 'active' : ''">灌溉模式</view>
       </view>
-      <view class="irrMode__content">
+      <view class="irrMode__content" v-if="irrigatedAreaList.length">
         <view class="irrMode__content-header">
           <view class="irrMode__content-header-list">
             <view class="irrMode__content-header-title">
@@ -195,11 +195,6 @@ export default {
   onUnload() {
     this.ws.close();
   },
-  onShow(){
-    if (this.devBid) {
-      this.init();
-    }
-  },
   methods: {
     isHaveTime(childrenList) {
       let time = 0;
@@ -424,7 +419,7 @@ export default {
     },
     async init() {
       this.getdeviceSfStatus();
-      await this.getpeifangRefresh();
+      // await this.getpeifangRefresh();
       this.getsfrhinfo();
       this.initsfyunshangAutoConfigInfo();
       await this.getRunStatus();
@@ -671,7 +666,6 @@ uni-page-body {
   font-weight: 500;
   margin-right: 8rpx;
   top: -4rpx;
-  display:inline-block;
   position: relative;
 }
 .manualControl{
@@ -690,6 +684,7 @@ uni-page-body {
   background: linear-gradient(152deg, #B9B9F6 11.22%, #8080F8 94.92%);
 }
 .facilitystate-top__title{
+  width: 80%;
   overflow: hidden;
   white-space: nowrap;
   text-overflow: ellipsis;
@@ -706,7 +701,6 @@ uni-page-body {
   font-weight: 500;
   margin-right: 8rpx;
   top: -4rpx;
-  display:inline-block;
   position: relative;
 }
 .facilitystate-page {
@@ -723,8 +717,8 @@ uni-page-body {
     &__item {
       margin-bottom: 32rpx;
       .item-icon-container{
-        width: 96rpx;
-        height: 96rpx;
+        width: 80rpx;
+        height: 80rpx;
         border-radius: 26rpx;
         overflow: hidden;
         margin: 0 auto;

+ 1 - 1
pages/cb/sy/imgList.vue

@@ -52,7 +52,7 @@
           </view>
           <view class="imglist_right">
             <view class="">
-              {{ item.time }}
+              {{ timetab(item.addtime) }}
             </view>
             <view class=""> 害虫数量:{{ item.pest_counts }} </view>
           </view>

+ 5 - 1
pages/equipList2/index.vue

@@ -16,9 +16,10 @@
 								<view class="text">{{ getSlice(item.purview_name) }}</view>
 							</view>
 						</view>
+						<u-empty v-if="!menuList.length && !loading" :image-size="100" text="暂无设备权限,请联系工作人员添加"></u-empty>
 					</view>
 				</view>
-				<view class="listbox">
+				<view class="listbox" v-if="menuList.length">
 				<view class="second-tab">
 					<view class="tab-box">
 						<view
@@ -118,6 +119,7 @@
 			return {
 				list: [],
         pur_id: '',
+				loading: false,
 				currentPur_id:'',
         device_status: '',
         counts:0,
@@ -167,6 +169,7 @@
       },
 			async getUserlogin() {
         this.list = [];
+				this.loading = true;
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=user.login.user_login_info',
 					method: 'POST',
@@ -174,6 +177,7 @@
 						is_app: 1,
 					},
 				});
+				this.loading = false;
         res.forEach(item=>{
           item.icon = '/bigdata_app/newImg/home/sqjd.png'
         })

+ 3 - 8
util/QueryPermission.js

@@ -7,15 +7,10 @@ function QueryPermission(id) {
 		if (list[i].children) {
 			var data = list[i].children
 			for (var j = 0; j < data.length; j++) {
-				if (data[j].children) {
-					var item = data[j].children
-					for (var k = 0; k < item.length; k++) {
-						if (item[k].pur_id == id) {
-							return true
-						}
+					var item = data[j]
+					if (item.pur_id == id) {
+						return true
 					}
-				}
-
 			}
 		}
 	}