Commit 3837f3ed by 胡悦

修改

1 parent 6b2e6f81
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="statistics-top"> <div class="statistics-top">
<div class="statistics-name">{{item.name}}</div> <div class="statistics-name">{{item.name}}</div>
<div class="statistics-price"><span v-if="item.unit == '¥'">¥</span><span class="statistics-price-number">{{numAddSymbol(item.value)}}</span><span v-if="item.unit == '%'">%</span></div> <div class="statistics-price"><span v-if="item.unit == '¥'">¥</span><span class="statistics-price-number">{{numAddSymbol(item.value)}}</span><span v-if="item.unit == '%'">%</span></div>
<div v-if="item.rate" class="statistics-top-rate">占比<span>{{item.rate}}</span></div> <div v-if="item.rate" class="statistics-top-rate">占比<span>{{item.rate}}%</span></div>
</div> </div>
<div class="statistics-bottom" v-if="item.bottomLabel || item.bottomType"> <div class="statistics-bottom" v-if="item.bottomLabel || item.bottomType">
<template v-if="item.bottomType == 'money'"> <template v-if="item.bottomType == 'money'">
......
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26
* @LastEditors: huyue
* @LastEditTime: 2023-07-18 17:27:55
* @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div>
<div :id="domId" style="width: 100%;" :style="{ height }"></div>
</div>
</template>
<script type="text/ecmascript-6">
import utils from '../../utils/util'
import * as echarts from 'echarts'
import getBarLineOptions from './BarLineOptions'
export default {
name: 'BarLineChart',
props: {
height: {
type: String
},
domId: {
type: String,
default: 'bar-line'
},
dataList: {
type: Array,
default: () => []
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
}
},
data() {
return {
barLineOptions: [],
moveAttr: {
// speed: 900,
seriesIndex: 0,
dataIndex: 0
},
timer: null
}
},
// created() {
// this.barLineOptions = getBarLineOptions({ tooltipFormatter: this.tooltipFormatter })
// },
mounted() {
this.barLineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.barLineDom)
this.chartBindEvent()
},
methods: {
tooltipFormatter(obj) {
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>`
})
_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
},
drawBarLine() {
this.barLineOptions = getBarLineOptions({ tooltipFormatter: this.tooltipFormatter, seriesData: this.dataList })
this.barLineOptions.xAxis.data = this.dataList.map(item => item.month)
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[2].data = this.dataList.map(item => item.data3)
this[this.domId].setOption(this.barLineOptions)
},
chartBindEvent() {
// resize
window.addEventListener('resize', () => {
this[this.domId].resize()
})
}
}
}
</script>
<style scoped lang="scss">
</style>
import * as echarts from 'echarts'
import utils from '../../utils/util'
function getBarLineOptions(obj) {
const { tooltipFormatter, seriesData } = obj
var barLineOption = {
tooltip: {
trigger: 'axis',
borderWidth: 0,
padding: 0,
backgroundColor: '#051526',
formatter: tooltipFormatter || ''
},
xAxis: {
data: []
},
yAxis: [
{
name: '¥',
splitLine: {
show: false
}
},
{
name: '',
type: 'value',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value}%'
},
splitLine: {
lineStyle: {
color: '#1d2a38'
}
}
}
],
grid: {
left: '3%',
right: '2%',
top: '20%',
bottom: '6%',
containLabel: true
},
series: [
{
name: 'bar',
type: 'bar',
data: [],
label: {
show: true,
position: 'top',
color: '#fff',
formatter: (params) => {
return utils.numAddSymbol(params.value)
}
},
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
const colorList = [
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF']
]
var colorItem = []
colorItem = params.dataIndex % 2 === 0 ? colorList[0] : colorList[1]
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: colorItem[0]
}, // 柱图渐变色
{
offset: 1, // 指100%处的颜色
color: colorItem[1]
}]
)
}
}
},
{
name: 'bar2',
type: 'bar',
min: 100,
label: {
show: true,
position: 'top',
color: '#fff',
formatter: (params) => {
return utils.numAddSymbol(params.value)
}
},
data: [],
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
const colorList = [
['#11627A', '#282F7A'],
['#145F4E', '#035972']
]
var colorItem = []
colorItem = params.dataIndex % 2 === 0 ? colorList[0] : colorList[1]
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: colorItem[0]
}, // 柱图渐变色
{
offset: 1, // 指100%处的颜色
color: colorItem[1]
}]
)
}
}
},
{
name: 'Dynamic Line',
type: 'line',
yAxisIndex: 1,
data: []
}
]
}
return barLineOption
}
export default getBarLineOptions
...@@ -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-07-19 17:03:19 * @LastEditTime: 2023-07-19 17:31:22
--> -->
<template> <template>
<div class="left"> <div class="left">
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<StatisticsBox :list="boutiqueList.slice(0,4)"></StatisticsBox> <StatisticsBox :list="boutiqueList.slice(0,4)"></StatisticsBox>
<StatisticsBox class="sencod-box" :list="boutiqueList.slice(4,9)"></StatisticsBox> <StatisticsBox class="sencod-box" :list="boutiqueList.slice(4,9)"></StatisticsBox>
<Tab class="tab-box" :list="tabList" :width="19.17" @changeTab="changeTab"></Tab> <Tab class="tab-box" :list="tabList" :width="19.17" @changeTab="changeTab"></Tab>
<components class="tab-content" :is="tabName"></components>
</div> </div>
</template> </template>
...@@ -21,6 +22,20 @@ export default { ...@@ -21,6 +22,20 @@ export default {
components: { components: {
BoutiqueDate BoutiqueDate
}, },
computed: {
tabName() {
let sname
switch (this.activeName) {
case 0:
sname = 'BusinessTrends'
break
case 1:
sname = 'StoreMap'
break
}
return sname
}
},
data() { data() {
return { return {
defaultYear: '', defaultYear: '',
...@@ -105,7 +120,8 @@ export default { ...@@ -105,7 +120,8 @@ export default {
value: '233' value: '233'
} }
], ],
tabList: ['业务趋势', '区域门店数据'] tabList: ['业务趋势', '区域门店数据'],
activeName: 0
} }
}, },
mounted() { }, mounted() { },
...@@ -131,7 +147,13 @@ export default { ...@@ -131,7 +147,13 @@ export default {
} }
} }
.tab-box { .tab-box {
margin-top: 1.78vh; margin: 1.78vh auto;
}
.tab-content {
width: 64.17vw;
height: 49.73vh;
background: #061422;
box-shadow: inset 0 0 20px 0 #3d57ff69;
} }
</style> </style>
<!--
* @Description:
* @Author: huyue
* @Date: 2023-07-19 17:18:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-19 17:38:57
-->
<template>
<div>
<box-title title="业务趋势"></box-title>
<BarLineChart ref="purchaseRef" height="44.89vh" domId="business" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart>
</div>
</template>
<script>
import BarLineChart from '../BarLineChart.vue'
import { changeMixin } from '@/mixins'
export default {
name: 'BusinessTrends',
components: {
BarLineChart
},
mixins: [changeMixin],
data() {
return {
tooltipFormatterObj: [
{
label: '商城',
attrName: 'data1'
},
{
label: '自采',
attrName: 'data2'
},
{
label: '占比',
attrName: 'data3',
addSymbol: '%'
}
],
dataList: [],
isEmpty: false
}
},
mounted() {
},
methods: {
init() {
this.getDataList()
},
async getDataList() {
this.dataList = []
const _data = await this.api.solar.getAllPurchaseTrend({ year: this.$store.state.app.solarYear })
const _dataList = _data.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statDate,
data1: item.shopamount,
data2: item.selfamount,
data3: item.shopratio
})
})
this.$refs.purchaseRef.drawBarLine()
}
}
}
</script>
<!--
* @Description:
* @Author: huyue
* @Date: 2023-07-19 17:18:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-19 17:33:58
-->
<template>
<div>
<box-title title="区域门店数据"></box-title>
</div>
</template>
<script>
export default {
name: 'StoreMap'
}
</script>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!