Jelajahi Sumber

fix: 修复多项业务逻辑与展示问题

1. 新增WebSocket调试日志,完善实时数据刷新逻辑
2. 为设备列表页添加type_id参数传递,适配特殊设备跳转
3. 优化scd设备的图片展示与设备模型判断逻辑
4. 调整气象站详情页的加载顺序与设备图标显示
5. 修复bzy组件的布局样式与设备图片逻辑
6. 修正土壤温湿度列表的文案与表格宽度
7. 为设备详情页添加定位跳转功能
8. 优化预警页面的标签页逻辑与展示字段
allen 5 hari lalu
induk
melakukan
3767faedbf

+ 10 - 23
pages/bzy/components/deviceData.vue

@@ -70,11 +70,11 @@
             <text class="data-label">设备版本</text>
           </view>
         </view>
-        <!-- <view class="data-column-right">
+        <view class="data-column-right">
           <view class="device-image-container">
             <image class="device-image" :src="formatDevImg" mode="aspectFit"></image>
           </view>
-        </view> -->
+        </view>
       </view>
     </view>
     <!-- 图表区域 -->
@@ -382,23 +382,12 @@ export default {
           this.isStatic = true
           this.getStatic()
         }
-        if (newVal.device_model == '11'){
-          this.devImg = 'cbd4.1'
-          this.isShowPhoto = true
-        } else if(newVal.device_model == '12'){
-          this.devImg = 'cbd1'
-          this.isShowPhoto = false
-        } else if(newVal.device_model == '13'){
-          this.devImg = 'cbd5'
+        console.log(newVal.device_model,'ssssssss')
+        if (newVal.device_model == '0'){
+          this.devImg = 'bzy'
           this.isShowPhoto = true
-        } else if(newVal.device_model == '14'){
-          this.devImg = 'cbd6'
-          this.isShowPhoto = true
-        } else if(newVal.device_model == '15'){
-          this.devImg = 'gkcbd1'
-          this.isShowPhoto = false
-        } else{
-          this.devImg = 'cbd'
+        }  else{
+          this.devImg = 'bzy1'
           this.isShowPhoto = true
         }
       },
