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/ProjectResultsTab.svelte | 131 +++++++++++----------------- 1 file changed, 52 insertions(+), 79 deletions(-) (limited to 'frontend/src/pages/ProjectResultsTab.svelte') diff --git a/frontend/src/pages/ProjectResultsTab.svelte b/frontend/src/pages/ProjectResultsTab.svelte index c08bf3f..82a7009 100644 --- a/frontend/src/pages/ProjectResultsTab.svelte +++ b/frontend/src/pages/ProjectResultsTab.svelte @@ -15,6 +15,10 @@ metricsRow } from '../lib/format'; import { capitalReporting } from '../lib/capitalMetrics'; + 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'; import type { Run, BacktestResult } from '../lib/types'; interface Props { @@ -117,7 +121,7 @@ {#if run} Run {run.id.slice(0, 8)}… - {runStatusLabel[run.status]} + {runStatusLabel[run.status]} {/if} @@ -141,67 +145,38 @@ {/if} {#if run.error} - + {run.error} {/if} {#if !result} {:else} {#if result.warnings?.length} - + + {/if} -
+ {#if result.metrics} {@const mrow = result.metrics}
-
-
总收益率
-
{fmtPct(mrow.total_return)}
-
-
-
年化收益率
-
{fmtPct(mrow.annual_return)}
-
-
-
最大回撤
-
{fmtPct(mrow.max_drawdown)}
-
-
-
夏普比率
-
{fmtNum(mrow.sharpe)}
-
-
-
平仓回合数
-
{mrow.trade_count ?? "—"}
-
-
-
期末权益
-
{formatMoney(mrow.final_equity)}
-
+
总收益率
{fmtPct(mrow.total_return)}
+
年化收益率
{fmtPct(mrow.annual_return)}
+
最大回撤
{fmtPct(mrow.max_drawdown)}
+
夏普比率
{fmtNum(mrow.sharpe)}
+
平仓回合数
{mrow.trade_count ?? "—"}
+
期末权益
{formatMoney(mrow.final_equity)}
{/if} {#if cap}
-
-
累计投入
-
{formatMoney(cap.invested)}
-
-
-
最终持仓估值
-
{formatMoney(cap.holdingValue)}
-
-
-
投入回报率
-
{cap.returnPct ?? '—'}
-
+
累计投入
{formatMoney(cap.invested)}
+
最终持仓估值
{formatMoney(cap.holdingValue)}
+
投入回报率
{cap.returnPct ?? '—'}

投入口径不含初始账户闲置现金:累计投入 = 首日现金 − 末日现金;持仓估值 = 末日持仓 × 最新收盘价。

{/if} @@ -211,9 +186,9 @@ {#if result.elapsed_ms} · 耗时 {(result.elapsed_ms / 1000).toFixed(1)}s{/if} {#if result.peak_rss_kb} · 峰值内存 {fmtNum(result.peak_rss_kb / 1024)} MB{/if}

-
+ -
+
@@ -223,42 +198,40 @@ {:else} (typeof v === 'number' ? `${v.toFixed(2)}%` : String(v))} /> {/if} -
+
-
+

订单与持仓记录

成交记录 ({result.trades.length})

{#if result.trades.length > 0} -
- - - - - - - - - - - - - - {#each result.trades.slice(0, 80) as t, i (i)} - - - - - - - - - - {/each} - -
日期标的方向数量价格金额佣金
{t.date}{t.symbol}{t.side === "buy" ? "买入" : "卖出"}{t.quantity}{fmtNum(t.price, 3)}{fmtNum(t.value)}{fmtNum(t.commission, 4)}
-
+ + + + 日期 + 标的 + 方向 + 数量 + 价格 + 金额 + 佣金 + + + + {#each result.trades.slice(0, 80) as t, i (i)} + + {t.date} + {t.symbol} + {t.side === "buy" ? "买入" : "卖出"} + {t.quantity} + {fmtNum(t.price, 3)} + {fmtNum(t.value)} + {fmtNum(t.commission, 4)} + + {/each} + + {#if result.trades.length > 80}

仅显示前 80 条,共 {result.trades.length} 条

{/if} @@ -283,7 +256,7 @@ 结果由对应策略代码、配置、数据清单(数据哈希 {result.data_manifest_hash?.slice(0, 12)})以及当时引擎共同决定。

-
+
{/if} {/if} -- cgit v1.2.3