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