From debfb116fd503205f678a238fcf72a5fb1c48d3a Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 19 Jul 2026 16:49:35 +0800 Subject: [PATCH] Expand options review table columns and color result tags. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show direction, hold time, and entry logic; paint 盈利 green and 亏损 red. Co-authored-by: Cursor --- lib/common/static/options_review.js | 37 ++++++++++++++++--- lib/options/options_review_lib.py | 4 ++ .../templates/options_review_panel.html | 10 +++-- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/lib/common/static/options_review.js b/lib/common/static/options_review.js index 2a58ecd..a02ee35 100644 --- a/lib/common/static/options_review.js +++ b/lib/common/static/options_review.js @@ -122,6 +122,19 @@ return ""; } + function resultStyle(tag) { + var t = String(tag || "").trim(); + if (t === "盈利") return "color:#3dd68c;font-weight:600"; + if (t === "亏损") return "color:#f07178;font-weight:600"; + return ""; + } + + function tradeContractLabel(t) { + if (!t) return "—"; + if (t.source_type === "option_spot") return t.inst_id || t.underlying || "—"; + return t.underlying || "—"; + } + function newDraftId() { if (global.crypto && typeof global.crypto.randomUUID === "function") { return global.crypto.randomUUID().replace(/-/g, ""); @@ -436,7 +449,7 @@ if (!tbody) return; var wrap = beginListLoad("or-reviewed-wrap", soft); if (!soft) { - tbody.innerHTML = '加载中…'; + tbody.innerHTML = '加载中…'; } var p = baseQs(); p.set("reviewed", "1"); @@ -449,7 +462,7 @@ }) .then(function (data) { if (!data.ok) { - tbody.innerHTML = '加载失败'; + tbody.innerHTML = '加载失败'; endListLoad(wrap); return; } @@ -460,13 +473,16 @@ var rows = data.trades || []; reviewedCache = {}; if (!rows.length) { - tbody.innerHTML = '暂无复盘记录'; + tbody.innerHTML = '暂无复盘记录'; endListLoad(wrap); return; } tbody.innerHTML = rows .map(function (t) { reviewedCache[t.id] = t; + var entry = t.entry || {}; + var direction = t.direction_view || entry.direction_view || ""; + var entryLogic = t.entry_logic || entry.entry_logic || ""; return ( '" + "" + - escapeHtml(tradeTitle(t)) + + escapeHtml(tradeContractLabel(t)) + + "" + + "" + + escapeHtml(direction || "—") + "" + '" + "" + + escapeHtml(fmtHold(t.hold_seconds)) + + "" + + "" + escapeHtml(t.strategy_tag || "—") + "" + "" + + escapeHtml(entryLogic || "—") + + "" + + '' + escapeHtml(t.result_tag || "—") + "" + '' + @@ -509,7 +536,7 @@ endListLoad(wrap); }) .catch(function () { - tbody.innerHTML = '加载失败'; + tbody.innerHTML = '加载失败'; endListLoad(wrap); }); } diff --git a/lib/options/options_review_lib.py b/lib/options/options_review_lib.py index 5aec20a..e9e6a32 100644 --- a/lib/options/options_review_lib.py +++ b/lib/options/options_review_lib.py @@ -581,11 +581,15 @@ def enrich_trade_row(row: dict[str, Any], entry: dict[str, Any] | None = None) - out["entry"] = dict(entry) out["entry"]["images"] = parse_options_review_images_json(entry.get("images_json")) out["strategy_tag"] = entry.get("strategy_tag") + out["direction_view"] = entry.get("direction_view") + out["entry_logic"] = entry.get("entry_logic") out["result_tag"] = entry.get("result_tag") out["reviewed_at"] = entry.get("reviewed_at") or entry.get("updated_at") else: out["entry"] = None out["strategy_tag"] = None + out["direction_view"] = None + out["entry_logic"] = None out["result_tag"] = None out["reviewed_at"] = None return out diff --git a/lib/options/templates/options_review_panel.html b/lib/options/templates/options_review_panel.html index 7b3f52e..6558dfc 100644 --- a/lib/options/templates/options_review_panel.html +++ b/lib/options/templates/options_review_panel.html @@ -70,7 +70,8 @@ padding-top:8px;border-top:1px dashed rgba(127,127,127,.2);font-size:.74rem; } .or-list-loading{opacity:.55;pointer-events:none;transition:opacity .12s ease} - .or-trades-table-wrap,.or-reviewed-table-wrap{min-height:9.5rem} + .or-trades-table-wrap,.or-reviewed-table-wrap{min-height:9.5rem;overflow-x:auto} + .or-reviewed-table{min-width:980px} .or-kpi-row{ display:grid;grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px;margin-bottom:12px; @@ -343,16 +344,19 @@ 类型 标的/合约 + 方向 盈亏 开仓时间 平仓时间 + 持仓时长 策略 + 入场逻辑 结果 复盘时间 - 加载中… + 加载中… @@ -394,4 +398,4 @@ - +