Commit 489435db by 胡悦

格式化数字

1 parent 2b5441dd
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-07 14:01:42
* @LastEditors: huyue
* @LastEditTime: 2023-07-11 14:28:35
* @LastEditTime: 2023-07-17 16:00:27
-->
<template>
<div>
......@@ -14,6 +14,7 @@
<script type="text/ecmascript-6">
import * as echarts from 'echarts'
import BarOptions from './BarOptions'
import utils from '../utils/util'
export default {
name: 'BarChart',
props: {
......@@ -75,7 +76,7 @@ export default {
var _html = ''
var _txt = ''
this.tooltipFormatterObj.forEach(item => {
_txt += `<div style="display:flex;"><div style="color: #c9c9c9">${item.label}:</div><div style="color: #fff;">${_currentItem[item.attrName]}${item.addSymbol || ''}</div></div>`
_txt += `<div style="display:flex;"><div style="color: #c9c9c9">${item.label}:</div><div style="color: #fff;">${utils.numAddSymbol(_currentItem[item.attrName])}${item.addSymbol || ''}</div></div>`
})
_html += `<div style="backdrop-filter: blur(4px);background-color: #051526;border: 2px solid;border-image: linear-gradient(90deg, #074989, #30DCFF, #074989) 1;padding: 10px;">
${_txt}
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: huyue
* @LastEditTime: 2023-07-11 14:29:12
* @LastEditTime: 2023-07-17 15:58:43
* @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -13,6 +13,7 @@
</template>
<script type="text/ecmascript-6">
import utils from '../utils/util'
import * as echarts from 'echarts'
import getBarLineOptions from './BarLineOptions'
export default {
......@@ -76,7 +77,7 @@ export default {
var _html = ''
var _txt = ''
this.tooltipFormatterObj.forEach(item => {
_txt += `<div style="display:flex;"><div style="color: #c9c9c9">${item.label}:</div><div style="color: #fff;">${_currentItem[item.attrName]}${item.addSymbol || ''}</div></div>`
_txt += `<div style="display:flex;"><div style="color: #c9c9c9">${item.label}:</div><div style="color: #fff;">${utils.numAddSymbol(_currentItem[item.attrName])}${item.addSymbol || ''}</div></div>`
})
_html += `<div style="backdrop-filter: blur(4px);background-color: #051526;border: 2px solid;border-image: linear-gradient(90deg, #074989, #30DCFF, #074989) 1;padding: 10px;">
${_txt}
......
import * as echarts from 'echarts'
import utils from '../utils/util'
function getBarLineOptions(obj) {
const { tooltipFormatter } = obj
var barLineOption = {
......@@ -6,25 +7,8 @@ function getBarLineOptions(obj) {
trigger: 'axis',
borderWidth: 0,
padding: 0,
// borderColor: function(p) {
// return new echarts.graphic.LinearGradient(
// 0, 0, 0, 1, [{ // 代表渐变色从正上方开始
// offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
// color: '#074989'
// }, // 柱图渐变色
// {
// offset: 1, // 指100%处的颜色
// color: '#30DCFF'
// }]
// )
// },
backgroundColor: '#051526',
// textStyle: {
// color: '#c9c9c9',
// fontSize: '1.5px'
// },
formatter: tooltipFormatter || ''
// confine: true
},
xAxis: {
data: []
......@@ -68,7 +52,10 @@ function getBarLineOptions(obj) {
label: {
show: true,
position: 'top',
color: '#fff'
color: '#fff',
formatter: (params) => {
return utils.numAddSymbol(params.value)
}
},
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
......@@ -100,7 +87,10 @@ function getBarLineOptions(obj) {
label: {
show: true,
position: 'top',
color: '#fff'
color: '#fff',
formatter: (params) => {
return utils.numAddSymbol(params.value)
}
},
data: [],
itemStyle: {
......
......@@ -112,13 +112,19 @@ export default {
padding: 0 1.39vw;
cursor: pointer;
&:hover {
color: #FFFFFF;
color: #5894FF;
background-image: -webkit-linear-gradient(left, #24D8FF, #7787FF);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
&:last-child {
margin-bottom: 0;
}
&.active {
color: #FFFFFF;
color: #5894FF;
background-image: -webkit-linear-gradient(left, #24D8FF, #7787FF);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
}
......
......@@ -3,20 +3,20 @@
<div class="statistics-item" v-for="(item, index) in list" :key="index" :style="{'width': 100 / list.length + '%'}">
<div class="statistics-top">
<div class="statistics-name">{{item.name}}</div>
<div class="statistics-price">¥<span class="statistics-price-number">{{item.value}}</span></div>
<div class="statistics-price">¥<span class="statistics-price-number">{{numAddSymbol(item.value)}}</span></div>
<div v-if="item.rate" class="statistics-top-rate">占比<span>{{item.rate}}</span></div>
</div>
<div class="statistics-bottom">
<template v-if="item.bottomType == 'money'">
<span> {{item.bottomLabel}}</span>
<span>¥{{item.bottomValue}}</span>
<span>¥{{numAddSymbol(item.bottomValue)}}</span>
</template>
<template v-else-if="item.bottomType == 'slot'">
<slot name="bottom"></slot>
</template>
<template v-else>
<span>{{item.bottomLabel}}</span>
<span>{{item.bottomValue}}</span>
<span>{{numAddSymbol(item.bottomValue)}}</span>
</template>
</div>
</div>
......
......@@ -3,11 +3,11 @@
* @Author: huyue
* @Date: 2023-07-04 13:56:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-17 10:37:36
* @LastEditTime: 2023-07-17 15:50:17
-->
<template>
<div class="view-content">
<ViewDate :dataList="yearList" :businessTime="businessTime"></ViewDate>
<ViewDate :defaultYear="defaultYear" :dataList="yearList" :businessTime="businessTime"></ViewDate>
<div class="content">
<ContentLeft></ContentLeft>
<ContentRight></ContentRight>
......@@ -30,7 +30,8 @@ export default {
data() {
return {
businessTime: '',
yearList: []
yearList: [],
defaultYear: ''
}
},
created() {
......@@ -43,6 +44,8 @@ export default {
async getYears() {
const _data = await this.api.solar.getYears({})
this.yearList = _data.data.dataList[0].year.reverse().map(item => item + '')
this.defaultYear = this.yearList[0]
console.log(this.defaultYear)
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!