@@ -883,8 +872,6 @@ export default {
 
   .data-column-left {
     flex: 1;
-    display: grid;
-    grid-template-columns: repeat(2, 1fr);
     gap: 24rpx;
 
     .data-item {
@@ -892,6 +879,7 @@ export default {
       flex: 1;
       flex-direction: column;
       gap: 8rpx;
+      margin-bottom: 16rpx;
 
       .data-label {
         font-size: 24rpx;
@@ -945,10 +933,9 @@ export default {
 
       .device-image {
         position: relative;
-        width: 260rpx;
-        height: 360rpx;
+        width: 200rpx;
+        height: 280rpx;
         z-index: 1;
-        top: 60rpx;
       }
     }
 

+ 66 - 3
pages/cb/equip-detail/equip-detail.vue

@@ -16,8 +16,11 @@
 			<view class="">
 				最新上报时间:{{equipInfo.addtime||equipInfo.uptime | timeFormat}}
 			</view>
-			<view class="">
+			<view class="location-wraper" @click="toMap(equipInfo)">
 				设备地址:{{equipInfo.address?equipInfo.address:"--"}}
+				<view class="location-bg" v-if="type == 4">
+					<image src="https://s3.hnyfwlw.com/webstaticimg/bigdata_app/img/location.png" mode="" class="locationishi"/>
+				</view>
 			</view>
 			<view v-if="type==7" @click="setTime(equipInfo.d_id)">
 				<text space="emsp" v-if="equipInfo.device_model == 0">载玻片、培养液更换时间</text>
@@ -516,7 +519,6 @@
 		},
 		onLoad(option) {
 			this.equipInfo = JSON.parse(option.info)
-			console.log(this.equipInfo,'equipInfoequipInfo')
 			this.type = Number(this.equipInfo.type) || Number(this.equipInfo.equip_type) || Number(this.equipInfo
 				.device_type_id)
 			this.equipInfo.type = this.type
@@ -528,6 +530,50 @@
 			this.date = times.getFullYear() + 1 + "-" + Number(times.getMonth() + 1) + "-" + times.getDate()
 		},
 		methods: {
+			toMap(equipInfo){
+				if(this.type != 4){
+					return
+				}
+				const lat = parseFloat(equipInfo.lat);
+				const lng = parseFloat(equipInfo.lng);
+				if (!lng) {
+					uni.showToast({
+						title: '当前设备无定位信息',
+						icon: 'none',
+						duration: 3000
+					});
+					return;
+				}
+				// App 端:尝试唤起高德/百度地图 App
+				if (typeof plus !== 'undefined' && plus.runtime) {
+					if (
+						plus.runtime.isApplicationExist({
+							pname: 'com.autonavi.minimap',
+							action: 'iosamap://'
+						})
+					) {
+						let url = `amapuri://route/plan?sourceApplication=yourAppName&dlat=${lat}&dlon=${lng}&dev=0&t=0&style=0&start=&auto=1&rtdType=1&coordinate=wgs84`;
+						plus.runtime.openURL(url);
+						return;
+					} else if (
+						plus.runtime.isApplicationExist({
+							pname: 'com.baidu.BaiduMap',
+							action: 'baidumap://'
+						})
+					) {
+						let url = `baidumap://map/direction?destination=${lng},${lat}&mode=navigation&output=html&coord_type=wgs84`;
+						plus.runtime.openURL(url);
+						return;
+					}
+				}
+				// 小程序 / App 无三方地图时:打开内置地图
+				uni.openLocation({
+					latitude: lat,
+					longitude: lng,
+					name: equipInfo.name || '设备位置',
+					scale: 16
+				});
+			},
 			async getState() {
 				this.dataloadingtf = true
 				const res = await this.$myRequest({
@@ -790,7 +836,24 @@
 				flex-basis: 25%;
 			}
 		}
-
+		.location-wraper{
+			display: flex;
+			align-items: center;
+			gap: 20rpx;
+		}
+		.location-bg{
+			width: 40rpx;
+			height: 40rpx;
+			border-radius: 50%;
+			background-color: #0DC6B6;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+		}
+		.locationishi{
+			width: 30rpx;
+			height: 30rpx;
+		}
 		.tit {
 			font-weight: 800;
 			height: 50rpx;

+ 2 - 0
pages/cb/shuifeizsFirst/control.vue

@@ -169,9 +169,11 @@ export default {
           const data = JSON.parse(evt.data);
           this.webSockedData = data;
           // 收到实时数据后刷新右侧组件
+          console.log(data,'datadatadatata')
             if(this.dataArray.length){
               this.mergeTwoObject(this.dataArray,this.webSockedData?.data);
               this.initData(this.dataArray);
+              console.log(this.dataArray,'dataArraydataArray')
             }
         } catch (e) {
           console.error('WebSocket 消息解析失败', e);

+ 9 - 9
pages/deviceDetails/SoilMoisturelist/index.vue

@@ -654,16 +654,16 @@ export default {
         if(item){
           if(this.elemengIsSetting){
           if(this.currentResData[depth[index]] && this.currentResData[depth[index]].includes('temp')){
-            this.legendData.push(depth[index] + 'cm土壤湿度(%)');
+            this.legendData.push(depth[index] + 'cm土壤温度(℃)');
             this.tableColumn.push({
-              label: depth[index] + 'cm土壤湿度(%)',
+              label: depth[index] + 'cm土壤温度(℃)',
               prop: 'temp' + index,
               index
             });
           }}else{
-            this.legendData.push(depth[index] + 'cm土壤湿度(%)');
+            this.legendData.push(depth[index] + 'cm土壤温度(℃)');
             this.tableColumn.push({
-              label: depth[index] + 'cm土壤湿度(%)',
+              label: depth[index] + 'cm土壤温度(℃)',
               prop: 'temp' + index,
               index
             });
@@ -674,17 +674,17 @@ export default {
         if(item){
           if(this.elemengIsSetting){
             if(this.currentResData[depth[index]] && this.currentResData[depth[index]].includes('swc')){
-              this.legendData.push(depth[index] + 'cm土壤温度(℃)');
+              this.legendData.push(depth[index] + 'cm土壤湿度(%)');
               this.tableColumn.push({
-                label: depth[index] + 'cm土壤温度(℃)',
+                label: depth[index] + 'cm土壤湿度(%)',
                 prop: 'swc' + index,
                 index
               });
             }
           }else{
-            this.legendData.push(depth[index] + 'cm土壤温度(℃)');
+            this.legendData.push(depth[index] + 'cm土壤湿度(%)');
               this.tableColumn.push({
-                label: depth[index] + 'cm土壤温度(℃)',
+                label: depth[index] + 'cm土壤湿度(%)',
                 prop: 'swc' + index,
                 index
               });
@@ -1390,7 +1390,7 @@ export default {
         }
       }
       .table-cell {
-        width: 160rpx;
+        width: 180rpx;
         height: 80rpx;
         line-height: 80rpx;
         padding-right: 10rpx;

+ 9 - 8
pages/deviceDetails/weatherStation1/eleDetail.vue

@@ -155,13 +155,13 @@ import uCharts from "../../../components/js_sdk/u-charts/u-charts/u-charts.js";
 import baseCharts from "./charts.vue";
 export default {
   components: { baseCharts },
-  onLoad(options) {
+  async onLoad(options) {
     const deviceInfo = JSON.parse(decodeURIComponent(options.deviceInfo));
     this.eleKey = options.eleKey || "";
     this.initDateRange(deviceInfo.uptime);
     this.deviceInfo = deviceInfo;
+    await this.getObData();
     this.getChartData();
-    this.getObData();
   },
   data() {
     return {
@@ -442,14 +442,15 @@ export default {
         if (res && Array.isArray(res) && res.length > 0) {
           this.eleTabs = res;
           this.hasData = true;
-          this.activeChartInfo =
+          const activeChartInfo =
             this.eleTabs.find((item) => item.name === this.eleKey) ||
             this.eleTabs[0];
-          this.eleActive = this.eleTabs.indexOf(this.activeChartInfo);
-          const key = this.activeChartInfo.unit ? this.activeChartInfo.name + '(' + this.activeChartInfo.unit + ')' : this.activeChartInfo.name
+          this.eleActive = this.eleTabs.indexOf(activeChartInfo);
+          const key = activeChartInfo.unit ? activeChartInfo.name + '(' + activeChartInfo.unit + ')' : activeChartInfo.name
           const keyValue = this.getKeyByName(key)
-          this.activeChartInfo.key = keyValue
+          activeChartInfo.key = keyValue
           this.$nextTick(() => {
+            this.activeChartInfo = activeChartInfo
             this.initChart();
           });
         } else {
@@ -459,8 +460,8 @@ export default {
       });
     },
     // 历史数据
-    getObData() {
-      this.$myRequest({
+    async getObData() {
+      await this.$myRequest({
         url: "/api/api_gateway?method=greenhouse.env_first.history_data",
         data: {
           device_id: this.deviceInfo.devBid,

+ 13 - 5
pages/deviceDetails/weatherStation1/index.vue

@@ -8,10 +8,10 @@
 
     <!-- 设备基本信息 -->
     <view class="device-info">
-      <view class="operation" @click.stop="isShowOperation = !isShowOperation">操作</view>
+      <view class="operation" @click.stop="isShowOperation = !isShowOperation" v-if="type_id!=50">操作</view>
       <view class="operation-container" v-if="isShowOperation" @click="closeOperationHandler">
       <view class="operation-background"></view>
-      <view class="operation-content">
+      <view class="operation-content" v-if="type_id!=50">
         <view class="operation-item" @click="goPage('devRepair')">
           <image :src="serviceIcon" class="operation-icon"></image>
           维修
@@ -117,7 +117,7 @@
           <view class="device-control">
             <view class="control-left">
               <view>{{formatTimestamp(deviceInfo.uptime)}}</view>
-              <u-icon name="reload" color="#0BBC58" style="margin-left: 12rpx" @click="refreshData"></u-icon>
+              <!-- <u-icon name="reload" color="#0BBC58" style="margin-left: 12rpx" @click="refreshData"></u-icon> -->
             </view>
           </view>
           <view class="params-board">
@@ -152,7 +152,7 @@
               <image
                 class="device-img"
                 style="width: 150rpx; height: 300rpx;"
-                src="/static/images/device/qxz_low.png"
+                :src="deviceIcon"
                 mode="aspectFit"
               ></image>
             </view>
@@ -248,11 +248,18 @@ export default {
     this.deviceInfo = options;
     this.initDateRange(options.uptime);
     this.getQxzObData();
+    this.type_id = options.type_id;
+    if(this.type_id == 50){
+      this.deviceIcon = 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/deviceIcon/jcy.png';
+    }else{
+      this.deviceIcon = '/static/images/device/qxz_low.png';
+    }
     // this.getDeviceStatus();
     this.getDeviceData();
   },
   data() {
     return {
+      type_id: '',
       deviceInfo: {},
       isShowOperation: false,
       activeTab: 'monitoring',
@@ -261,6 +268,7 @@ export default {
       show: false,
       mode: 'range',
       startDate: '',
+      deviceIcon: 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/deviceIcon/jcy.png',
       endDate: '',
       page: 1,
       photoIcon:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/photoIcon.png',
@@ -910,7 +918,7 @@ export default {
       font-weight: 400;
       line-height: normal;
       .fixed-column {
-        width: 250rpx;
+        width: 300rpx;
         .table-cell {
           width: 100%;
           white-space: nowrap;

+ 2 - 1
pages/equipList2/index.vue

@@ -744,8 +744,9 @@ import openingDegree from '../assets/openingDegree.png';
 						// }
 						break;
 					case 38:
+					case 50:
 						uni.navigateTo({
-							url: `../deviceDetails/weatherStation1/index?devBid=${item.id}&devName=${item.name}&devStatus=${item.status}&address=${item.address}&uptime=${item.uptime}&d_id=${item.d_id}&deviceType=46`,
+							url: `../deviceDetails/weatherStation1/index?devBid=${item.id}&devName=${item.name}&devStatus=${item.status}&address=${item.address}&uptime=${item.uptime}&d_id=${item.d_id}&deviceType=46&type_id=${type_id}`,
 						});
 						break;
 						

+ 18 - 12
pages/scd/components/deviceData.vue

@@ -24,26 +24,27 @@
       <view class="main-data-panel">
         <view class="data-column-left">
           <view class="data-item">
-            <text class="data-value">{{ objItem.ds }}</text>
+            <text class="data-value">{{ objItem.ds || '--' }}</text>
             <text class="data-label">设备开关</text>
           </view>
           <view class="data-item">
-            <text class="data-value">{{ objItem.ws }}</text>
+            <text class="data-value">{{ objItem.ws || '--' }}</text>
             <text class="data-label">工作状态</text>
           </view>
-        </view>
-      </view>
-      <view class="main-data-panel">
-        <view class="data-column-left">
           <view class="data-item">
-            <text class="data-value">{{ objItem.rps }}</text>
+            <text class="data-value">{{ objItem.rps || '--' }}</text>
             <text class="data-label">雨控状态</text>
           </view>
           <view class="data-item">
-            <text class="data-value">{{ objItem.tps }}</text>
+            <text class="data-value">{{ objItem.tps || '--' }}</text>
             <text class="data-label">温控状态</text>
           </view>
         </view>
+        <view class="data-column-right">
+          <view class="device-image-container">
+            <image class="device-image" :src="formatDevImg" mode="aspectFit"></image>
+          </view>
+        </view>
       </view>
     </view>
     <!-- 图表区域 -->
@@ -288,6 +289,10 @@ export default {
       type:Number,
       default:10
     },
+    devImg:{
+      type:String,
+      default:'scd',
+    },
   },
   components: {
     floatButton,
@@ -301,7 +306,6 @@ export default {
       simBorder:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/simBorder.png',
       devImage:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/cbd.png',
       photoBorder:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/photoBorder.png',
-      devImg:'',
       activeTab: 0,
       edit:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/edit.png',
       sim:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/sim.png',
@@ -367,6 +371,9 @@ export default {
     totalPages(){
       return Math.ceil(this.totalPage / this.page_size)
     },
+    formatDevImg() {
+      return `https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/${this.devImg}.png`;
+    },
   },
   watch:{
     polylineList:{
@@ -893,14 +900,13 @@ export default {
 
   .data-column-left {
     flex: 1;
-    display: flex;
-    gap: 24rpx;
 
     .data-item {
       display: flex;
       flex: 1;
       flex-direction: column;
       gap: 8rpx;
+      margin-bottom: 16rpx;
 
       .data-label {
         font-size: 24rpx;
@@ -954,7 +960,7 @@ export default {
 
       .device-image {
         position: relative;
-        width: 260rpx;
+        width: 200rpx;
         height: 360rpx;
         z-index: 1;
         top: 60rpx;

+ 7 - 9
pages/scd/detail.vue

@@ -87,6 +87,7 @@
         <DeviceData
           :deviceStatic="deviceStatic"
           :deviceInfo="deviceInfo"
+          :devImg="devImg"
           :polylineList="polylineList"
           :deviceHistoryList="deviceHistoryList"
           :totalPage="totalPage"
@@ -131,6 +132,7 @@ export default {
       simIcon: 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/simIcon.png',
       settingIcon: 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/settingIcon.png',
       totalPage: 0,
+      devImg: 'scd',
       currentYear: new Date().getFullYear(),
       selectorRange: [],
       maxDate: this.formatDate(new Date()),
@@ -171,17 +173,13 @@ export default {
 		this.accessToken = uni.getStorageSync('session_key')
     this.getDeviceCameraData()
     const newVal = this.deviceInfo;
-    if (newVal.device_model == '11'){
+    if (newVal.device_model == '102'){
       this.isShowPhoto = true
-    } else if(newVal.device_model == '12'){
-      this.isShowPhoto = false
-    } else if(newVal.device_model == '13'){
-      this.isShowPhoto = true
-    } else if(newVal.device_model == '14'){
-      this.isShowPhoto = true
-    } else if(newVal.device_model == '15'){
-      this.isShowPhoto = false
+      this.devImg = 'jgscd'
+    } else if(newVal.device_model == '0'){
+      this.devImg = 'scd'
     } else{
+      this.devImg = 'fxscd'
       this.isShowPhoto = true
     }
     // this.getPestAnalysis();

+ 12 - 16
pages/warning/index.vue

@@ -48,7 +48,7 @@
 
       <!-- 预警列表 -->
       <scroll-view
-        v-if="activeTab == 0"
+        v-if="activeTab == 0 || activeTab == 1 || activeTab == 2"
         class="warning-list" 
         scroll-y 
         :scroll-top="listScrollTop" 
@@ -68,7 +68,7 @@
                 <image :src="weather" class="icon-image" />
               </view>
               <text class="type-text">{{ warning.warning_title }}</text>
-              <text class="device-type">{{ warning.device_type }}</text>
+              <text class="device-type">{{ warning.purview_name }}</text>
             </view>
             <view class="warning-level" 
             :class="
@@ -102,7 +102,7 @@
       </scroll-view>
 
       <scroll-view
-        v-if="activeTab == 1"
+        v-if="activeTab == 3"
         class="warning-list" 
         scroll-y 
         :scroll-top="listScrollTop" 
@@ -159,7 +159,7 @@
         <view class="popup-time">{{ formatTime(current.upl_time) }}</view>
         <view class="popup-text">
           <u-icon name="map" size="28"></u-icon>
-          <text style="margin-left: 10rpx">{{ warning.address || '-' }}</text>
+          <text style="margin-left: 10rpx">{{ current.address || '-' }}</text>
         </view>
       </view>
 		</u-popup>
@@ -222,9 +222,9 @@ export default {
     activeTabHandler(index){
       this.activeTab = index;
       this.page = 1;
-      if(index == 0 || index == 1){
+      if(index == 0 || index == 1 || index == 2){
         this.getWarningList();
-      }else if(index == 2){
+      }else if(index == 3){
         this.getWarningManualList();
       }
     },
@@ -248,18 +248,18 @@ export default {
       this.page = 1;
       this.loading = false;
       this.finished = false;
-      if(this.activeTab == 0 || this.activeTab == 1){
+      if(this.activeTab == 0 || this.activeTab == 1 || this.activeTab == 2){
         this.getWarningList();
-      }else if(this.activeTab == 2){
+      }else if(this.activeTab == 3){
         this.getWarningManualList();
       }
     },
     // 加载更多
     loadMore() {
       if (this.finished) return;
-      if(this.activeTab == 0 || this.activeTab == 1){
+      if(this.activeTab == 0 || this.activeTab == 1 || this.activeTab == 2){
         this.getWarningList();
-      }else if(this.activeTab == 2){
+      }else if(this.activeTab == 3){
         this.getWarningManualList();
       }
     },
@@ -271,9 +271,9 @@ export default {
       this.loading = false;
       this.finished = false;
       this.refreshing = true;
-      if(this.activeTab == 0 || this.activeTab == 1){
+      if(this.activeTab == 0 || this.activeTab == 1 || this.activeTab == 2){
         this.getWarningList();
-      }else if(this.activeTab == 2){
+      }else if(this.activeTab == 3){
         this.getWarningManualList();
       }
     },
@@ -402,7 +402,6 @@ export default {
       
       const start = this.dateToTimestamp(this.startTime + ' 00:00:00');
       const end = this.dateToTimestamp(this.endTime + ' 23:59:59');
-      console.log(this.activeTab,this.tabs,'activeTabactiveTabactiveTab')
       const params = {
         start,
         end,
@@ -419,10 +418,8 @@ export default {
           method:'POST',
           data: params,
         })
-        
         const resData = res?.data || [];
         const list = resData || [];
-        
         if (this.page === 1) {
           this.warningList = list;
         } else {
@@ -431,7 +428,6 @@ export default {
         
         this.total = res?.total_num || 0;
         this.loading = false;
-        
         // 计算是否还有更多数据
         if (this.warningList.length >= this.total) {
           this.finished = true;