fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 39s
Docker Build & Deploy / Deploy to Production (push) Successful in 19s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s

This commit is contained in:
SunCheng
2026-01-17 15:03:19 +08:00
parent 2043976998
commit 0ef4b52fcc
4 changed files with 44 additions and 19 deletions

View File

@@ -243,7 +243,7 @@ public class BudgetService(
var hasGlobalBudget = relevant.Any(b => b.SelectedCategories == null || b.SelectedCategories.Length == 0); var hasGlobalBudget = relevant.Any(b => b.SelectedCategories == null || b.SelectedCategories.Length == 0);
var allClassifies = hasGlobalBudget var allClassifies = hasGlobalBudget
? new List<string>() ? []
: relevant : relevant
.SelectMany(b => b.SelectedCategories) .SelectMany(b => b.SelectedCategories)
.Distinct() .Distinct()
@@ -602,6 +602,12 @@ public class BudgetService(
return null; return null;
} }
allBudgets = allBudgets
// 排序顺序 1.硬性预算 2.月度->年度 3.实际金额倒叙
.OrderBy(b => b.IsMandatoryExpense)
.ThenBy(b => b.Type)
.ThenByDescending(b => b.Limit);
var date = referenceDate ?? DateTime.Now; var date = referenceDate ?? DateTime.Now;
decimal incomeLimitAtPeriod = 0; decimal incomeLimitAtPeriod = 0;
@@ -724,12 +730,12 @@ public class BudgetService(
</thead> </thead>
<tbody> <tbody>
"""); """);
foreach (var item in noLimitIncomeItems) foreach (var (Name, Amount) in noLimitIncomeItems)
{ {
description.Append($""" description.Append($"""
<tr> <tr>
<td>{item.Name}</td> <td>{Name}</td>
<td><span class='income-value'>{item.Amount:N0}</span></td> <td><span class='income-value'>{Amount:N0}</span></td>
</tr> </tr>
"""); """);
} }
@@ -753,14 +759,14 @@ public class BudgetService(
</thead> </thead>
<tbody> <tbody>
"""); """);
foreach (var item in expenseItems) foreach (var (Name, Limit, Factor, Total) in expenseItems)
{ {
description.Append($""" description.Append($"""
<tr> <tr>
<td>{item.Name}</td> <td>{Name}</td>
<td>{item.Limit:N0}</td> <td>{Limit:N0}</td>
<td>{item.Factor:0.##}</td> <td>{Factor:0.##}</td>
<td><span class='expense-value'>{item.Total:N0}</span></td> <td><span class='expense-value'>{Total:N0}</span></td>
</tr> </tr>
"""); """);
} }
@@ -781,12 +787,12 @@ public class BudgetService(
</thead> </thead>
<tbody> <tbody>
"""); """);
foreach (var item in noLimitExpenseItems) foreach (var (Name, Amount) in noLimitExpenseItems)
{ {
description.Append($""" description.Append($"""
<tr> <tr>
<td>{item.Name}</td> <td>{Name}</td>
<td><span class='expense-value'>{item.Amount:N0}</span></td> <td><span class='expense-value'>{Amount:N0}</span></td>
</tr> </tr>
"""); """);
} }

View File

@@ -331,6 +331,7 @@ const updateVarianceChart = (chart, budgets) => {
const categories = data.map(item => item.name) const categories = data.map(item => item.name)
const values = data.map(item => item.value) const values = data.map(item => item.value)
const maxVal = Math.max(...values.map(v => Math.abs(v))) || 1
const textColor = getCssVar('--van-text-color') const textColor = getCssVar('--van-text-color')
const splitLineColor = getCssVar('--chart-split') const splitLineColor = getCssVar('--chart-split')
@@ -387,11 +388,25 @@ const updateVarianceChart = (chart, budgets) => {
stack: 'Total', stack: 'Total',
barWidth: 20, // Fixed bar width barWidth: 20, // Fixed bar width
data: values.map((val, index) => { data: values.map((val, index) => {
// 如果柱子太短小于15%),文字显示在外部,否则显示在内部
const ratio = Math.abs(val) / maxVal
const isShort = ratio < 0.15
let position
let color
if (val >= 0) {
position = isShort ? 'right' : 'insideLeft'
} else {
position = isShort ? 'left' : 'insideRight'
}
color = isShort ? textColor : '#fff'
return { return {
value: val, value: val,
label: { label: {
position: val >= 0 ? 'insideLeft' : 'insideRight', position: position,
color: '#fff' color: color
} }
} }
}), }),
@@ -522,8 +537,8 @@ const updateBurndownChart = () => {
data: dates, data: dates,
axisLabel: { axisLabel: {
color: axisLabelColor, color: axisLabelColor,
interval: Math.ceil(daysInMonth / 8) - 1, interval: 'auto',
rotate: 45 rotate: 0
}, },
splitLine: { show: false }, splitLine: { show: false },
axisLine: { axisLine: {

View File

@@ -30,16 +30,16 @@
</template> </template>
</van-field> </van-field>
<!-- 新增硬性消费复选框 --> <!-- 新增硬性消费复选框 -->
<van-field label="硬性消费"> <van-field :label="form.category === BudgetCategory.Expense ? '硬性消费' : '硬性收入'">
<template #input> <template #input>
<div class="mandatory-wrapper"> <div class="mandatory-wrapper">
<van-checkbox <van-checkbox
v-model="form.isMandatoryExpense" v-model="form.isMandatoryExpense"
:disabled="form.noLimit" :disabled="form.noLimit"
> >
硬性消费 {{ form.category === BudgetCategory.Expense ? '硬性消费' : '硬性收入' }}
<span class="mandatory-tip"> <span class="mandatory-tip">
当前周期 / 按天数自动累加 当前周期 / 按天数自动累加(无记录时)
</span> </span>
</van-checkbox> </van-checkbox>
</div> </div>

View File

@@ -311,6 +311,10 @@ onBeforeUnmount(() => {
</script> </script>
<style scoped> <style scoped>
:deep(.van-calendar__header-title){
display: none;
}
.van-calendar { .van-calendar {
background: transparent !important; background: transparent !important;
} }