Commit a95ecb1e by 匡雅琴

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

2 parents 9a285641 1ef02195
...@@ -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-07-07 14:04:45 * @LastEditTime: 2023-07-07 14:24:23
--> -->
<template> <template>
<div> <div>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import * as echarts from 'echarts' import * as echarts from 'echarts'
import getBarLineOptions from './BarLineOptions' import BarOptions from './BarOptions'
export default { export default {
name: 'BarChart', name: 'BarChart',
props: { props: {
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
} }
}, },
created() { created() {
this.barLineOptions = getBarLineOptions({ tooltipFormatter: this.tooltipFormatter }) this.barLineOptions = BarOptions({ tooltipFormatter: this.tooltipFormatter })
}, },
mounted() { mounted() {
this.barLineDom = document.getElementById(this.domId) this.barLineDom = document.getElementById(this.domId)
...@@ -80,12 +80,11 @@ export default { ...@@ -80,12 +80,11 @@ export default {
}) })
return _txt return _txt
}, },
drawBarLine() { drawBar() {
console.log(this.dataList) console.log(this.dataList)
this.barLineOptions.xAxis.data = this.dataList.map(item => item.month) this.barLineOptions.xAxis.data = this.dataList.map(item => item.month)
this.barLineOptions.series[0].data = this.dataList.map(item => item.data1) this.barLineOptions.series[0].data = this.dataList.map(item => item.data1)
this.barLineOptions.series[1].data = this.dataList.map(item => item.data2) this.barLineOptions.series[1].data = this.dataList.map(item => item.data2)
this.barLineOptions.series[2].data = this.dataList.map(item => item.data3)
this[this.domId].setOption(this.barLineOptions) this[this.domId].setOption(this.barLineOptions)
} }
} }
......
...@@ -48,7 +48,7 @@ function getBarLineOptions(obj) { ...@@ -48,7 +48,7 @@ function getBarLineOptions(obj) {
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
top: '10%', top: '20%',
bottom: '6%', bottom: '6%',
containLabel: true containLabel: true
}, },
...@@ -59,7 +59,9 @@ function getBarLineOptions(obj) { ...@@ -59,7 +59,9 @@ function getBarLineOptions(obj) {
stack: 'one', stack: 'one',
data: [], data: [],
label: { label: {
show: true show: true,
position: 'insideTop',
color: '#fff'
}, },
itemStyle: { itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角 barBorderRadius: [2, 2, 0, 0], // 柱体圆角
...@@ -97,7 +99,9 @@ function getBarLineOptions(obj) { ...@@ -97,7 +99,9 @@ function getBarLineOptions(obj) {
type: 'bar', type: 'bar',
stack: 'one', stack: 'one',
label: { label: {
show: true show: true,
position: 'insideTop',
color: '#fff'
}, },
data: [], data: [],
itemStyle: { itemStyle: {
......
/*
* @Description:
* @Author: huyue
* @Date: 2023-07-07 14:04:52
* @LastEditors: huyue
* @LastEditTime: 2023-07-07 14:35:44
*/
import * as echarts from 'echarts' import * as echarts from 'echarts'
function getBarLineOptions(obj) { function getBarLineOptions(obj) {
// const { tooltipFormatter } = obj const { tooltipFormatter } = obj
var barLineOption = { var barLineOption = {
tooltip: { tooltip: {
// trigger: 'axis', trigger: 'axis',
// borderWidth: 0, borderWidth: 0,
// backgroundColor: 'rgba(68,68,68,0.80)', backgroundColor: 'rgba(68,68,68,0.80)',
// textStyle: { textStyle: {
// color: 'rgba(255,255,255,0.6)', color: 'rgba(255,255,255,0.6)',
// fontSize: '1.5px' fontSize: '1.5px'
// }, },
// formatter: tooltipFormatter || '', formatter: tooltipFormatter || '',
// confine: true confine: true
}, },
xAxis: { xAxis: {
data: [] data: []
...@@ -19,8 +26,8 @@ function getBarLineOptions(obj) { ...@@ -19,8 +26,8 @@ function getBarLineOptions(obj) {
yAxis: { yAxis: {
name: '', name: '',
type: 'value', type: 'value',
min: 0, // min: 0,
max: 10000, // max: 100,
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: '#1d2a38' color: '#1d2a38'
...@@ -38,7 +45,6 @@ function getBarLineOptions(obj) { ...@@ -38,7 +45,6 @@ function getBarLineOptions(obj) {
{ {
name: 'bar', name: 'bar',
type: 'bar', type: 'bar',
stack: 'one',
data: [], data: [],
label: { label: {
show: true show: true
...@@ -46,29 +52,18 @@ function getBarLineOptions(obj) { ...@@ -46,29 +52,18 @@ function getBarLineOptions(obj) {
itemStyle: { itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角 barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) { color: function(params) {
const colorList = [
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF']
]
var colorItem = colorList[params.dataIndex]
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: colorItem[0] color: '#22D8FF'
}, // 柱图渐变色 }, // 柱图渐变色
{ {
offset: 0.5, // 指100%处的颜色
color: '#223FA9'
},
{
offset: 1, // 指100%处的颜色 offset: 1, // 指100%处的颜色
color: colorItem[1] color: '#061422'
}] }]
) )
} }
...@@ -77,7 +72,6 @@ function getBarLineOptions(obj) { ...@@ -77,7 +72,6 @@ function getBarLineOptions(obj) {
{ {
name: 'bar2', name: 'bar2',
type: 'bar', type: 'bar',
stack: 'one',
label: { label: {
show: true show: true
}, },
...@@ -85,29 +79,18 @@ function getBarLineOptions(obj) { ...@@ -85,29 +79,18 @@ function getBarLineOptions(obj) {
itemStyle: { itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角 barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) { color: function(params) {
const colorList = [
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972']
]
var colorItem = colorList[params.dataIndex]
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: colorItem[0] color: '#2AD191'
}, // 柱图渐变色 }, // 柱图渐变色
{ {
offset: 0.5, // 指100%处的颜色
color: '#0E958D'
},
{
offset: 1, // 指100%处的颜色 offset: 1, // 指100%处的颜色
color: colorItem[1] color: '#061422'
}] }]
) )
} }
......
...@@ -3,20 +3,26 @@ ...@@ -3,20 +3,26 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-05 10:35:43 * @Date: 2023-07-05 10:35:43
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-06 17:41:10 * @LastEditTime: 2023-07-07 14:19:28
--> -->
<template> <template>
<div class="left"> <div class="left">
<StatisticsBox :list="solarList" bottomType="money"></StatisticsBox> <StatisticsBox :list="solarList" bottomType="money"></StatisticsBox>
<PurchaseTrends></PurchaseTrends> <PurchaseTrends></PurchaseTrends>
<div class="left-bottom">
<MerchantTrends class="bottom-trends"></MerchantTrends>
<div class="bottom-storage">ddd</div>
</div>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import PurchaseTrends from './PurchaseTrends.vue' import PurchaseTrends from './PurchaseTrends.vue'
import MerchantTrends from './MerchantTrends.vue'
export default { export default {
name: 'ContentLeft', name: 'ContentLeft',
components: { components: {
PurchaseTrends PurchaseTrends,
MerchantTrends
}, },
data() { data() {
return { return {
...@@ -63,5 +69,15 @@ export default { ...@@ -63,5 +69,15 @@ export default {
width: 64.17vw; width: 64.17vw;
overflow: hidden; overflow: hidden;
// background: #091C40; // background: #091C40;
&-bottom {
display: flex;
.bottom-trends {
width: 43.33vw;
margin-right: 1.11vw;
}
.bottom-storage {
flex: 1;
}
}
} }
</style> </style>
<!--
* @Description: 近一年采购额趋势图
* @Author: huyue
* @Date: 2023-07-06 16:19:15
* @LastEditors: huyue
* @LastEditTime: 2023-07-07 14:35:36
-->
<template>
<div class="merchant-box">
<box-title title="商户开通及使用趋势"></box-title>
<BarChart ref="merchantTrendsRef" height="28.67vh" domId="merchantTrends" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarChart>
</div>
</template>
<script type="text/ecmascript-6">
import { changeMixin } from '@/mixins'
export default {
name: 'MerchantTrends',
mixins: [changeMixin],
data() {
return {
tooltipFormatterObj: [
{
label: '商城',
attrName: 'data1'
},
{
label: '自采',
attrName: 'data2'
}
],
dataList: []
}
},
mounted() {
},
methods: {
init() {
const p = new Promise((resolve) => {
for (let i = 0; i < 12; i++) {
this.dataList.push({
month: i + 1 + '月',
data1: +(Math.random() * 20).toFixed(2),
data2: +(Math.random() * 40).toFixed(2)
})
}
resolve()
})
p.then(() => {
this.$refs.merchantTrendsRef.drawBar()
})
}
}
}
</script>
<style scoped lang='scss'>
.merchant-box {
// margin: 1.78vh 0;
background-color: #061422;
box-shadow: inset 0 0 20px 0 #3d57ff69;
}
</style>
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-06 16:19:15 * @Date: 2023-07-06 16:19:15
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-07 13:54:35 * @LastEditTime: 2023-07-07 14:22:00
--> -->
<template> <template>
<div class="purchase-box"> <div class="purchase-box">
<box-title title="采购额排名"></box-title> <box-title title="采购额排名"></box-title>
<BarLineChart ref="purchaseRef" height="25.37vh" domId="purchase" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart> <BarLineChart ref="purchaseRef" height="30.26vh" domId="purchase" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart>
</div> </div>
</template> </template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!