achao há 2 anos atrás
pai
commit
53ad60f080
1 ficheiros alterados com 32 adições e 11 exclusões
  1. 32 11
      pages/user/newReport.vue

+ 32 - 11
pages/user/newReport.vue

@@ -1009,10 +1009,11 @@
 			},
 			makeYData(max) {
 				if (max <= 100) {
-					return Math.ceil(max * 1.05 / 10) * 10
-				} else if (100 < max <= 1000) {
+					return Math.ceil(max * 1.05 / 20) * 20
+				} else if (max <= 1000) {
 					return Math.ceil(max * 1.05 / 100) * 100
-				} else if (1000 < max) {
+				} else if (max > 1000) {
+					console.log(111)
 					return Math.ceil(max * 1.05 / 500) * 500
 				}
 				// Math.ceil(_max * 1.05 / 500) * 500
@@ -1084,6 +1085,7 @@
 				};
 				// this.opts.yAxis.data[0].max = Math.ceil(_max / 1000) * 1000
 				// 处理y轴最大值
+				console.log("max1", _max)
 				let _newMax = this.makeYData(_max)
 				console.log('max1', _newMax)
 				// this.opts.yAxis.data[0].max = Math.ceil(_max * 1.05 / 500) * 500
@@ -1111,12 +1113,10 @@
 				_max = _xMax1 > _xMax2 ? _xMax1 : _xMax2
 				console.log(_xMax1)
 				console.log(_xMax2)
-				// console.log(Math.ceil(_max / 100) * 100)
-				this.opts2.xAxis.max = Math.ceil(_max / 100) * 100
-				// for (let i = 0; i < val[5].biViewInfoList.length; i++) {
-				// 	_count2.push(val[5].biViewInfoList[i].weight)
-				// }
-
+				// this.opts2.xAxis.max = Math.ceil(_max / 100) * 100
+				let _newMax = this.makeYData(_max)
+				console.log('max2', _newMax)
+				this.opts2.xAxis.max = _newMax
 
 
 				let res1 = {
@@ -1139,6 +1139,7 @@
 				this.chartData1 = JSON.parse(JSON.stringify(res1));
 			},
 			makeDate3(val) {
+				let _max = 0
 				let _categorieslr = []
 				let _countlr = []
 				if (val[5].biViewInfoList.length > 0) {
@@ -1146,10 +1147,13 @@
 						_categorieslr.push(val[5].biViewInfoList[i].name.substring(0, 2))
 						_countlr.push(val[5].biViewInfoList[i].weight ? val[5].biViewInfoList[i].weight : 0)
 					}
-
+					_max = Math.max(..._countlr)
 				} else {
 					this.isHaveData3 = false
 				}
+				let _newMax = this.makeYData(_max)
+				console.log('max3', _newMax)
+				this.opts3.yAxis.data[0].max = _newMax
 				//利润核算
 				let res3 = {
 					categories: _categorieslr,
@@ -1222,8 +1226,10 @@
 				]
 			},
 			makeDate5(val) {
+				let _max = 0
 				let _categorieslr = []
 				let _count = []
+				let count = []
 				if (val[7].biViewInfoList && val[9].biViewInfoList.length > 0) {
 					for (let i = 0; i < val[9].biViewInfoList.length; i++) {
 						let _obj = {
@@ -1234,8 +1240,14 @@
 						}
 						_categorieslr.push(val[9].biViewInfoList[i].name)
 						_count.push(_obj)
+						count.push(Number(val[9].biViewInfoList[i].weight ? val[9].biViewInfoList[i].weight : 0))
 					}
+					_max = Math.max(...count)
+
 				}
+				let _newMax = this.makeYData(_max)
+				console.log('max5', _newMax)
+				this.opts5.yAxis.data[0].max = _newMax
 				// 		data: [{
 				// 				value: 10000,
 				// 				color: "#FFBB6E"
@@ -1365,19 +1377,28 @@
 				let _data1 = []
 				this.appTotal = val[12].count
 				this.lmTotal = val[13].count
+				let _max1 = 0
+				let _max2 = 0
 				if (val[12].biViewInfoList && val[12].biViewInfoList.length) {
 					for (let i = 0; i < val[12].biViewInfoList.length; i++) {
 						_categories.push(new Date(val[12].biViewInfoList[i].name).getMonth() + 1 + '月')
 						_data.push(val[12].biViewInfoList[i].weight)
 					}
 				}
+				_max1 = Math.max(..._data)
 				if (val[13].biViewInfoList && val[13].biViewInfoList.length > 0) {
 					for (let i = 0; i < val[13].biViewInfoList.length; i++) {
 						_categories1.push(new Date(val[13].biViewInfoList[i].name).getMonth() + 1 + '月')
 						_data1.push(val[13].biViewInfoList[i].weight)
 					}
 				}
-
+				_max2 = Math.max(..._data1)
+				let _newMax1 = this.makeYData(_max1)
+				console.log('max8', _newMax1)
+				this.opts8.yAxis.data[0].max = _newMax1
+				let _newMax2 = this.makeYData(_max2)
+				console.log('max9', _newMax2)
+				this.opts9.yAxis.data[0].max = _newMax2
 				let res8 = {
 					categories: _categories,
 					series: [{