zhengkaixin 4 месяцев назад
Родитель
Сommit
5b9dbccac8
1 измененных файлов с 35 добавлено и 34 удалено
  1. 35 34
      components/UMessage.vue

+ 35 - 34
components/UMessage.vue

@@ -163,40 +163,44 @@
 					key = key.substring(0, 5)
 					data1.push(key)
 					data2.push(item.ampere)
-					if(i==0){
-						if(item.ampere>this.maxAmpere){
-							keyswitch=1;
-						}
-					}
+					// if(i==0){
+					// 	if(item.ampere>this.maxAmpere){
+					// 		keyswitch=1;
+					// 	}
+					// }
 					// console.log(keyswitch==0&&item.ampere>this.maxAmpere)
 					// console.log(item.ampere,this.maxAmpere)
-					if(keyswitch==0&&item.ampere>this.maxAmpere){
+					// if(keyswitch==0&&item.ampere>this.maxAmpere){
 						
-						pieces.push({
-							gt: parseInt(gt),
-							lte:parseInt(i-1),
-							color: 'green'
-						})
-						gt=i-1
-						keyswitch=1
-					}else if(keyswitch==1&&item.ampere<this.maxAmpere){
+					// 	pieces.push({
+					// 		gt: parseInt(gt),
+					// 		lte:parseInt(i-1),
+					// 		color: 'green'
+					// 	})
+					// 	gt=i-1
+					// 	keyswitch=1
+					// }else if(keyswitch==1&&item.ampere<this.maxAmpere){
 						
-						pieces.push({
-							gt: parseInt(gt),
-							lte:parseInt(i-1),
-							color: 'red'
-						})
-						gt=i-1
-						keyswitch=0
-					}
+					// 	pieces.push({
+					// 		gt: parseInt(gt),
+					// 		lte:parseInt(i-1),
+					// 		color: 'red'
+					// 	})
+					// 	gt=i-1
+					// 	keyswitch=0
+					// }
 					
 				}
-				pieces.push({
-					gt: parseInt(gt),
-					lte:parseInt(this.ampereList.length),
-					color: keyswitch?'red':'green'
-				})
-				
+				// pieces.push({
+				// 	gt: parseInt(gt),
+				// 	lte:parseInt(this.ampereList.length),
+				// 	color: keyswitch?'red':'green'
+				// })
+				// visualMap: {
+				//     show: false,
+				//     dimension: 0,
+				//     pieces: pieces
+				//   },
 				
 				var option = {
 
@@ -240,11 +244,7 @@
 							return '加载中...';
 						}
 					},
-					visualMap: {
-					    show: false,
-					    dimension: 0,
-					    pieces: pieces
-					  },
+					
 					series: [{
 						data: data2,
 						type: 'line',
@@ -318,7 +318,8 @@
 					uni.hideLoading();
 					console.log(res)
 					this.ampereList = res.data.ampereList
-					this.maxAmpere = res.data.maxAmpere
+					this.maxAmpere = res.data.maxAmpere
+					console.log(this.maxAmpere)
 					this.initLine()
 				}).catch(error => {
 					uni.showToast({