achao 2 lat temu
rodzic
commit
7d205bcd8e
1 zmienionych plików z 24 dodań i 8 usunięć
  1. 24 8
      pages/user/newReport.vue

+ 24 - 8
pages/user/newReport.vue

@@ -181,7 +181,7 @@
 						<view class="name">
 							{{item.name}}
 						</view>
-						<view class="bottom flex alc">
+						<view class="bottom flex alc jcsb">
 							<u-line-progress :percent="item.percent" :active-color="color4(index)" :show-percent='false'
 								class='left' height='12'>
 							</u-line-progress>
@@ -1007,6 +1007,16 @@
 				}
 
 			},
+			makeYData(max) {
+				if (max <= 100) {
+					return Math.ceil(max * 1.05 / 10) * 10
+				} else if (100 < max <= 1000) {
+					return Math.ceil(max * 1.05 / 100) * 100
+				} else if (1000 < max) {
+					return Math.ceil(max * 1.05 / 500) * 500
+				}
+				// Math.ceil(_max * 1.05 / 500) * 500
+			},
 			makeDate1(val) {
 				console.log("val", val)
 				// 按月1
@@ -1073,8 +1083,13 @@
 					]
 				};
 				// this.opts.yAxis.data[0].max = Math.ceil(_max / 1000) * 1000
-				this.opts.yAxis.data[0].max = Math.ceil(_max * 1.05 / 500) * 500
+				// 处理y轴最大值
+				let _newMax = this.makeYData(_max)
+				console.log('max1', _newMax)
+				// this.opts.yAxis.data[0].max = Math.ceil(_max * 1.05 / 500) * 500
+				this.opts.yAxis.data[0].max = _newMax
 				this.chartData = JSON.parse(JSON.stringify(res));
+
 			},
 			makeDate2(val) {
 				let _categories = []
@@ -1096,7 +1111,7 @@
 				_max = _xMax1 > _xMax2 ? _xMax1 : _xMax2
 				console.log(_xMax1)
 				console.log(_xMax2)
-				console.log(Math.ceil(_max / 100) * 100)
+				// 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)
@@ -1164,7 +1179,7 @@
 						let _obj = {
 							percent: Number(val[8].biViewInfoList[i].weight).toFixed(0) / _maxWeight * 100,
 							name: val[8].biViewInfoList[i].name,
-							weight: Number(val[8].biViewInfoList[i].weight).toFixed(0) + '吨'
+							weight: Number(val[8].biViewInfoList[i].weight).toFixed(0)
 						}
 						console.log("库存储量", _obj)
 						this.clList.push(_obj)
@@ -1352,13 +1367,13 @@
 				this.lmTotal = val[13].count
 				if (val[12].biViewInfoList && val[12].biViewInfoList.length) {
 					for (let i = 0; i < val[12].biViewInfoList.length; i++) {
-						_categories.push(val[12].biViewInfoList[i].name)
+						_categories.push(new Date(val[12].biViewInfoList[i].name).getMonth() + 1 + '月')
 						_data.push(val[12].biViewInfoList[i].weight)
 					}
 				}
 				if (val[13].biViewInfoList && val[13].biViewInfoList.length > 0) {
 					for (let i = 0; i < val[13].biViewInfoList.length; i++) {
-						_categories1.push(val[13].biViewInfoList[i].name)
+						_categories1.push(new Date(val[13].biViewInfoList[i].name).getMonth() + 1 + '月')
 						_data1.push(val[13].biViewInfoList[i].weight)
 					}
 				}
@@ -1906,13 +1921,14 @@
 		}
 
 		.row3 {
-			padding: 10rpx 25rpx 30rpx 25rpx;
+			padding: 31rpx 25rpx 51rpx 25rpx;
 			border-radius: 15rpx;
-			margin-top: 20rpx;
+			margin-top: 31rpx;
 			background: #FAFAFA;
 
 
 
+
 			.list-item {
 				margin-top: 20rpx;