1
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 26s
Docker Build & Deploy / Deploy to Production (push) Successful in 13s
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 26s
Docker Build & Deploy / Deploy to Production (push) Successful in 13s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -18,8 +18,6 @@ public interface IBudgetService
|
||||
|
||||
Task<string?> GetArchiveSummaryAsync(int year, int month);
|
||||
|
||||
Task UpdateArchiveSummaryAsync(int year, int month, string? summary);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定周期的存款预算信息
|
||||
/// </summary>
|
||||
@@ -153,21 +151,6 @@ public class BudgetService(
|
||||
return archive?.Summary;
|
||||
}
|
||||
|
||||
public async Task UpdateArchiveSummaryAsync(int year, int month, string? summary)
|
||||
{
|
||||
var archive = await budgetArchiveRepository.GetArchiveAsync(year, month);
|
||||
if (archive == null)
|
||||
{
|
||||
await ArchiveBudgetsAsync(year, month);
|
||||
archive = await budgetArchiveRepository.GetArchiveAsync(year, month);
|
||||
}
|
||||
|
||||
if (archive != null)
|
||||
{
|
||||
archive.Summary = summary;
|
||||
await budgetArchiveRepository.UpdateAsync(archive);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<BudgetStatsDto> CalculateCategoryStatsAsync(
|
||||
List<BudgetResult> budgets,
|
||||
@@ -436,6 +419,11 @@ public class BudgetService(
|
||||
content: htmlReport,
|
||||
type: MessageType.Html,
|
||||
url: "/balance?tab=message");
|
||||
|
||||
// 同时保存到归档总结
|
||||
var first = archives.First();
|
||||
first.Summary = htmlReport;
|
||||
await budgetArchiveRepository.UpdateAsync(first);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<template>
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<template>
|
||||
<div class="page-container-flex">
|
||||
<van-nav-bar title="预算管理" placeholder>
|
||||
<template #right>
|
||||
@@ -15,7 +16,7 @@
|
||||
/>
|
||||
<van-icon
|
||||
v-if="isArchive"
|
||||
name="records-o"
|
||||
name="comment-o"
|
||||
size="20"
|
||||
title="已归档月份总结"
|
||||
style="margin-right: 12px"
|
||||
@@ -245,31 +246,14 @@
|
||||
v-model="showSummaryPopup"
|
||||
title="月份归档总结"
|
||||
:subtitle="`${selectedDate.getFullYear()}年${selectedDate.getMonth() + 1}月`"
|
||||
height="50%"
|
||||
height="70%"
|
||||
>
|
||||
<div style="padding: 16px;">
|
||||
<van-field
|
||||
v-model="archiveSummary"
|
||||
rows="6"
|
||||
autosize
|
||||
label="总结语"
|
||||
type="textarea"
|
||||
:placeholder="`请输入${selectedDate.getFullYear()}年${selectedDate.getMonth() + 1}月预算执行的总结或感悟...`"
|
||||
show-word-limit
|
||||
maxlength="500"
|
||||
<div
|
||||
class="rich-html-content"
|
||||
v-html="archiveSummary || '<p style=\'text-align:center;color:var(--van-text-color-3)\'>暂无总结</p>'"
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<van-button
|
||||
block
|
||||
round
|
||||
type="primary"
|
||||
:loading="isSavingSummary"
|
||||
@click="handleSaveSummary"
|
||||
>
|
||||
保存总结
|
||||
</van-button>
|
||||
</template>
|
||||
</PopupContainer>
|
||||
</div>
|
||||
</template>
|
||||
@@ -524,26 +508,6 @@ const showArchiveSummary = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleSaveSummary = async () => {
|
||||
if (isSavingSummary.value) return
|
||||
isSavingSummary.value = true
|
||||
try {
|
||||
const res = await updateArchiveSummary({
|
||||
referenceDate: selectedDate.value.toISOString(),
|
||||
summary: archiveSummary.value
|
||||
})
|
||||
if (res.success) {
|
||||
showToast('已保存')
|
||||
showSummaryPopup.value = false
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('保存总结失败', err)
|
||||
showToast('保存总结失败')
|
||||
} finally {
|
||||
isSavingSummary.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (budget) => {
|
||||
try {
|
||||
await showConfirmDialog({
|
||||
|
||||
@@ -84,24 +84,6 @@ public class BudgetController(
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新归档总结
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse> UpdateArchiveSummaryAsync([FromBody] UpdateArchiveSummaryDto dto)
|
||||
{
|
||||
try
|
||||
{
|
||||
await budgetService.UpdateArchiveSummaryAsync(dto.ReferenceDate.Year, dto.ReferenceDate.Month, dto.Summary);
|
||||
return BaseResponse.Done();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "更新归档总结失败");
|
||||
return $"更新归档总结失败: {ex.Message}".Fail();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定周期的存款预算信息
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user