From b173c8313490f46b64ba4150a90edd2833048339 Mon Sep 17 00:00:00 2001 From: SunCheng Date: Fri, 20 Feb 2026 22:39:29 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E5=89=8D=E7=AB=AF=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 SmartClassifyButton.vue (无引用) - 删除 BudgetSummary.vue (无引用) - 归档变更记录 --- Web/src/components/Budget/BudgetSummary.vue | 309 -------------- Web/src/components/SmartClassifyButton.vue | 399 ------------------ .../.openspec.yaml | 0 .../design.md | 54 +++ .../proposal.md | 28 ++ .../specs/removed-components.md | 13 + .../tasks.md | 9 + .../.openspec.yaml | 2 + .../design.md | 0 .../proposal.md | 0 .../specs/transaction-list-display/spec.md | 0 .../tasks.md | 0 .../specs/transaction-list-display/spec.md | 58 ++- 13 files changed, 163 insertions(+), 709 deletions(-) delete mode 100644 Web/src/components/Budget/BudgetSummary.vue delete mode 100644 Web/src/components/SmartClassifyButton.vue rename openspec/changes/{unify-bill-list-components => archive/2026-02-20-remove-unused-frontend-components}/.openspec.yaml (100%) create mode 100644 openspec/changes/archive/2026-02-20-remove-unused-frontend-components/design.md create mode 100644 openspec/changes/archive/2026-02-20-remove-unused-frontend-components/proposal.md create mode 100644 openspec/changes/archive/2026-02-20-remove-unused-frontend-components/specs/removed-components.md create mode 100644 openspec/changes/archive/2026-02-20-remove-unused-frontend-components/tasks.md create mode 100644 openspec/changes/archive/2026-02-20-unify-bill-list-components/.openspec.yaml rename openspec/changes/{unify-bill-list-components => archive/2026-02-20-unify-bill-list-components}/design.md (100%) rename openspec/changes/{unify-bill-list-components => archive/2026-02-20-unify-bill-list-components}/proposal.md (100%) rename openspec/changes/{unify-bill-list-components => archive/2026-02-20-unify-bill-list-components}/specs/transaction-list-display/spec.md (100%) rename openspec/changes/{unify-bill-list-components => archive/2026-02-20-unify-bill-list-components}/tasks.md (100%) diff --git a/Web/src/components/Budget/BudgetSummary.vue b/Web/src/components/Budget/BudgetSummary.vue deleted file mode 100644 index 390421c..0000000 --- a/Web/src/components/Budget/BudgetSummary.vue +++ /dev/null @@ -1,309 +0,0 @@ - - - - - diff --git a/Web/src/components/SmartClassifyButton.vue b/Web/src/components/SmartClassifyButton.vue deleted file mode 100644 index fe2bf26..0000000 --- a/Web/src/components/SmartClassifyButton.vue +++ /dev/null @@ -1,399 +0,0 @@ - - - - - diff --git a/openspec/changes/unify-bill-list-components/.openspec.yaml b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/.openspec.yaml similarity index 100% rename from openspec/changes/unify-bill-list-components/.openspec.yaml rename to openspec/changes/archive/2026-02-20-remove-unused-frontend-components/.openspec.yaml diff --git a/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/design.md b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/design.md new file mode 100644 index 0000000..db6e349 --- /dev/null +++ b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/design.md @@ -0,0 +1,54 @@ +## Context + +前端组件库存在两个未被引用的组件: +- `SmartClassifyButton.vue` - 智能分类按钮,历史上可能用于快速分类功能,现已无引用 +- `BudgetSummary.vue` - 预算汇总卡片,功能已被 budgetV2 模块的子组件替代 + +当前打包工具(Vite)的 tree-shaking 会移除未引用代码,但保留源文件会增加维护困惑和代码审查负担。 + +## Goals / Non-Goals + +**Goals:** +- 移除确认无引用的组件文件 +- 保持代码库整洁,降低维护成本 + +**Non-Goals:** +- 不涉及 `TransactionDetail.vue` vs `TransactionDetailSheet.vue` 的重构(两者虽然功能相似,但均有活跃引用) +- 不涉及其他代码清理(如未使用的 composables、utils) + +## Decisions + +### 1. 删除策略:直接删除 vs 废弃标记 + +**决策**: 直接删除 + +**理由**: +- 两个组件均无任何 import 引用,删除零风险 +- 无需废弃过渡期,因为没有使用方需要迁移 +- 简化变更流程,避免留下无效的废弃代码 + +**备选方案**: 添加 `@deprecated` 注释并在下个版本删除 - 过度工程化,不必要 + +### 2. 回归验证范围 + +**决策**: 仅验证打包成功和页面正常渲染 + +**理由**: +- 删除的是零引用组件,理论上不会有任何运行时影响 +- 全量 E2E 测试成本过高,性价比低 + +## Risks / Trade-offs + +| 风险 | 影响 | 缓解措施 | +|------|------|----------| +| 误删有引用的组件 | 页面报错 | 已通过 grep 全量搜索确认无引用 | +| 动态引用未被发现 | 运行时报错 | 检查了 `:is` 动态组件和字符串引用模式 | + +## Migration Plan + +1. 删除 `SmartClassifyButton.vue` +2. 删除 `BudgetSummary.vue` +3. 运行 `pnpm build` 验证打包成功 +4. 运行 `pnpm dev` 启动开发服务器,访问主要页面验证无报错 + +**回滚策略**: Git revert 即可恢复 diff --git a/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/proposal.md b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/proposal.md new file mode 100644 index 0000000..020fc11 --- /dev/null +++ b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/proposal.md @@ -0,0 +1,28 @@ +## Why + +前端代码库中存在未使用的组件,增加了维护成本和打包体积。作为大版本迭代的清理工作,需要识别并移除这些无效代码,保持代码库整洁。 + +## What Changes + +- 删除 `SmartClassifyButton.vue` - 无任何引用 +- 删除 `BudgetSummary.vue` - 无任何引用 +- 评估 `TransactionDetail.vue` 与 `TransactionDetailSheet.vue` 的重复问题(两者功能相似,需确认是否可合并) + +## Capabilities + +### New Capabilities + +无新增能力。 + +### Modified Capabilities + +无需求变更。此变更为代码清理,不影响业务功能。 + +## Impact + +- **删除文件**: + - `Web/src/components/SmartClassifyButton.vue` + - `Web/src/components/Budget/BudgetSummary.vue` +- **风险评估**: 低风险。两个组件均无任何导入引用 +- **打包体积**: 减少无效代码约 ~5KB (gzip) +- **测试影响**: 无需新增测试,仅需回归验证 diff --git a/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/specs/removed-components.md b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/specs/removed-components.md new file mode 100644 index 0000000..9caaa1c --- /dev/null +++ b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/specs/removed-components.md @@ -0,0 +1,13 @@ +## Overview + +此变更为代码清理,不涉及业务需求变更。 + +## REMOVED Components + +### Requirement: SmartClassifyButton component +**Reason**: 组件无任何引用,已被废弃 +**Migration**: 无需迁移,该组件从未被使用 + +### Requirement: BudgetSummary component +**Reason**: 功能已被 budgetV2 模块的子组件替代 +**Migration**: 使用 `BudgetCard.vue` 和 `BudgetChartAnalysis.vue` 替代 diff --git a/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/tasks.md b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/tasks.md new file mode 100644 index 0000000..2dea33b --- /dev/null +++ b/openspec/changes/archive/2026-02-20-remove-unused-frontend-components/tasks.md @@ -0,0 +1,9 @@ +## 1. 移除未使用组件 + +- [x] 1.1 删除 `Web/src/components/SmartClassifyButton.vue` +- [x] 1.2 删除 `Web/src/components/Budget/BudgetSummary.vue` + +## 2. 验证 + +- [x] 2.1 运行 `pnpm build` 验证打包成功 +- [x] 2.2 运行 `pnpm dev` 启动开发服务器,访问主要页面验证无报错 diff --git a/openspec/changes/archive/2026-02-20-unify-bill-list-components/.openspec.yaml b/openspec/changes/archive/2026-02-20-unify-bill-list-components/.openspec.yaml new file mode 100644 index 0000000..d0ec88b --- /dev/null +++ b/openspec/changes/archive/2026-02-20-unify-bill-list-components/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-02-20 diff --git a/openspec/changes/unify-bill-list-components/design.md b/openspec/changes/archive/2026-02-20-unify-bill-list-components/design.md similarity index 100% rename from openspec/changes/unify-bill-list-components/design.md rename to openspec/changes/archive/2026-02-20-unify-bill-list-components/design.md diff --git a/openspec/changes/unify-bill-list-components/proposal.md b/openspec/changes/archive/2026-02-20-unify-bill-list-components/proposal.md similarity index 100% rename from openspec/changes/unify-bill-list-components/proposal.md rename to openspec/changes/archive/2026-02-20-unify-bill-list-components/proposal.md diff --git a/openspec/changes/unify-bill-list-components/specs/transaction-list-display/spec.md b/openspec/changes/archive/2026-02-20-unify-bill-list-components/specs/transaction-list-display/spec.md similarity index 100% rename from openspec/changes/unify-bill-list-components/specs/transaction-list-display/spec.md rename to openspec/changes/archive/2026-02-20-unify-bill-list-components/specs/transaction-list-display/spec.md diff --git a/openspec/changes/unify-bill-list-components/tasks.md b/openspec/changes/archive/2026-02-20-unify-bill-list-components/tasks.md similarity index 100% rename from openspec/changes/unify-bill-list-components/tasks.md rename to openspec/changes/archive/2026-02-20-unify-bill-list-components/tasks.md diff --git a/openspec/specs/transaction-list-display/spec.md b/openspec/specs/transaction-list-display/spec.md index 18c8e56..867173b 100644 --- a/openspec/specs/transaction-list-display/spec.md +++ b/openspec/specs/transaction-list-display/spec.md @@ -11,6 +11,54 @@ - **WHEN** CalendarV2 需要展示交易列表 - **THEN** 使用 `BillListComponent.vue` 或保留其特有实现(如有特殊需求) +### Requirement: CategoryBillPopup 统一样式 +统计页面分类账单弹窗必须使用 BillListComponent,样式与 Balance 页面一致。 + +#### Scenario: 使用 BillListComponent +- **WHEN** 用户在统计页面点击分类卡片 +- **THEN** 弹窗使用 `BillListComponent` 展示账单列表,配置为 `dataSource="api"` 模式 + +#### Scenario: 列表项样式对齐 +- **WHEN** 账单列表渲染 +- **THEN** 使用与 `TransactionsRecord.vue` 相同的卡片样式(图标、金额、标签布局) + +#### Scenario: 左滑删除 +- **WHEN** 用户在账单项上左滑 +- **THEN** 显示红色删除按钮,点击后确认删除 + +#### Scenario: 点击查看详情 +- **WHEN** 用户点击账单项 +- **THEN** 打开 `TransactionDetailSheet` 查看详情 + +### Requirement: CalendarV2 TransactionList 对齐 +日历页面的交易列表样式必须与 Balance 页面一致。 + +#### Scenario: 紧凑布局 +- **WHEN** 日历页面展示当天账单列表 +- **THEN** 使用 `compact={true}` 紧凑布局 + +#### Scenario: 删除交互 +- **WHEN** 用户左滑删除账单 +- **THEN** 与 Balance 页面删除交互一致 + +### Requirement: BudgetCard 关联账单对齐 +预算页面的关联账单弹窗样式必须与 Balance 页面一致。 + +#### Scenario: 统一卡片样式 +- **WHEN** 预算卡片展示关联账单 +- **THEN** 账单项样式与 Balance 页面一致 + +### Requirement: EmailRecord 关联账单对齐 +邮件记录页面的关联账单弹窗样式必须与 Balance 页面一致。 + +#### Scenario: 统一卡片样式 +- **WHEN** 邮件记录展示关联账单 +- **THEN** 账单项样式与 Balance 页面一致 + +#### Scenario: 删除功能 +- **WHEN** 用户删除账单 +- **THEN** 删除交互与 Balance 页面一致 + ### Requirement: 功能对等性 新组件必须保持旧版所有功能,确保迁移不丢失特性。 @@ -26,12 +74,16 @@ - **WHEN** 页面需要展示离线或缓存数据 - **THEN** 新组件通过 `dataSource="custom"` 和 `transactions` prop 支持自定义数据 +#### Scenario: 弹窗场景数据源 +- **WHEN** 弹窗组件(CategoryBillPopup、BudgetCard、EmailRecord)展示账单 +- **THEN** 使用 `dataSource="api"` 或 `dataSource="custom"`,并配置 `enableFilter={false}` 禁用筛选 + ### Requirement: 视觉升级 新组件必须基于 v2 的现代化设计,提供更好的视觉体验。 #### Scenario: 卡片样式 - **WHEN** 展示账单列表 -- **THEN** 使用 v2 的卡片样式(圆角、阴影、图标),但调整为紧凑间距 +- **THEN** 使用 v2 的卡片样式(圆角、阴影、图标),调整为紧凑间距 #### Scenario: 图标展示 - **WHEN** 账单有分类信息 @@ -41,6 +93,10 @@ - **WHEN** 显示账单类型 - **THEN** 使用彩色标签(支出红色、收入绿色),位于卡片右上角 +#### Scenario: 空状态展示 +- **WHEN** 账单列表为空 +- **THEN** 显示统一的空状态图标和提示文案 + ### Requirement: 迁移计划 系统必须按阶段迁移,确保平滑过渡。