feat: 新增隐藏备注记录显示开关并简化设置与日志菜单文案

- 设置页「外观设置」新增「显示已隐藏备注的记录」开关,默认关闭,切换即时保存
- 新增 GET/PUT /api/setting/show-hidden-data 接口,用户级偏好持久化于 t_user_preference
- 收支记录列表与 Excel 导出按该偏好过滤,关闭时排除已隐藏备注的记录
- 移除「备注关键字搜索时总是跳过隐藏记录」逻辑,改由该偏好统一控制,统计备注搜索同步放开
- 列表内隐藏备注后,偏好关闭时该行即时移除,当前页清空自动回退上一页
- 外观设置面板拆分为两个浅灰底分组,两个配置项区分更清晰
- 顶部用户菜单与设置/日志页标题由「系统设置/系统日志」简化为「设置/日志」,同步中英日三语
This commit is contained in:
2026-09-23 09:28:42 +08:00
parent 66088e8c7e
commit 66d6ab86b5
10 changed files with 220 additions and 25 deletions
+26 -1
View File
@@ -10,7 +10,7 @@ import { getTransactionPage, createTransaction, updateTransaction, deleteTransac
import { getAiConfig, suggestByAi, suggestOneByAi, applyAiSuggestions, queryByAi, parseRecordByAi, parseCategoryByAi, parseTagByAi, parseChannelByAi } from '../api/ai'
import { createChannel } from '../api/channel'
import type { AiSuggestion, AiQueryResult, AiRecordResult, AiRecordImageResult } from '../api/ai'
import { getExcludedDisplayStyle } from '../api/setting'
import { getExcludedDisplayStyle, getShowHiddenData } from '../api/setting'
import { getCategoryList, createCategory } from '../api/category'
import { getTagList, createTag } from '../api/tag'
import { getChannelLabel } from '../utils/channel'
@@ -129,6 +129,8 @@ const pageExcludedSummary = computed(() => {
const loading = ref(false) // 列表加载状态
// 「不计入统计」记录的展示样式:strikethrough-整行删除线(默认)、muted-灰色标签
const excludedDisplayStyle = ref<'strikethrough' | 'muted'>('strikethrough')
// 是否显示已隐藏备注的记录:默认不显示,隐藏后从当前列表移除
const showHiddenData = ref(false)
const submitting = ref(false) // 表单提交状态
const showModal = ref(false) // 新增/编辑弹窗显示状态
const showImportModal = ref(false) // 账单导入弹窗显示状态
@@ -492,6 +494,18 @@ async function setRemarkHidden(row: TransactionItem, hidden: boolean) {
row.remarkHidden = hidden
concealRemark(row.id)
message.success(hidden ? t('transaction.remarkHiddenSuccess') : t('transaction.remarkShownSuccess'))
// 偏好为不显示时,隐藏后将该行从列表移除;当前页清空则回退一页
if (hidden && !showHiddenData.value) {
const index = transactions.value.findIndex((item) => item.id === row.id)
if (index >= 0) {
transactions.value.splice(index, 1)
total.value = Math.max(0, total.value - 1)
}
if (transactions.value.length === 0 && page.value > 1) {
page.value -= 1
fetchData()
}
}
} catch (e: any) {
message.error(e.message || t('common.operationFailed'))
}
@@ -647,6 +661,16 @@ async function loadExcludedDisplayStyle() {
}
}
/** 加载「显示已隐藏备注记录」偏好,失败时保持默认不显示 */
async function loadShowHiddenData() {
try {
const res: any = await getShowHiddenData()
showHiddenData.value = !!res.data
} catch (e) {
// 静默处理,保持默认不显示
}
}
/** 加载分类列表 */
async function fetchCategories() {
try {
@@ -1999,6 +2023,7 @@ onMounted(() => {
remarkHistory.load()
loadAiConfig()
loadExcludedDisplayStyle()
loadShowHiddenData()
fetchCategories()
fetchTags()
loadChannels()