Commit 396b4d90 by 匡雅琴

数据总览模块开发

1 parent 2e753451
......@@ -30,27 +30,27 @@ export default {
type: Array,
default: () => []
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
}
// tooltipFormatterObj: {
// type: Array,
// default: () => {
// return [
// {
// label: '数量',
// attrName: 'num'
// },
// {
// label: '环比',
// attrName: 'hrate',
// addSymbol: '%'
// },
// {
// label: '同比',
// attrName: 'trate',
// addSymbol: '%'
// }
// ]
// }
// }
},
data() {
return {
......
......@@ -2,13 +2,22 @@
<div class="overview-box">
<box-title title="数据总览"></box-title>
<Tab class="tab-box" :list="tabList" :width="19.17" :itemWidth="10" @changeTab="changeTab"></Tab>
<div class="overview-bottom-box">
<SelectModel></SelectModel>
<TrendDetail></TrendDetail>
</div>
</div>
</template>
<script>
import SelectModel from './components/SelectModel.vue'
import TrendDetail from './components/TrendDetail.vue'
export default {
name: 'EquityBottom',
components: {
SelectModel,
TrendDetail
},
data() {
return {
tabList: ['广汇数据总览', '非广汇数据总览']
......@@ -17,17 +26,24 @@ export default {
mounted() {},
methods: {}
methods: {
changeTab(val) {
}
}
}
</script>
<style lang="scss" scoped>
.overview-box {
// width: 100%;
height: 57.78vh;
// width: 100%;
height: 59.78vh;
box-shadow: inset 0 0 20px 0 #3d57ff69;
.tab-box {
margin: 1.78vh auto;
margin-top: 1.78vh;
}
.overview-bottom-box {
padding: 1.11vw;
}
}
</style>
<template>
<div :id="domId" style="width: 100%" :style="{ height }"></div>
</template>
<script type="text/ecmascript-6">
import utils from '../../../utils/util'
import * as echarts from 'echarts'
import getBarLineOptions from './BarLineOptions'
export default {
name: 'BarLineCharts',
props: {
height: {
type: String
},
dataList: {
type: Array,
default: () => []
},
domId: {
type: String,
default: 'bar-line'
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
}
},
data() {
return {}
},
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 = `<div><div style="color: #FFFFFF">${_currentItem.date}</div><div style="display:flex;align-items:center"><div style="width: 4px;height: 4px;background: #FFC200;border-radius: 4px;margin-right: 4px;"></div><div style="color: #fff;">${utils.numAddSymbol(_currentItem.val)}</div></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.date)
this.barLineOptions.series[0].data = this.dataList.map(item => item.val)
this[this.domId].setOption(this.barLineOptions)
},
chartBindEvent() {
// resize
window.addEventListener('resize', () => {
this[this.domId].resize()
})
}
}
}
</script>
<style lang="scss" scoped></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: [
{
// 纵轴标尺固定
type: 'value',
scale: true,
// max: 200,
min: 0,
splitNumber: 4,
boundaryGap: [0.1, 0.1],
splitLine: {
lineStyle: {
color: '#ffffff1a'
}
}
}
],
grid: {
left: '3%',
right: '2%',
top: '25%',
bottom: '6%',
containLabel: true
},
series: [
{
name: 'line',
type: 'line',
data: [],
showSymbol: true, // 是否默认展示圆点
symbol: 'circle', // 设定为实心点
symbolSize: 6, // 设定实心点的大小
itemStyle: {
normal: {
color: '#FFC200', // 改变折线点的颜色
lineStyle: {
color: '#FFC200' // 改变折线颜色
}
}
}
}
]
}
return barLineOption
}
export default getBarLineOptions
<template>
<div class="trend-box">
<box-title title="订单趋势"></box-title>
<BarLineCharts ref="orderTrendsRef" height="29vh" domId="orderTrends" :dataList.sync="dataList"></BarLineCharts>
</div>
</template>
<script>
import BarLineCharts from './BarLineCharts.vue'
export default {
name: 'OrderTrends',
components: {
BarLineCharts
},
data() {
return {}
return {
dataList: [
{
date: '10-23',
val: 4857
},
{
date: '10-24',
val: 9854
},
{
date: '10-25',
val: 8857
},
{
date: '10-26',
val: 1857
},
{
date: '10-27',
val: 1058
},
{
date: '10-28',
val: 4857
},
{
date: '10-29',
val: 9857
}
],
}
},
mounted() {},
mounted() {
this.$refs.orderTrendsRef.drawBarLine()
},
methods: {}
}
......
<template>
<div class="trend-box">
<box-title title="产值趋势"></box-title>
<BarLineCharts ref="productionTrendsRef" height="29vh" domId="productionTrend" :dataList.sync="dataList"></BarLineCharts>
</div>
</template>
<script>
import BarLineCharts from './BarLineCharts.vue'
export default {
name: 'ProductionTrend',
components: {
BarLineCharts
},
data() {
return {}
return {
dataList: [
{
date: '10-23',
val: 4857
},
{
date: '10-24',
val: 9854
},
{
date: '10-25',
val: 8857
},
{
date: '10-26',
val: 1857
},
{
date: '10-27',
val: 1058
},
{
date: '10-28',
val: 4857
},
{
date: '10-29',
val: 9857
}
]
}
},
mounted() {},
mounted() {
this.$refs.productionTrendsRef.drawBarLine()
},
methods: {}
}
......
<template>
<div class="select-model-box">
<div class="type-plugin">
<div class="trend-type-box" @click.stop="switchType">
<div class="text">{{ selectType || selectList[0].name }}</div>
<div class="trangle-icon"></div>
</div>
<SelectBox
:isShow="isShow"
isObject
:defaultValue.sync="selectList[0]"
@clickOutside="clickOutside"
:dataList.sync="selectList"
:boxWidth="'9.1vw'"
@selectVal="selectVal"
:labelName="'name'"
:valueName="'name'"
></SelectBox>
</div>
<DateTab :dateList="dateList" @changeDate="changeDate"></DateTab>
<Calendar v-show="showCalendar" @customerSelect="customerSelect"></Calendar>
</div>
</template>
<script>
export default {
name: 'SelectModel',
data() {
return {
dateList: ['本月', '全年', '自定义'],
showCalendar: false,
isShow: false,
selectList: [
{
name: '提单量趋势',
val: 0
},
{
name: '提单门店量趋势',
val: 1
}
],
selectType: ''
}
},
mounted() {},
methods: {
changeDate(val) {
if (val === 2) {
this.showCalendar = true
return
} else {
this.showCalendar = false
}
},
switchType() {
console.log(2222)
this.isShow = !this.isShow
},
clickOutside() {
this.isShow = false
},
selectVal(val) {
console.log(val);
this.selectType = val.name
this.switchType()
},
// 自定义日期选择
customerSelect(val) {
this.start = val[0]
this.end = val[1]
}
}
}
</script>
<style lang="scss" scoped>
.select-model-box {
display: flex;
.type-plugin {
position: relative;
}
.trend-type-box {
display: flex;
justify-content: space-between;
width: 9.1vw;
height: 3.56vh;
line-height: 3.56vh;
padding: 0 0.83vw;
box-sizing: border-box;
margin-right: 2.08vw;
background-image: linear-gradient(269deg, #5663ff00 10%, #6578ffd4 49%, #079ff1 100%);
.text {
font-weight: 500;
font-size: 14px;
color: #ffffff;
}
.trangle-icon {
width: 0px;
height: 0px;
border: 4px solid transparent;
border-top: 4px solid #fff;
margin-top: 10%;
}
}
}
</style>
<template>
<div class="detail-box">
<TrendLeft></TrendLeft>
<TrendRight></TrendRight>
</div>
</template>
<script>
import TrendLeft from './TrendLeft'
import TrendRight from './TrendRight'
export default {
name: 'TrendDetail',
components: {
TrendLeft,
TrendRight
},
data() {
return {}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.detail-box {
display: flex;
height: 41vh;
}
</style>
<template>
<div class="trend-left">
<BarChart
v-if="!isEmpty"
ref="orderTrendChartRef"
class="bar-chart"
isMultiple
:barWidth="'24'"
domId="orderTrendChart"
height="37.22vh"
:dataList.sync="dataList"
:colorList="colorList"
:tooltipFormatterObj="tooltips.amountTooltip"
></BarChart>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template>
<script>
import BarChart from '../../crowdfunding/components/BarChart.vue'
export default {
name: 'TrendLeft',
components: {
BarChart
},
data() {
return {
isEmpty: false,
dataList: [
{
statMonth: '10月',
num: 240
},
{
statMonth: '11月',
num: 758
},
{
statMonth: '12月',
num: 718
},
{
statMonth: '1月',
num: 185
},
{
statMonth: '2月',
num: 240
},
{
statMonth: '3月',
num: 260
},
{
statMonth: '4月',
num: 56
},
{
statMonth: '5月',
num: 458
},
{
statMonth: '6月',
num: 850
},
{
statMonth: '7月',
num: 755
},
{
statMonth: '8月',
num: 582
},
{
statMonth: '9月',
num: 161
}
],
tooltips: {
amountTooltip: {
label: '单量',
attrName: 'num'
}
},
colorList: [
['#2AD191', '#00A89E', '#061422'],
['#22D8FF', '#223FA9', '#061422']
]
}
},
mounted() {
this.$refs.orderTrendChartRef.drawBar()
},
methods: {}
}
</script>
<style lang="scss" scoped>
.trend-left {
width: 60.84vw;
padding-right: 5.9vw;
border-right: 1px solid #1E3372;
}
</style>
<template>
<div class="trend-right">
<div class="title">广汇门店提单量排名</div>
<div class="rank-content" v-if="merchantRankList.length">
<Ranking class="rank-box" :rankingsList="merchantRankList" :rankingDataObj="rankingDataObj"></Ranking>
</div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template>
<script>
export default {
name: 'TrendRight',
data() {
return {
merchantRankList: [
{
merchantName: 'xxxxxxxxxx门店',
num: 345485
},
{
merchantName: 'xxxxxxxxxx门店',
num: 345485
},
{
merchantName: 'xxxxxxxxxx门店',
num: 345485
},
{
merchantName: '奥迪',
num: 345485
},
{
merchantName: '奥迪',
num: 345485
},
{
merchantName: '奥迪',
num: 345485
},
{
merchantName: 'xxxxxxxxxx门店',
num: 345485
},
{
merchantName: 'xxxxxxxxxx门店',
num: 345485
},
{
merchantName: 'xxxxxxxxxx门店',
num: 345485
},
{
merchantName: 'xxxxxxxxxx门店',
num: 345485
}
],
rankingDataObj: [
{
name: 'merchantName',
width: '10vw'
},
{
name: 'num',
width: '8vw',
type: 'number'
}
]
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.trend-right {
margin-left: 4.1vw;
.title {
width: 7.5vw;
height: 2.22vh;
font-weight: 500;
font-size: 14px;
color: #ffffff;
line-height: 2.22vh;
overflow: visible;
white-space: nowrap;
margin-top: 0;
margin-bottom: 2.67vh;
background-image: linear-gradient(269deg, #5663ff00 10%, #6578ffd4 49%, #079ff1 100%);
}
}
</style>
......@@ -61,7 +61,7 @@ export default {
},
data() {
return {
activeName: '4'
activeName: 'm_2.1'
}
},
created() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!