Bladeren bron

fix: 修复多个页面的显示逻辑与交互细节

1. 将cbd详情页的v-if替换为v-show避免频繁卸载组件
2. 为deviceData组件添加activeTabLabel props控制图表显示
3. 调整devicePhoto页面的缩放比例与标记位置计算系数
4. 优化equipList2的设备类型选择逻辑与跳转路径
5. 清理冗余代码与调试日志
allen 2 dagen geleden
bovenliggende
commit
4ee4f898c6
4 gewijzigde bestanden met toevoegingen van 46 en 29 verwijderingen
  1. 5 1
      pages/cbd/components/deviceData.vue
  2. 3 2
      pages/cbd/detail.vue
  3. 4 3
      pages/cbd/devicePhoto.vue
  4. 34 23
      pages/equipList2/index.vue

+ 5 - 1
pages/cbd/components/deviceData.vue

@@ -84,7 +84,7 @@
         </view> -->
       </view>
       <view class="chart-content">
-        <view class="chart-canvas-container" v-if="!show" :key="chartKey">
+        <view class="chart-canvas-container" v-if="!show && activeTabLabel === 'deviceData'" :key="chartKey">
           <!-- <div id="tempChart" class="chart-canvas"></div> -->
 		      <qiun-data-charts type="line" :chartData="chartData" :canvas2d="true" :inScrollView="true" :opts="opts" :ontouch="true" v-show="xData.length"/>
         </view>
@@ -275,6 +275,10 @@ export default {
       type:Number,
       default:10
     },
