Sfoglia il codice sorgente

fix:小程序修改防治模块

yf_elsa.cui 3 mesi fa
parent
commit
30fbfa01cf
2 ha cambiato i file con 71 aggiunte e 5 eliminazioni
  1. 70 4
      pages/prevention/index.vue
  2. 1 1
      pages/prevention/ucharts.vue

+ 70 - 4
pages/prevention/index.vue

@@ -16,6 +16,13 @@
 			<view class="loading" v-if="loadingtf">
 				<image src="../../static/images/ajax-loader.gif" mode="" class="img"></image>
 			</view>
+			<view class="tab-box">
+				<view v-for="(item,index) in equipArr" :key="index"
+					@click="tabClick(index,item)" :class="['tab-item',active==index?'active':'']">
+					<text>{{item.type_name}}</text>
+					<text class="bottom-line"></text>
+				</view>
+			</view>
 			<view class="prevents">
 				<view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
 					<image
@@ -91,6 +98,8 @@
 				content: "",
 				allqingchong: false,
 				showLastTime: false,
+				active:0,
+				equipArr:[{type_name:'杀虫灯',id:2,device_model:0},{type_name:'风吸式杀虫灯',id:2,device_model:101}]
 			}
 		},
 		methods: {
@@ -112,6 +121,26 @@
 					}
 				};
 			},
+			async usertype() { 
+							const res = await this.$myRequest({
+								url: '/api/api_gateway?method=home.homes.user_device_type',
+								data:{
+									model:'防治'
+								}
+							})
+							console.log('防治设备列表',res)
+							this.equipArr = res
+							this.eqlist()
+							
+						},
+			tabClick(index, item) {
+				
+				this.active = index
+				this.page = 1
+				this.eqlistdata = []
+				this.eqlist()
+	
+			},
 			async eqlist() { //设备列表
 				this.loadingtf = true
 				const res = await this.$myRequest({
@@ -121,7 +150,8 @@
 						page: this.page,
 						page_size: "10",
 						device_status: this.device_status,
-						device_id: this.imports
+						device_id: this.imports,
+						device_model:this.equipArr[this.active].device_model
 					}
 				})
 				this.loadingtf = false
@@ -237,7 +267,7 @@
 		},
 		onLoad() {
 			this.getworm()
-			this.eqlist()
+			this.usertype()
 			uni.getStorage({
 				key: "jurisdiction",
 				success: (res) => {
@@ -309,11 +339,47 @@
 			height: 40rpx;
 		}
 	}
-
+		.tab-box {
+			position: fixed;
+			top: 170px;
+			font-size: 30rpx;
+			line-height: 80rpx;
+			background-color: #ffffff;
+			width: 100vw;
+			z-index: 2;
+			overflow-y: hidden;
+			overflow-x: auto;
+			white-space: nowrap;
+			margin-top: -10rpx;
+			.tab-item {
+				cursor: pointer;
+				position: relative;
+				padding: 10rpx 20rpx;
+				text-align: center;
+				display: inline-block;
+				span{
+					display: inline-block;
+				}
+			}
+			
+			.tab-item.active {
+				.bottom-line {
+					bottom: 0;
+					position: absolute;
+					display: inline-block;
+					width: 90rpx;
+					height: 6rpx;
+					left: 0;
+					right: 0;
+					margin: auto;
+					background: $uni-color-success;
+				}
+			}
+		}
 	.prevents {
 		width: 100%;
 		position: absolute;
-		top: 140px;
+		top: 180px;
 
 		.prevents_item {
 			width: 95%;

+ 1 - 1
pages/prevention/ucharts.vue

@@ -52,7 +52,7 @@
 			</view>
 			<view class="condition" :style="{'top': allqingchong?'1450rpx':'870rpx'}">
 				<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
-					<table class="table" v-if="$QueryPermission(264)">
+					<table class="table" v-if="$QueryPermission(264)||$QueryPermission(323)">
 						<tr class="tr">
 							<th class="th" v-for="(item,index) in thdata" :key="'a'+index">{{item}}</th>
 						</tr>