Procházet zdrojové kódy

修改书籍统计报表保留2位小数

wangchao před 3 roky
rodič
revize
02a3c7721b
1 změnil soubory, kde provedl 32 přidání a 24 odebrání
  1. 32 24
      pages/user/report.vue

+ 32 - 24
pages/user/report.vue

@@ -156,7 +156,7 @@
 				<view class="title" @click="goToPage(4)">粮食品种占比</view>
 				<u-line color="#EEEEEE" class="u-line" />
 				<qiun-data-charts type="line" class='line-chart' :chartData="chartData" :opts='zringoptions'
-					background="none" :ontouch="true"/>
+					background="none" :ontouch="true" />
 			</view>
 			<view class="content4 content-wrap">
 				<view class="title">在途信息统计表</view>
@@ -196,7 +196,7 @@
 				<iframe class='map' :src='url'></iframe>
 			</view>
 
-		<!-- 	<view class="content7">
+			<!-- 	<view class="content7">
 				<maoScroll :data="ztList" :showNum="showNum" :lineHeight="lineHeight" :animationScroll="animationScroll"
 					:animation="animation">
 					<template v-slot="{line}">
@@ -214,17 +214,18 @@
 				</maoScroll>
 			</view> -->
 			<view class="content7">
-			    <view class="row1" v-for="(item,index) in ztList">
-			     <view class="zt">
-			      <view class="point"></view>在途
-			     </view>
-			     <view>{{item.startName}}</view>
-			     <img src="https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/jiantou.png" alt="">
-			     <view class="">
-			      {{item.endName}}
-			     </view>
-			    </view>
-			   </view>
+				<view class="row1" v-for="(item,index) in ztList">
+					<view class="zt">
+						<view class="point"></view>在途
+					</view>
+					<view>{{item.startName}}</view>
+					→
+					<!-- <img src="https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/jiantou.png" alt=""> -->
+					<view class="">
+						{{item.endName}}
+					</view>
+				</view>
+			</view>
 		</view>
 
 		<u-select v-model="showDate" mode="mutil-column" confirm-color='#22C572' :list="dateList" @confirm="confirm">
@@ -296,7 +297,7 @@
 					percentage: ''
 				},
 				dateList: [
-					[ {
+					[{
 							value: '1',
 							label: '2021年'
 						},
@@ -401,7 +402,8 @@
 				}
 			},
 			init() {
-				this.url = "https://liangxin.zthymaoyi.com/map_0105.html?id=" + uni.getStorageSync('pcUserInfo').compId +'&seachMoth='+this.seachMoth
+				this.url = "https://liangxin.zthymaoyi.com/map_0105.html?id=" + uni.getStorageSync('pcUserInfo').compId +
+					'&seachMoth=' + this.seachMoth
 				this.$api.doRequest('get', '/biInfoController/selectBiInfo?compId=' + uni.getStorageSync('pcUserInfo')
 					.compId + '&seachMoth=' + this.seachMoth).then(res => {
 					console.log(res)
@@ -419,12 +421,17 @@
 						if (i < 6) {
 							res.data.data[i].biViewInfoList[0].percent = Number(res.data.data[i].biViewInfoList[0]
 								.percentage.substring(0, res.data.data[i].biViewInfoList[0].percentage.length -
-									1))
+									1)).toFixed(2)
+							res.data.data[i].biViewInfoList[0].percentage = Number(res.data.data[i].biViewInfoList[
+									0]
+								.percentage.substring(0, res.data.data[i].biViewInfoList[0].percentage.length -
+									1)).toFixed(2) + '%'
+							res.data.data[i].total = Number(res.data.data[i].total).toFixed(2)
 							switch (i) {
 								case 0:
 									this.dataObj0 = {
 										percentage: res.data.data[i].biViewInfoList[0].percentage,
-										total: Number(res.data.data[i].total),
+										total: res.data.data[i].total,
 										percent: Number(res.data.data[i].biViewInfoList[0].percent)
 									}
 									break;
@@ -604,15 +611,15 @@
 							}
 
 						} else if (i == 7) {
-							this.inventoryCost = Number(res.data.data[i].biViewInfoList[0].count)
-							this.inventoryValue = Number(res.data.data[i].biViewInfoList[1].count)
+							this.inventoryCost = Number(res.data.data[i].biViewInfoList[0].count).toFixed(2)
+							this.inventoryValue = Number(res.data.data[i].biViewInfoList[1].count).toFixed(2)
 
 						} else if (i == 8) {
 							let _x = []
 							let _y = []
 							for (let k = 0; k < res.data.data[i].biViewInfoList.length; k++) {
 								_x.push(res.data.data[i].biViewInfoList[k].name)
-								_y.push(Number(res.data.data[i].biViewInfoList[k].count))
+								_y.push(Number(res.data.data[i].biViewInfoList[k].count).toFixed(2))
 							}
 							this.chartData = {
 								categories: _x,
@@ -734,7 +741,8 @@
 						} else if (i == 9) {
 							for (let k = 0; k < res.data.data[i].biViewInfoList.length; k++) {
 								var obj = res.data.data[i].biViewInfoList[k]
-								obj.startName = obj.name.split('→')[0].substring(0, 5) + '...'
+								// obj.startName = obj.name.split('→')[0].substring(0, 5) + '...'
+								obj.startName = obj.name.split('→')[0]
 								obj.endName = obj.name.split('→')[1]
 							}
 							this.ztList = res.data.data[i].biViewInfoList
@@ -747,11 +755,11 @@
 			},
 			confirm(e) {
 				console.log(e)
-				this.nowDate = e[0].label+e[1].label
+				this.nowDate = e[0].label + e[1].label
 				let _year = e[0].label.substring(0, 4)
-				
+
 				if (e[1].label != '全年') {
-					this.seachMoth = _year +'-'+ e[1].value
+					this.seachMoth = _year + '-' + e[1].value
 				} else {
 					this.seachMoth = _year
 				}