fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 3m13s
Docker Build & Deploy / Deploy to Production (push) Successful in 8s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 3m13s
Docker Build & Deploy / Deploy to Production (push) Successful in 8s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -210,13 +210,14 @@ const pieLabelLinePlugin = {
|
||||
}
|
||||
|
||||
// 格式化金额
|
||||
const formatMoney = (value) => {
|
||||
const formatMoney = (value, decimals = 1) => {
|
||||
if (!value && value !== 0) {
|
||||
return '0'
|
||||
return Number(0).toFixed(decimals)
|
||||
}
|
||||
return Number(value)
|
||||
.toFixed(0)
|
||||
.toFixed(decimals)
|
||||
.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||
.replace(/\.0$/, '')
|
||||
}
|
||||
|
||||
// 计算属性
|
||||
@@ -317,6 +318,11 @@ const chartOptions = computed(() => {
|
||||
right: 2
|
||||
}
|
||||
},
|
||||
// 显式禁用笛卡尔坐标系(Doughnut 图表不需要)
|
||||
scales: {
|
||||
x: { display: false },
|
||||
y: { display: false }
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false
|
||||
@@ -335,12 +341,12 @@ const chartOptions = computed(() => {
|
||||
const value = context.parsed || 0
|
||||
const total = context.dataset.data.reduce((a, b) => a + b, 0)
|
||||
const percentage = total > 0 ? ((value / total) * 100).toFixed(1) : 0
|
||||
return `${label}: ¥${formatMoney(value)} (${percentage}%)`
|
||||
return `${label}: ¥${formatMoney(value, 0)} (${percentage}%)`
|
||||
}
|
||||
}
|
||||
},
|
||||
pieCenterText: {
|
||||
text: `¥${formatMoney(totalAmount.value)}`,
|
||||
text: `¥${formatMoney(totalAmount.value, 0)}`,
|
||||
subtext: '总支出',
|
||||
textColor: isDarkMode ? '#ffffff' : '#323233',
|
||||
subtextColor: isDarkMode ? '#969799' : '#969799',
|
||||
@@ -403,7 +409,7 @@ const onChartRender = (chart) => {
|
||||
.ring-chart {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 170px;
|
||||
height: 190px;
|
||||
margin: 0px auto 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user