From 61f5c545953bb4ee20b123bf9671ac35d7f1f3c1 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Fri, 18 Sep 2026 12:03:32 +0800 Subject: [变更性质] feat(frontend) [新增功能] round3 页面组件全量迁移 shadcn-svelte(12 页面 + Modal/DatasetWizard/DatasetCard/Status) [实现方案] .btn→Button、.banner→Alert、table.data→Table.Root、.badge→Badge、.tabs→Tabs.Root、.metric-card/form.card→Card.Root;ProjectStrategyTab div 配对修复 [影响范围] src/pages/*.svelte、src/components/*.svelte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/ProjectBacktestTab.svelte | 113 ++++++++++++++------------- 1 file changed, 58 insertions(+), 55 deletions(-) (limited to 'frontend/src/pages/ProjectBacktestTab.svelte') diff --git a/frontend/src/pages/ProjectBacktestTab.svelte b/frontend/src/pages/ProjectBacktestTab.svelte index baa9e5f..a9e7799 100644 --- a/frontend/src/pages/ProjectBacktestTab.svelte +++ b/frontend/src/pages/ProjectBacktestTab.svelte @@ -12,6 +12,11 @@ } from '../lib/format'; import { summarizeCoverage } from '../lib/coverage'; import type { Run, Dataset } from '../lib/types'; + import { Button } from '$lib/components/ui/button'; + import { Alert } from '$lib/components/ui/alert'; + import { Badge } from '$lib/components/ui/badge'; + import * as Card from '$lib/components/ui/card'; + import * as Table from '$lib/components/ui/table'; interface Props { projectId: string; @@ -219,7 +224,7 @@
-
+

发起回测

{#if !busyDatasets && datasetsReady.length === 0 && !cfgErr} @@ -262,7 +267,7 @@
{#if needAck} - + {/if}
- + {#if selectedDataset} 本次回测与该数据集、当前策略快照一同记录,可按原始条件重跑 {/if}
{/if} - + -
+

最近一次回测

{#if latest} - Run 分支 {latest.version_id?.slice(0,8) ?? "—"} - {runStatusLabel[latest.status]} + Run 分支 {latest.version_id?.slice(0,8) ?? '—'} + {runStatusLabel[latest.status]} {/if}
@@ -305,80 +310,78 @@ error={latestErr} />
- - - - {#if latest.started_at}{/if} - {#if latest.finished_at}{/if} - - - - -
启动时间{fmtDateTime(latest.created_at)}
开始执行{fmtDateTime(latest.started_at)}
结束时间{fmtDateTime(latest.finished_at)}
代码版本{latest.version_id.slice(0, 10)}
数据集{latest.dataset_id?.slice(0, 8)}…
资金{formatMoney(latest.config.capital)} · 佣金 {fmtPct(latest.config.commission, 4)} · 滑点 {fmtPct(latest.config.slippage, 4)}
+ + + 启动时间{fmtDateTime(latest.created_at)} + {#if latest.started_at}开始执行{fmtDateTime(latest.started_at)}{/if} + {#if latest.finished_at}结束时间{fmtDateTime(latest.finished_at)}{/if} + 代码版本{latest.version_id.slice(0, 10)} + 数据集{latest.dataset_id?.slice(0, 8)}… + 资金{formatMoney(latest.config.capital)} · 佣金 {fmtPct(latest.config.commission, 4)} · 滑点 {fmtPct(latest.config.slippage, 4)} + +
{#if latest.error} - + {latest.error} {/if} {#if latest.result?.warnings?.length} - + {/if} {#if latest.status === 'succeeded' && latest.result} - 查看完整结果与图表 + {/if}
{#if canCancel} - + {/if} {#if canRerun} - + {/if}
{:else} {/if} -
+ -
+

回测历史

{#if history && history.length > 0} -
- - - - - - - - - - - +
+ + + + 启动时间 + 状态 + 资金/佣金/滑点 + 数据集 + 结果 + + + {#each history as h (h.id)} -
- - - - - - + + {fmtDateTime(h.created_at)} + {h.status === 'succeeded' ? '完成' : h.status === 'failed' ? '失败' : h.status === 'running' ? '执行中' : h.status === 'cancelled' ? '已取消' : '排队中'} + {formatMoney(h.config.capital)} · {fmtPct(h.config.commission, 4)} / {fmtPct(h.config.slippage, 4)} + {h.dataset_id?.slice(0, 8)}… + + + + {/each} - -
启动时间状态资金/佣金/滑点数据集结果
{fmtDateTime(h.created_at)}{h.status === 'succeeded' ? '完成' : h.status === 'failed' ? '失败' : h.status === 'running' ? '执行中' : h.status === 'cancelled' ? '已取消' : '排队中'} - {formatMoney(h.config.capital)} · {fmtPct(h.config.commission, 4)} / {fmtPct(h.config.slippage, 4)} - {h.dataset_id?.slice(0, 8)}… - 结果 -
+ +
{/if} -
- + + -- cgit v1.2.3