提交 74cb7949 authored 作者: haodaking's avatar haodaking

chore: 优化报表分析

上级 920e7405
...@@ -83,12 +83,13 @@ onMounted(fetchAge) ...@@ -83,12 +83,13 @@ onMounted(fetchAge)
const ageOption = computed(() => { const ageOption = computed(() => {
return { return {
tooltip: { tooltip: {
trigger: 'item' trigger: 'item',
formatter: '{b}: {c}<br />{d}%'
}, },
series: [ series: [
{ {
type: 'pie', type: 'pie',
label: { formatter: '{b}\n{c}' }, label: { formatter: '{b}\n{d}%' },
itemStyle: { itemStyle: {
borderRadius: 6 borderRadius: 6
}, },
...@@ -129,6 +130,11 @@ const levelOption = computed(() => { ...@@ -129,6 +130,11 @@ const levelOption = computed(() => {
{ {
name: '数据', name: '数据',
type: 'bar', type: 'bar',
label: {
show: true,
position: 'top'
},
itemStyle: { borderRadius: 2 },
data: cardLevel.value.map(item => item.total) data: cardLevel.value.map(item => item.total)
} }
] ]
...@@ -148,7 +154,8 @@ onMounted(fetchMonthly) ...@@ -148,7 +154,8 @@ onMounted(fetchMonthly)
const monthlyOption = computed(() => { const monthlyOption = computed(() => {
return { return {
tooltip: { tooltip: {
trigger: 'item' trigger: 'item',
formatter: '{b}: {c}<br />{d}%'
}, },
series: [ series: [
{ {
...@@ -158,7 +165,7 @@ const monthlyOption = computed(() => { ...@@ -158,7 +165,7 @@ const monthlyOption = computed(() => {
borderRadius: 6 borderRadius: 6
}, },
label: { label: {
formatter: '{b}\n{c}' formatter: '{b}\n{d}%'
}, },
data: monthly.value data: monthly.value
} }
...@@ -278,7 +285,7 @@ async function fetchCardOpen() { ...@@ -278,7 +285,7 @@ async function fetchCardOpen() {
if (index === 0) { if (index === 0) {
rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2) rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2)
} else { } else {
rate = (((items[index + 1]?.total || 0) / item.total) * 100).toFixed(2) rate = ((item.total / (items[index - 1]?.total || 0)) * 100).toFixed(2)
} }
return { ...item, rate } return { ...item, rate }
}) })
...@@ -295,7 +302,7 @@ async function fetchCardIntegral() { ...@@ -295,7 +302,7 @@ async function fetchCardIntegral() {
if (index === 0) { if (index === 0) {
rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2) rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2)
} else { } else {
rate = (((items[index + 1]?.total || 0) / item.total) * 100).toFixed(2) rate = ((item.total / (items[index - 1]?.total || 0)) * 100).toFixed(2)
} }
return { ...item, rate } return { ...item, rate }
}) })
...@@ -312,7 +319,7 @@ async function fetchCardInstallment() { ...@@ -312,7 +319,7 @@ async function fetchCardInstallment() {
if (index === 0) { if (index === 0) {
rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2) rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2)
} else { } else {
rate = (((items[index + 1]?.total || 0) / item.total) * 100).toFixed(2) rate = ((item.total / (items[index - 1]?.total || 0)) * 100).toFixed(2)
} }
return { ...item, rate } return { ...item, rate }
}) })
...@@ -331,19 +338,27 @@ onMounted(fetchCardInstallment) ...@@ -331,19 +338,27 @@ onMounted(fetchCardInstallment)
<div class="row"> <div class="row">
<div class="box"> <div class="box">
<h3>用户性别分布</h3> <h3>用户性别分布</h3>
<v-chart class="chart" :option="genderOption" ref="chart" style="height: 280px" /> <div class="box-inner">
<v-chart class="chart" :option="genderOption" ref="chart" style="height: 280px" />
</div>
</div> </div>
<div class="box"> <div class="box">
<h3>用户年龄分布</h3> <h3>用户年龄分布</h3>
<v-chart class="chart" :option="ageOption" ref="chart" style="height: 280px" /> <div class="box-inner">
<v-chart class="chart" :option="ageOption" ref="chart" style="height: 280px" />
</div>
</div> </div>
<div class="box"> <div class="box">
<h3>信用卡级别分布</h3> <h3>信用卡级别分布</h3>
<v-chart class="chart" :option="levelOption" ref="chart" style="height: 280px" /> <div class="box-inner">
<v-chart class="chart" :option="levelOption" ref="chart" style="height: 280px" />
</div>
</div> </div>
<div class="box"> <div class="box">
<h3>月收入分布</h3> <h3>月收入分布</h3>
<v-chart class="chart" :option="monthlyOption" ref="chart" style="height: 280px" /> <div class="box-inner">
<v-chart class="chart" :option="monthlyOption" ref="chart" style="height: 280px" />
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -369,7 +384,9 @@ onMounted(fetchCardInstallment) ...@@ -369,7 +384,9 @@ onMounted(fetchCardInstallment)
<div class="row"> <div class="row">
<div class="box"> <div class="box">
<h3>事件分析</h3> <h3>事件分析</h3>
<v-chart class="chart" :option="eventOption" ref="chart" style="height: 380px" /> <div class="box-inner">
<v-chart class="chart" :option="eventOption" ref="chart" style="height: 380px" />
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
...@@ -449,12 +466,18 @@ onMounted(fetchCardInstallment) ...@@ -449,12 +466,18 @@ onMounted(fetchCardInstallment)
border-radius: 6px; border-radius: 6px;
overflow: hidden; overflow: hidden;
} }
.box-inner {
background-color: #fff;
margin: 0 20px 20px;
border-radius: 4px;
}
} }
.card { .card {
margin: 20px; margin: 0 20px 20px;
background-color: #fff; background-color: #fff;
padding: 20px; padding: 20px;
min-height: 410px; min-height: 410px;
border-radius: 4px;
.item { .item {
min-height: 40px; min-height: 40px;
display: flex; display: flex;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论