Commit a1c37b62 by 匡雅琴

Merge branch 'v1.3.0' of http://192.168.3.233:8090/h5/glsk-data-view-pd into v1.3.0

2 parents 04d2fe2a c87524d7
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-04 13:55:35
* @LastEditors: huyue
* @LastEditTime: 2023-08-02 17:21:46
* @LastEditTime: 2023-08-03 15:13:31
-->
<template>
<div class="left">
......@@ -11,28 +11,38 @@
<box-title title="总产值"></box-title>
<div class="left-statistics">
<div class="statistics-top">
<div class="statistics-price"><span class="statistics-unit">¥</span><span class="statistics-price-number">{{numAddSymbol(2280708)}}</span><span>%</span></div>
<div class="statistics-price"><span class="statistics-unit">¥</span><span class="statistics-price-number">{{numAddSymbol(2280708)}}</span></div>
</div>
<div class="ratio">
<div class="ratio-left">周同比<span class="positive">12%</span></div>
<div class="ratio-right">日环比<span class="negative">-7%</span></div>
</div>
<BarChart ref="amountChartRef" domId="amountChart" :dataList.sync="amountDataList" :tooltipFormatterObj="amountTooltip"></BarChart>
<BarChart ref="amountChartRef" domId="amountChart" :dataList.sync="dataList.amountDataList" :colorList="color.amountColorList" :tooltipFormatterObj="tooltips.amountTooltip"></BarChart>
</div>
</div>
<div class="left-box">
<box-title title="总场次"></box-title>
<div class="left-statistics">
<div class="statistics-top">
<div class="statistics-price"><span class="statistics-price-number">{{numAddSymbol(2280708)}}</span><span>场</span></div>
</div>
<BarChart ref="sessionChartRef" class="box1" domId="sessionChart" :dataList.sync="dataList.amountDataList" :colorList="color.sessionColorList" :tooltipFormatterObj="tooltips.amountTooltip"></BarChart>
</div>
</div>
<div class="left-box">
<box-title title="总产值"></box-title>
<div class="left-statistics">
<div class="statistics-top">
<div class="statistics-price"><span class="statistics-price-number">{{numAddSymbol(2280708)}}</span><span>单</span></div>
</div>
<BarChart ref="outputChartRef" class="box1" domId="outputChart" :dataList.sync="dataList.amountDataList" :colorList="color.outputColorList" :tooltipFormatterObj="tooltips.amountTooltip"></BarChart>
</div>
</div>
</div>
</template>
<script>
import BarChart from './compoments/BarChart.vue'
import BarChart from './components/BarChart.vue'
export default {
name: 'CrowdfundLeft',
components: {
......@@ -40,17 +50,47 @@ export default {
},
data() {
return {
amountDataList: [1000, 1000, 5000, 10000, 20000],
amountTooltip: [
{
label: '部署门店',
attrName: 'data1'
dataList: {
amountDataList: [
{
month: '1月',
amount: 100
},
{
month: '2月',
amount: 1000
},
{
month: '3月',
amount: 1000
},
{
month: '4月',
amount: 650
},
{
month: '5月',
amount: 800
}
]
},
tooltips: {
amountTooltip: {
label: '总产值',
attrName: 'amount'
}
]
},
color: {
amountColorList: ['#2AD191', '#00A89E', '#061422'],
sessionColorList: ['#22D8FF', '#223FA9', '#061422'],
outputColorList: ['#FFC200', '#704C16', '#061422']
}
}
},
mounted() {
this.$refs.amountChartRef.drawBar()
this.$refs.sessionChartRef.drawBar()
this.$refs.outputChartRef.drawBar()
}
}
</script>
......@@ -114,5 +154,8 @@ export default {
color: #16E193;
}
}
.box1 {
margin-top: 3vh;
}
</style>
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-07 14:01:42
* @LastEditors: huyue
* @LastEditTime: 2023-08-02 17:21:01
* @LastEditTime: 2023-08-03 14:58:05
-->
<template>
<div>
......@@ -26,24 +26,25 @@ export default {
default: () => []
},
tooltipFormatterObj: {
type: Array,
type: Object,
default: () => {
return [
{
label: '数量',
attrName: 'num'
}
]
return {
label: '数量',
attrName: 'num'
}
}
},
colorList: {
type: Array
}
},
data() {
return {
barLineOptions: []
barOptions: []
}
},
created() {
this.barOptions = BarOptions({ tooltipFormatter: this.tooltipFormatter })
this.barOptions = BarOptions({ tooltipFormatter: this.tooltipFormatter }, this.colorList)
},
mounted() {
this.barDom = document.getElementById(this.domId)
......@@ -55,17 +56,17 @@ export default {
var _currentItem = this.dataList[obj[0].dataIndex]
var _html = ''
var _txt = ''
this.tooltipFormatterObj.forEach(item => {
_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>`
})
_txt += `<div style="display:flex;"><div style="color: #c9c9c9">${this.tooltipFormatterObj.label}:</div><div style="color: #fff;">${utils.numAddSymbol(_currentItem[this.tooltipFormatterObj.attrName])}${this.tooltipFormatterObj.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}
</div>`
return _html
},
drawBar() {
console.log(this.dataList)
this.barOptions.xAxis.data = ['1月', '2月', '3月', '4月', '5月']
this.barLineOptions.series[0].data = this.dataList
this.barOptions.series[0].data = this.dataList.map(item => item.amount)
this[this.domId].setOption(this.barOptions)
},
chartBindEvent() {
// resize
......
......@@ -3,10 +3,10 @@
* @Author: huyue
* @Date: 2023-07-07 14:04:52
* @LastEditors: huyue
* @LastEditTime: 2023-08-02 17:12:26
* @LastEditTime: 2023-08-03 15:12:53
*/
import * as echarts from 'echarts'
function getBarLineOptions(obj) {
function getBarOptions(obj, colorList) {
const { tooltipFormatter } = obj
var barLineOption = {
tooltip: {
......@@ -19,6 +19,7 @@ function getBarLineOptions(obj) {
xAxis: {
data: []
},
barWidth: '14',
yAxis: {
name: '',
type: 'value',
......@@ -31,10 +32,10 @@ function getBarLineOptions(obj) {
}
},
grid: {
left: '3%',
left: '0',
right: '4%',
top: '20%',
bottom: '6%',
bottom: '4%',
containLabel: true
},
series: [
......@@ -51,11 +52,15 @@ function getBarLineOptions(obj) {
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: '#22D8FF'
color: colorList[0]
}, // 柱图渐变色
{
offset: 0.5, // 指100%处的颜色
color: colorList[1]
},
{
offset: 1, // 指100%处的颜色
color: '#061422'
color: colorList[2]
}]
)
}
......@@ -66,4 +71,4 @@ function getBarLineOptions(obj) {
return barLineOption
}
export default getBarLineOptions
export default getBarOptions
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!