This commit is contained in:
yanran200730
2022-01-05 18:09:26 +08:00
parent 75b7d3d79a
commit 8a28963138

View File

@@ -47,6 +47,10 @@
</ai-card> </ai-card>
<ai-card title="投票统计" v-show="currIndex === 1 && info.type === '1'"> <ai-card title="投票统计" v-show="currIndex === 1 && info.type === '1'">
<template #content> <template #content>
<h2 class="detail-title">选项</h2>
<ai-wrapper>
<ai-info-item :label="item.item + ''" :value="item.content" isLine v-for="(item, index) in info.voteItems" :key="index"></ai-info-item>
</ai-wrapper>
<div class="chart" style="width: 800px; height: 240px; margin: 0 auto;"></div> <div class="chart" style="width: 800px; height: 240px; margin: 0 auto;"></div>
<ai-table <ai-table
class="detail-table__table" class="detail-table__table"
@@ -179,7 +183,20 @@
legend: { legend: {
right: '5%', right: '5%',
top: 'center', top: 'center',
orient: 'vertical' orient: 'vertical',
formatter: function(name) {
let data = option.series[0].data
let total = 0
let tarValue = 0
for (let i = 0, l = data.length; i < l; i++) {
total += data[i].value
if (data[i].name == name) {
tarValue = data[i].value
}
}
let p = total === 0 ? 0 : (tarValue / total * 100).toFixed(0)
return name + '' + tarValue + '票' + ' ' + p + '%'
}
}, },
series: [ series: [
{ {
@@ -191,11 +208,13 @@
name: v name: v
} }
}), }),
emphasis: { label : {
itemStyle: { normal : {
shadowBlur: 10, formatter: '{b}({d}%)',
shadowOffsetX: 0, textStyle : {
shadowColor: 'rgba(0, 0, 0, 0.5)' fontWeight : 'normal',
fontSize : 15
}
} }
} }
} }
@@ -242,4 +261,9 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.detail-title {
font-weight: normal;
font-size: 16px;
font-weight: 600;
}
</style> </style>