feat: show review fields in symbol archive trade table

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-08 12:20:29 +08:00
parent 1dcf62bb08
commit 4918699276
5 changed files with 338 additions and 11 deletions
+19
View File
@@ -4016,9 +4016,28 @@ body.hub-page-ai #page-ai {
}
.archive-trades-table {
width: 100%;
min-width: 920px;
border-collapse: collapse;
font-size: 0.78rem;
}
.archive-trades-table .archive-dt {
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
.archive-trades-table .archive-hold {
white-space: nowrap;
}
.archive-review-mark {
display: inline-block;
margin-right: 4px;
padding: 0 4px;
border-radius: 4px;
font-size: 0.62rem;
line-height: 1.4;
color: #6ab88a;
background: rgba(106, 184, 138, 0.12);
vertical-align: middle;
}
.archive-trades-table th,
.archive-trades-table td {
padding: 6px 8px;
+57 -3
View File
@@ -92,6 +92,37 @@
return s;
}
function fmtDt(raw) {
if (raw == null || raw === "") return "—";
return String(raw).replace("T", " ").slice(0, 16);
}
function fmtHoldMinutes(tr) {
if (!tr) return "—";
const text = tr.hold_minutes_text;
if (text) return text;
const n = Number(tr.hold_minutes);
if (!Number.isFinite(n) || n <= 0) return "0分钟";
const hours = Math.floor(n / 60);
const mins = Math.floor(n % 60);
if (hours) return hours + "小时" + mins + "分钟";
return mins + "分钟";
}
function fmtEntryType(tr) {
if (!tr) return "—";
return (
tr.entry_type ||
tr.entry_reason ||
tr.monitor_type ||
"—"
);
}
function reviewMark(tr) {
return tr && tr.reviewed ? "复" : "";
}
function pnlClass(v) {
const n = Number(v);
if (!Number.isFinite(n) || Math.abs(n) < 1e-6) return "";
@@ -519,21 +550,44 @@
}
elTrades.innerHTML =
'<table class="archive-trades-table"><thead><tr>' +
"<th>平仓</th><th>方向</th><th>结果</th><th>盈亏</th><th>标签</th><th>备注</th>" +
"<th>开仓类型</th><th>开仓时间</th><th>平仓时间</th><th>持仓时长</th>" +
"<th>方向</th><th>结果</th><th>盈亏</th><th>标签</th><th>备注</th>" +
"</tr></thead><tbody>" +
trades
.map(function (t) {
const tid = t.trade_id || t.id;
const active = String(tid) === String(selectedTradeId) ? " is-active" : "";
const tag = t.behavior_tag || "";
const rev = reviewMark(t);
return (
'<tr class="archive-trade-row' +
active +
'" data-id="' +
tid +
'">' +
"<td>" +
(t.closed_at || "") +
'<td' +
(rev ? ' title="复盘记录"' : "") +
">" +
(rev ? '<span class="archive-review-mark">' + rev + "</span>" : "") +
fmtEntryType(t) +
"</td>" +
'<td class="archive-dt"' +
(rev ? ' title="复盘记录"' : "") +
">" +
(rev ? '<span class="archive-review-mark">' + rev + "</span>" : "") +
fmtDt(t.opened_at) +
"</td>" +
'<td class="archive-dt"' +
(rev ? ' title="复盘记录"' : "") +
">" +
(rev ? '<span class="archive-review-mark">' + rev + "</span>" : "") +
fmtDt(t.closed_at) +
"</td>" +
'<td class="archive-hold"' +
(rev ? ' title="复盘记录"' : "") +
">" +
(rev ? '<span class="archive-review-mark">' + rev + "</span>" : "") +
fmtHoldMinutes(t) +
"</td>" +
"<td>" +
(t.direction || "—") +