Refactor recurring investment preview and API response handling:

- Remove `executionDateTime` from the preview modal and update the display to show `nextExecutionDate` and `nextExecutionTime`.
- Adjust the API response structure for `next-execution` to align with the new fields.
- Implement loading indicators for the preview button and modal during data fetching.
- Update related documentation in `IMPACT_ANALYSIS.md` and `TASK_SUMMARY.md` for clarity on changes.
This commit is contained in:
justin
2026-10-12 09:22:00 +08:00
parent 57b026d7d0
commit cc90cc69e2
5 changed files with 80 additions and 23 deletions
+59
View File
@@ -837,3 +837,62 @@
### 5. 验证与测试
- `npm run build`;交易所切换、搜索、下拉滚动加载更多。
---
## 补充:下次执行预览移除执行时间行(2026-10-10)
### 1. 改动概览
- **背景与目标**:预览弹窗不再展示 `executionDateTime`(`recurring.previewExecutionDateTime`)。
- **涉及模块**:`RecurringInvestmentView.vue`。
- **改动类型**:界面调整。
### 2. 方法级改动分析
| 位置 | 差异 |
|------|------|
| 下次执行预览 `<dl>` | 删除 `executionDateTime` 的 `<dt>`/`<dd>`;接口数据仍可能返回该字段,仅不展示。 |
### 3. 调用方与影响范围
- 仅预览弹窗展示;**破坏性变更**:否。
### 4. 风险与回滚
- **风险级别**:低;**回滚方式是否简单**:是(恢复两行模板)。
### 5. 验证与测试
- 打开「下次执行」预览,确认无「执行时间」行,其余字段正常。
---
## 补充:下次执行预览接口字段与加载态(2026-10-12)
### 1. 改动概览
- **背景与目标**:`POST /trade/schedule-investment/plan/next-execution` 响应 `data` 调整为 `nextExecutionDate`、`nextExecutionTime`;预览弹窗同步展示;请求较慢时按钮与弹窗内展示 loading。
- **涉及模块**:`src/types/scheduleInvestment.ts`、`RecurringInvestmentView.vue`。
- **改动类型**:缺陷修复 / 界面调整。
### 2. 方法级改动分析
| 位置 | 差异 |
|------|------|
| `ScheduleInvestmentNextExecutionData` | 移除 `scheduledDate`、`executionDate`、`executionDateTime`、`deferred`、`ctOffsetMinutes`;改为 `nextExecutionDate`、`nextExecutionTime`。 |
| `openNextExecutionPreview` | 请求期间按钮 loading;数据返回后再打开弹窗。 |
| 预览弹窗模板 | 仅展示下次执行日、执行时间。 |
| 「预览下次执行」按钮 | `:loading="nextExecutionPreviewLoading"`。 |
### 3. 调用方与影响范围
- 仅创建表单预览流程;**破坏性变更**:是(依赖旧响应字段的前端逻辑已移除,与当前后端契约一致)。
### 4. 风险与回滚
- **风险级别**:低;**回滚方式是否简单**:是(恢复类型与模板)。
### 5. 验证与测试
- 填妥交易所与周期后点「预览下次执行」:按钮 loading、弹窗内 loading,成功后显示日期与时间;接口失败时弹窗关闭且已有错误提示。
+15
View File
@@ -255,3 +255,18 @@
- `getSimpleStockPage` 每页 50 条;下拉触底 `loadMore` 追加,搜索仍防抖并重置页码。
- 验证:`npm run build`;参见 `IMPACT_ANALYSIS.md` 对应补充。
---
## 补充:下次执行预览去掉执行时间(2026-10-10)
- 预览弹窗移除 `previewExecutionDateTime` / `executionDateTime` 展示行。
- 参见 `IMPACT_ANALYSIS.md` 对应补充。
---
## 补充:下次执行预览新接口字段与 loading(2026-10-12)
- `next-execution` 响应改为 `nextExecutionDate`、`nextExecutionTime`;弹窗仅展示「下次执行日」「执行时间」。
- 请求期间仅按钮 `:loading`;数据返回后再打开弹窗。
- 参见 `IMPACT_ANALYSIS.md` 对应补充。
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "schedule-invest-plan",
"name": "recurring-investment",
"private": true,
"version": "0.0.0",
"type": "module",
+2 -5
View File
@@ -125,11 +125,8 @@ export interface ScheduleInvestmentNextExecutionRequest {
/** `POST /trade/schedule-investment/plan/next-execution` 响应 data */
export interface ScheduleInvestmentNextExecutionData {
scheduledDate: string
executionDate: string
executionDateTime: string
deferred: boolean
ctOffsetMinutes: number
nextExecutionDate: string
nextExecutionTime: string
}
/** 计划详情 — plan 字段(比列表项更全) */
+3 -17
View File
@@ -1615,24 +1615,10 @@ const previewOffset = computed(() =>
@closed="onNextExecutionPreviewClosed"
>
<dl v-if="nextExecutionPreview" class="ri-preview">
<dt>{{ t('recurring.previewScheduledDate') }}</dt>
<dd class="num">{{ nextExecutionPreview.scheduledDate || '—' }}</dd>
<dt>{{ t('recurring.previewExecutionDate') }}</dt>
<dd class="num">{{ nextExecutionPreview.executionDate || '—' }}</dd>
<dt>{{ t('recurring.planDetail.nextExecution') }}</dt>
<dd class="num">{{ nextExecutionPreview.nextExecutionDate || '—' }}</dd>
<dt>{{ t('recurring.previewExecutionDateTime') }}</dt>
<dd class="num">{{ nextExecutionPreview.executionDateTime || '—' }}</dd>
<dt>{{ t('recurring.previewDeferred') }}</dt>
<dd>
{{
nextExecutionPreview.deferred
? t('recurring.previewDeferredYes')
: t('recurring.previewDeferredNo')
}}
</dd>
<dt>{{ t('recurring.ctOffsetLabel') }}</dt>
<dd class="num">
{{ t('recurring.ctOffsetPreview', { n: nextExecutionPreview.ctOffsetMinutes }) }}
</dd>
<dd class="num">{{ nextExecutionPreview.nextExecutionTime || '—' }}</dd>
</dl>
<template #footer>
<el-button @click="closeNextExecutionPreview">{{ t('recurring.back') }}</el-button>