+    activeTabLabel:{
+      type:String,
+      default:''
+    },
   },
   components: {
     floatButton,

+ 3 - 2
pages/cbd/detail.vue

@@ -93,7 +93,7 @@
           <u-empty text="暂无数据"></u-empty>
         </view>
       </view>
-      <view v-if="activeTab === 'viewImage'">
+      <view v-show="activeTab === 'viewImage'">
         <photoImage
           :images="imageList"
           :pestList="pestList"
@@ -103,8 +103,9 @@
           :deviceInfo="deviceInfo"
         />
       </view>
-      <view v-if="activeTab === 'deviceData'">
+      <view v-show="activeTab === 'deviceData'">
         <DeviceData
+          :activeTabLabel="activeTab"
           :deviceStatic="deviceStatic"
           :deviceInfo="deviceInfo"
           :polylineList="polylineList"

+ 4 - 3
pages/cbd/devicePhoto.vue

@@ -151,6 +151,7 @@ export default {
       title: '查看图片',
       currentThumbnail: 2,
       pestYype:{},
+      is_mark:0,
       device_id: '',
       time_begin: this.formatTime(new Date(new Date().getFullYear(), 0, 1)),
       time_end: this.formatTime(new Date()),
@@ -480,7 +481,7 @@ export default {
         this.pestList = [];
         const markers = [];
         // 根据原图宽度计算缩放比例
-        let scaleRatio = 4;
+        let scaleRatio = 3.1;
         // if (this.imageWidth >= 5000) {
         //   scaleRatio = 4;
         // } else if (this.imageWidth >= 4000) {
@@ -509,8 +510,8 @@ export default {
           this.is_mark = 1
           const { startX, startY,text } = item;
           // 使用缩放比例计算标记位置和尺寸
-          const x = (startX * scaleRatio / this.imageWidth) * 100;
-          const y = (startY * scaleRatio / this.imageHeight) * 100;
+          const x = (startX * scaleRatio / this.imageWidth) * 105;
+          const y = (startY * scaleRatio / this.imageHeight) * 105;
           const width = (item.width * scaleRatio / this.imageWidth) * 100;
           const height = (item.height * scaleRatio / this.imageHeight) * 100;
 

+ 34 - 23
pages/equipList2/index.vue

@@ -120,6 +120,7 @@
 		Debounce,
 		Throttle
 	} from '../../util/anitthro.js';
+	
 	export default {
 		data() {
 			return {
@@ -199,7 +200,6 @@
 					this.pur_id = this.menuList.find(item => item.pur_id == this.pur_id)?.pur_id || '';
 					this.current = this.menuList.findIndex(item => item.pur_id == this.pur_id);
 				}
-				
 				if(this.list.length > 1){
 					if(this.list[0].purview_name != '全部'){
 						this.list.unshift({
@@ -208,7 +208,13 @@
 						})
 					}
 				}
-        this.type_id = this.list[0].device_type_id;
+				const firstChild = this.list[0];
+        this.type_id = firstChild.device_type_id;
+				if(firstChild.device_type_id !== ''){
+					this.device_model = firstChild?.device_model || '';
+				}else{
+					this.device_model = '';
+				}
         this.initPage();
       },
 			async eqlist(tf) {
@@ -249,18 +255,18 @@
 						list.push(item)
 					}
 				})
-				if(list.length > 1){
-					if(this.list[0].purview_name != '全部'){
-						this.list.unshift({
-							device_type_id: '',
-							purview_name: '全部'
-						})
-					}
-				}
+				// if(list.length > 1){
+				// 	if(this.list[0].purview_name != '全部'){
+				// 		this.list.unshift({
+				// 			device_type_id: '',
+				// 			purview_name: '全部'
+				// 		})
+				// 	}
+				// }
         this.current = index;
         const item = this.list[0];
         this.pur_id = itemData.pur_id || '';
-        this.changeDevice(item,0);
+        // this.changeDevice(item,0);
 			},
       changeDevice(item,index){
 				this.currents = index;
@@ -278,6 +284,8 @@
 					this.device_model = 14;
 				}else if(name === 'gkcbd1'){
 					this.device_model = 15;
+				} else if(name === 'zhiCbd'){
+					this.device_model = 16;
 				} else {
 					this.device_model = item.device_model || '';
 				}
@@ -306,7 +314,6 @@
 			historys(item) {
 				const type_id = item.type_id;
 				item.pur_id = this.pur_id;
-				console.log(type_id,'type_idtype_idtype_id')
 				switch (type_id) {
 					// 水肥新设备
 					case 22:
@@ -334,6 +341,9 @@
 						uni.navigateTo({
 							url: '../prevention/equipmentdetails?shebei=' + JSON.stringify(item),
 						});
+						// uni.navigateTo({
+						// 	url: '../scd/detail?info=' + JSON.stringify(item),
+						// });
 						break;
 					case 38:
 						var obj = {};
@@ -363,7 +373,7 @@
 						break;
 					case 6:
 						uni.navigateTo({
-							url: '/pages/webview?device_id=' +
+							url: '/pages/webview/webview?device_id=' +
 								item.id +
 								'&accessToken=' +
 								this.accessToken,
@@ -372,7 +382,7 @@
         	case 44:
           uni.navigateTo({
             url:
-              '/pages/webviewdgp?device_id=' +
+              '/pages/webviewdgp/webviewdgp?device_id=' +
               item.id +
               '&accessToken=' +
               uni.getStorageSync('session_key') +
@@ -414,16 +424,18 @@
 					case 7:
 						item.addtime = item.uptime;
 						item.type = item.type_id;
-						
+						// uni.navigateTo({
+						// 	url: '../bzy/detail?info=' + JSON.stringify(item),
+						// });
 						if(item.pur_id == 458){
 							uni.navigateTo({
 								url: '../bzy/detail?info=' + JSON.stringify(item),
 							});
-					 }else{
-						uni.navigateTo({
-							url: '../cb/equip-detail/equip-detail?info=' + JSON.stringify(item),
-						});
-					}
+						}else{
+							uni.navigateTo({
+								url: '../cb/equip-detail/equip-detail?info=' + JSON.stringify(item),
+							});
+						}
 						break;
 					case 8:
 						uni.navigateTo({
@@ -727,8 +739,8 @@
 	}
 
 	.inputs {
-		width: calc(100% - 72rpx);
-		margin-left: 36rpx;
+		width: 65%;
+		margin-left: 12rpx;
 
 		/deep/.u-content {
 			background-color: #fff !important;
@@ -876,7 +888,6 @@
 			position: relative;
 			background-color: #ffffff;
 			border-radius: 16rpx;
-			position: relative;
 			.list_item_top {
 				.p1 {
 					width: 86%;