Jelajahi Sumber

雷达图去重,去多余

Ming 4 tahun lalu
induk
melakukan
f6c697f6f5
2 mengubah file dengan 8 tambahan dan 37 penghapusan
  1. 2 4
      pages/index/components/chart/chart.vue
  2. 6 33
      pages/index/index.vue

+ 2 - 4
pages/index/components/chart/chart.vue

@@ -24,18 +24,15 @@
 				default: null
 			}
 		},
-
 		computed: {
 			bindData() {
 				return this.fbindData;
 			},
-
 		},
 		data() {
 
 			return {
 				option: {
-
 					tooltip: {
 						formatter: () => {
 							var html = '';
@@ -118,7 +115,7 @@
 								},
 							},
 						},
-						indicator: this.findicator.slice(0,5)
+						indicator: this.findicator
 					},
 
 					series: [{
@@ -149,6 +146,7 @@
 			}
 		},
 		onLoad() {
+		
 
 		},
 		methods: {

+ 6 - 33
pages/index/index.vue

@@ -322,30 +322,7 @@
 			},
 			// 下拉选择
 			clickSelectItem(item, index) {
-				this.staticData = '';
-				this.datavalue='';
-				// this.dataname='';
-				
-				
-				/** 数组对象去重方法一 */
-				
-				  // let obj1 = {};
-				  // let res1 = [];
-				  // this.indicator.forEach((item)=> {
-				  //   if(!obj1[item.color]) {
-				  //       res1.push(item);
-				  //       obj1[item.color] = true;
-				  //   }
-				  // });
-				  // console.log(res1);
-				  // this.indicator=res1;
-				  // console.log('this.indicator');
-				  // console.log(this.indicator);
-				  
-				  
-				  
-				  
-				// this.indicator=null;
+				this.staticData = '';
 				this.selectedCode = item.owner_code;
 				uni.setStorageSync('selectedCode', item.owner_code);
 				uni.setStorageSync('selectedName', item.owner_name);
@@ -386,16 +363,15 @@
 				// console.log(res.data.data[0])
 				this.staticData = res.data.data[0];
 				
-				var data = res.data.data[0]
+				// var data = res.data.data[0]
 				
-				var datavalue = [data.fire_water_count, data.alarm_host_count, data
-					.electrical_fire_count, data.other_count, data.video_monitoring_count
+				var datavalue = [this.staticData.fire_water_count, this.staticData.alarm_host_count, this.staticData.electrical_fire_count, this.staticData.other_count, this.staticData.video_monitoring_count
 				]
 				var dataname = ['消防水系统', '报警主机', '电气火灾', '其他', '监控视频']
 				var color = ['#3C8BF0', '#06CDF8', '#0ECB70', '#6744EF', '#FFD803'];
 				
-				var aa = [data.fire_water_count, data.alarm_host_count, data
-					.electrical_fire_count, data.other_count, data.video_monitoring_count
+				var aa = [this.staticData.fire_water_count, this.staticData.alarm_host_count, this.staticData
+					.electrical_fire_count, this.staticData.other_count, this.staticData.video_monitoring_count
 				]
 				aa.sort(function(a, b) {
 					return a - b;
@@ -413,10 +389,7 @@
 						color: color[ind]
 					})
 				})
-				
-				
-				console.log('父组件staticData.alarm_host_count')
-				console.log(this.staticData.alarm_host_count)
+				this.indicator=this.indicator.slice(-5)
 			},
 			// 未处理告警请求
 			async getHandleData(param = {}) {