From 10686c5e51ef98ca459ab000462c0701e0bb17ea Mon Sep 17 00:00:00 2001
From: 李旭东 <woaiguo66@sina.com>
Date: 星期五, 03 十一月 2023 17:18:52 +0800
Subject: [PATCH] 环境监测 设备管理

---
 sz_app/pages/spotCheck/index.vue |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/sz_app/pages/spotCheck/index.vue b/sz_app/pages/spotCheck/index.vue
index bc8c683..9cfaaa2 100644
--- a/sz_app/pages/spotCheck/index.vue
+++ b/sz_app/pages/spotCheck/index.vue
@@ -19,11 +19,10 @@
 			<view 
 				class="spot_item"
 				v-for="item in spotList"
-				:key="item.id"
-				@click="navgetToDetail(item)">
+				:key="item.id">
 				<view class="spot_item_title">
 					<span>设备编号:{{item.bigNumber}}</span>
-					<span>详情</span>
+					<span @click="navgetToDetail(item)">详情</span>
 				</view>
 				<view class="spot_item_content">
 					<view class="">
@@ -36,7 +35,7 @@
 					</view>
 					<view class="">
 						<span class="label">设备类型:</span>
-						<span>{{item.bigTypeStr}}</span>
+						<span>{{item.bigType == 1 ? '特殊设备' : '一般设备'}}</span>
 					</view>
 					<view class="">
 						<span class="label">点检时间:</span>
@@ -84,11 +83,15 @@
 				pageNum: 1,
 				pageSize: 10,
 				loadPage: '',
-				spotList: [{id: 1}, {id: 2}, {id: 3}],
+				spotList: [],
 			}
 		},
 		onShow() {
 			this.searchData();
+		},
+		onUnload() {
+			// 移除监听事件
+			uni.$off('scancodedate');
 		},
 		methods: {
 			// 查询模具质检列表
@@ -97,6 +100,7 @@
 					pageNum: this.pageNum,
 					pageSize: this.pageSize
 				})
+				console.log(data);
 				return data;
 			},
 			// 查询信息
@@ -146,21 +150,22 @@
 				uni.$on('scancodedate', function(data) {
 					console.log(data.code);
 					if(data.code) {
-						uni.navigateTo({
-							url: './deviceSpot'
+						const list = data.code ? data.code.split('bigDeviceId=') : [];
+						const codeStr = list.length > 0 ? list[list.length - 1] : '';
+						that.$api.spot.getDeviceDetails({
+							bigDeviceId: codeStr
+						}).then((res) => {
+							if(res.success) {
+								uni.$u.toast('扫描完成!');
+								uni.navigateTo({
+									url: './deviceSpot?deviceId=' + codeStr
+								})
+							} else {
+								uni.$u.toast(res.statusMsg);
+							}
 						})
+						uni.$off('scancodedate');
 					}
-					// that.$api.spot.scanCheckMould({
-					// 	mouldNum: data.code
-					// }).then((res) => {
-					// 	if(res.success) {
-					// 		uni.$u.toast('扫描完成!');
-					// 		console.log(res,'===');
-					// 	} else {
-					// 		uni.$u.toast(res.statusMsg);
-					// 	}
-					// })
-					uni.$off('scancodedate');
 				})
 			},
 			// 跳转详情
@@ -169,7 +174,7 @@
 					url: './spotDetail?id=' + item.id
 				})
 			}
-		}
+		},
 	}
 </script>
 

--
Gitblit v1.9.3