feat: 添加分类统计功能,支持获取月度和年度预算统计信息
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 22s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
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 22s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
<template>
|
||||
<div class="summary-card common-card">
|
||||
<div v-if="stats && (stats.month || stats.year)" class="summary-card common-card">
|
||||
<template v-for="(config, key) in periodConfigs" :key="key">
|
||||
<div class="summary-item">
|
||||
<div class="label">{{ config.label }}{{ title }}率</div>
|
||||
<div class="value" :class="getValueClass(stats[key].rate)">
|
||||
{{ stats[key].rate }}<span class="unit">%</span>
|
||||
<div class="value" :class="getValueClass(stats[key]?.rate || '0.0')">
|
||||
{{ stats[key]?.rate || '0.0' }}<span class="unit">%</span>
|
||||
</div>
|
||||
<div class="sub-info">
|
||||
<span class="amount">¥{{ formatMoney(stats[key]?.current || 0) }}</span>
|
||||
<span class="separator">/</span>
|
||||
<span class="amount">¥{{ formatMoney(stats[key]?.limit || 0) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="config.showDivider" class="divider"></div>
|
||||
@@ -32,6 +37,10 @@ const periodConfigs = {
|
||||
month: { label: '本月', showDivider: true },
|
||||
year: { label: '年度', showDivider: false }
|
||||
}
|
||||
|
||||
const formatMoney = (val) => {
|
||||
return parseFloat(val || 0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -58,7 +67,6 @@ const periodConfigs = {
|
||||
.summary-item .value {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 2px;
|
||||
color: #323233;
|
||||
}
|
||||
|
||||
@@ -80,8 +88,20 @@ const periodConfigs = {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.summary-item .sub-label {
|
||||
font-size: 11px;
|
||||
.summary-item .sub-info {
|
||||
font-size: 12px;
|
||||
color: #c8c9cc;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.summary-item .amount {
|
||||
color: #646566;
|
||||
}
|
||||
|
||||
.summary-item .separator {
|
||||
color: #c8c9cc;
|
||||
}
|
||||
|
||||
@@ -96,6 +116,9 @@ const periodConfigs = {
|
||||
.summary-item .value {
|
||||
color: #f5f5f5;
|
||||
}
|
||||
.summary-item .amount {
|
||||
color: #c8c9cc;
|
||||
}
|
||||
.divider {
|
||||
background-color: #2c2c2c;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user