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
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:
@@ -243,7 +243,7 @@ public class BudgetService(
|
||||
var hasGlobalBudget = relevant.Any(b => b.SelectedCategories == null || b.SelectedCategories.Length == 0);
|
||||
|
||||
var allClassifies = hasGlobalBudget
|
||||
? new List<string>()
|
||||
? []
|
||||
: relevant
|
||||
.SelectMany(b => b.SelectedCategories)
|
||||
.Distinct()
|
||||
@@ -602,6 +602,12 @@ public class BudgetService(
|
||||
return null;
|
||||
}
|
||||
|
||||
allBudgets = allBudgets
|
||||
// 排序顺序 1.硬性预算 2.月度->年度 3.实际金额倒叙
|
||||
.OrderBy(b => b.IsMandatoryExpense)
|
||||
.ThenBy(b => b.Type)
|
||||
.ThenByDescending(b => b.Limit);
|
||||
|
||||
var date = referenceDate ?? DateTime.Now;
|
||||
|
||||
decimal incomeLimitAtPeriod = 0;
|
||||
@@ -724,12 +730,12 @@ public class BudgetService(
|
||||
</thead>
|
||||
<tbody>
|
||||
""");
|
||||
foreach (var item in noLimitIncomeItems)
|
||||
foreach (var (Name, Amount) in noLimitIncomeItems)
|
||||
{
|
||||
description.Append($"""
|
||||
<tr>
|
||||
<td>{item.Name}</td>
|
||||
<td><span class='income-value'>{item.Amount:N0}</span></td>
|
||||
<td>{Name}</td>
|
||||
<td><span class='income-value'>{Amount:N0}</span></td>
|
||||
</tr>
|
||||
""");
|
||||
}
|
||||
@@ -753,14 +759,14 @@ public class BudgetService(
|
||||
</thead>
|
||||
<tbody>
|
||||
""");
|
||||
foreach (var item in expenseItems)
|
||||
foreach (var (Name, Limit, Factor, Total) in expenseItems)
|
||||
{
|
||||
description.Append($"""
|
||||
<tr>
|
||||
<td>{item.Name}</td>
|
||||
<td>{item.Limit:N0}</td>
|
||||
<td>{item.Factor:0.##}</td>
|
||||
<td><span class='expense-value'>{item.Total:N0}</span></td>
|
||||
<td>{Name}</td>
|
||||
<td>{Limit:N0}</td>
|
||||
<td>{Factor:0.##}</td>
|
||||
<td><span class='expense-value'>{Total:N0}</span></td>
|
||||
</tr>
|
||||
""");
|
||||
}
|
||||
@@ -781,12 +787,12 @@ public class BudgetService(
|
||||
</thead>
|
||||
<tbody>
|
||||
""");
|
||||
foreach (var item in noLimitExpenseItems)
|
||||
foreach (var (Name, Amount) in noLimitExpenseItems)
|
||||
{
|
||||
description.Append($"""
|
||||
<tr>
|
||||
<td>{item.Name}</td>
|
||||
<td><span class='expense-value'>{item.Amount:N0}</span></td>
|
||||
<td>{Name}</td>
|
||||
<td><span class='expense-value'>{Amount:N0}</span></td>
|
||||
</tr>
|
||||
""");
|
||||
}
|
||||
|
||||
@@ -331,6 +331,7 @@ const updateVarianceChart = (chart, budgets) => {
|
||||
|
||||
const categories = data.map(item => item.name)
|
||||
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 splitLineColor = getCssVar('--chart-split')
|
||||
@@ -387,11 +388,25 @@ const updateVarianceChart = (chart, budgets) => {
|
||||
stack: 'Total',
|
||||
barWidth: 20, // Fixed bar width
|
||||
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 {
|
||||
value: val,
|
||||
label: {
|
||||
position: val >= 0 ? 'insideLeft' : 'insideRight',
|
||||
color: '#fff'
|
||||
position: position,
|
||||
color: color
|
||||
}
|
||||
}
|
||||
}),
|
||||
@@ -522,8 +537,8 @@ const updateBurndownChart = () => {
|
||||
data: dates,
|
||||
axisLabel: {
|
||||
color: axisLabelColor,
|
||||
interval: Math.ceil(daysInMonth / 8) - 1,
|
||||
rotate: 45
|
||||
interval: 'auto',
|
||||
rotate: 0
|
||||
},
|
||||
splitLine: { show: false },
|
||||
axisLine: {
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
</template>
|
||||
</van-field>
|
||||
<!-- 新增:硬性消费复选框 -->
|
||||
<van-field label="硬性消费">
|
||||
<van-field :label="form.category === BudgetCategory.Expense ? '硬性消费' : '硬性收入'">
|
||||
<template #input>
|
||||
<div class="mandatory-wrapper">
|
||||
<van-checkbox
|
||||
v-model="form.isMandatoryExpense"
|
||||
:disabled="form.noLimit"
|
||||
>
|
||||
硬性消费
|
||||
{{ form.category === BudgetCategory.Expense ? '硬性消费' : '硬性收入' }}
|
||||
<span class="mandatory-tip">
|
||||
当前周期 月/年 按天数自动累加
|
||||
当前周期 月/年 按天数自动累加(无记录时)
|
||||
</span>
|
||||
</van-checkbox>
|
||||
</div>
|
||||
|
||||
@@ -311,6 +311,10 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
:deep(.van-calendar__header-title){
|
||||
display: none;
|
||||
}
|
||||
|
||||
.van-calendar {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user