Show options review upload form always on page.

Keep the multi-timeframe journal card visible like contract review instead of hiding it until a row is selected.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-17 09:49:14 +08:00
parent edcc04e88c
commit c6142dc246
2 changed files with 77 additions and 45 deletions
+32 -4
View File
@@ -371,17 +371,41 @@
function hideJournalForm() {
currentTradeId = null;
var card = $("or-journal-card");
if (card) card.hidden = true;
if (card) card.classList.add("or-journal-idle");
document.querySelectorAll(".or-trade-row").forEach(function (tr) {
tr.classList.remove("or-row-active");
});
($("or-trade-id") || {}).value = "";
($("or-f-open") || {}).value = "";
($("or-f-close") || {}).value = "";
($("or-f-coin") || {}).value = "";
($("or-f-inst") || {}).value = "";
($("or-f-pnl") || {}).value = "";
($("or-f-hold") || {}).value = "";
($("or-f-strategy") || {}).value = "";
($("or-f-direction") || {}).value = "";
($("or-f-exit") || {}).value = "";
($("or-f-followed") || {}).value = "";
($("or-f-result") || {}).value = "";
($("or-f-entry") || {}).value = "";
($("or-f-note") || {}).value = "";
setMoodTags("");
resetUploadSlots();
var summary = $("or-journal-summary");
if (summary) {
summary.textContent =
"先点「同步」拉记录,再在下方列表点选一笔填入;截图槽位 5m/15m/1h/4h 可先传.";
}
var legsHost = $("or-legs-host");
if (legsHost) legsHost.innerHTML = "";
($("or-save-status") || {}).textContent = "";
}
function openJournalForm(tradeId) {
currentTradeId = tradeId;
var card = $("or-journal-card");
if (!card) return;
card.hidden = false;
card.classList.remove("or-journal-idle");
card.scrollIntoView({ behavior: "smooth", block: "start" });
document.querySelectorAll(".or-trade-row").forEach(function (tr) {
tr.classList.toggle("or-row-active", Number(tr.getAttribute("data-id")) === tradeId);
@@ -400,7 +424,7 @@
return;
}
fillForm(data.trade);
($("or-save-status") || {}).textContent = "";
($("or-save-status") || {}).textContent = "已选中 #" + tradeId;
})
.catch(function () {
($("or-save-status") || {}).textContent = "加载失败";
@@ -484,7 +508,10 @@
function saveEntry() {
var tradeId = Number(($("or-trade-id") || {}).value || 0);
if (!tradeId) return;
if (!tradeId) {
alert("请先在下方列表点选一笔记录(若无记录请先点同步)");
return;
}
var strategy = (($("or-f-strategy") || {}).value || "").trim();
if (!strategy) {
alert("请填写策略标签");
@@ -566,6 +593,7 @@
}
);
bindUploadSlots();
hideJournalForm();
setActiveTab("option_spot");
}
+45 -41
View File
@@ -1,4 +1,4 @@
{# OKX 期权复盘:三类 Tab + 列表 + 下方多周期截图复盘表单 #}
{# OKX 期权复盘:三类 Tab + 常驻复盘上传(同合约多周期截图) + 列表 #}
<div class="options-review-wrap" id="options-review-root" style="grid-column:1/-1">
{% if not options_enabled %}
<div class="flash" style="margin-bottom:12px">期权未启用:请设置 <code>OKX_OPTIONS_ENABLED=true</code> 后重启.对冲计划仍可单独同步(若本地有已结束计划).</div>
@@ -18,6 +18,7 @@
.or-mood-grid{display:flex;flex-wrap:wrap;gap:10px 14px;margin:10px 0}
.or-form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;margin-bottom:8px}
.or-form-grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:8px;margin-bottom:8px}
.or-journal-idle .or-journal-body{opacity:.72}
</style>
<div class="card" style="margin-bottom:12px">
@@ -31,7 +32,6 @@
<button type="button" class="or-tab" data-source="options_options" role="tab">期期对冲记录</button>
<button type="button" class="or-tab" data-source="perp_options" role="tab">永期对冲记录</button>
</div>
<p class="muted" style="margin:0">点列表行进入下方「复盘记录上传」;截图槽位与合约一致(5m / 15m / 1h / 4h).对冲盈亏用计划合计;归属对冲的期权腿默认不重复计入.</p>
<div class="form-row" style="flex-wrap:wrap;gap:8px;margin-top:10px">
<select id="or-filter-uly">
<option value="">标的:全部</option>
@@ -58,47 +58,21 @@
</div>
</div>
<div class="card" style="margin-bottom:12px">
<h3 style="margin-top:0">统计</h3>
<div id="or-kpi" class="form-row" style="flex-wrap:wrap;gap:12px"></div>
<div id="or-stats-groups" style="margin-top:12px;display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px"></div>
</div>
<div class="card" style="margin-bottom:12px">
<h3 style="margin-top:0" id="or-list-title">期权交易记录</h3>
<div class="options-strike-table-wrap">
<table class="options-strike-table or-trades-table" id="or-trades-table">
<thead>
<tr>
<th>类型</th>
<th>标的/合约</th>
<th>盈亏</th>
<th>开/平</th>
<th>持有</th>
<th>策略</th>
<th>状态</th>
</tr>
</thead>
<tbody id="or-trades-tbody">
<tr><td colspan="7" class="muted">加载中…</td></tr>
</tbody>
</table>
</div>
</div>
<div class="card" id="or-journal-card" hidden>
{# 与合约一致:复盘上传区常驻,不依赖先点列表 #}
<div class="card or-journal-idle" id="or-journal-card" style="margin-bottom:12px">
<h2 style="margin-top:0">复盘记录上传(含截图)</h2>
<p class="muted" id="or-journal-summary" style="margin-top:0"></p>
<p class="muted" id="or-journal-summary" style="margin-top:0">先点「同步」拉记录,再在下方列表点选一笔,即可自动填入开平时间与盈亏;也可先上传截图再选记录保存.</p>
<div class="or-journal-body">
<form id="or-journal-form" onsubmit="return false;">
<input type="hidden" id="or-trade-id" value="">
<input type="hidden" id="or-draft-id" value="">
<div class="or-form-grid">
<input type="datetime-local" id="or-f-open" title="开仓时间" readonly>
<input type="datetime-local" id="or-f-close" title="平仓时间" readonly>
<input type="text" id="or-f-coin" placeholder="标的" readonly>
<input type="text" id="or-f-inst" placeholder="合约/计划" readonly>
<input type="text" id="or-f-pnl" placeholder="盈亏" readonly>
<input type="text" id="or-f-hold" placeholder="持有" readonly>
<input type="datetime-local" id="or-f-open" title="开仓时间">
<input type="datetime-local" id="or-f-close" title="平仓时间">
<input type="text" id="or-f-coin" placeholder="标的(如 ETH)">
<input type="text" id="or-f-inst" placeholder="合约/计划">
<input type="text" id="or-f-pnl" placeholder="盈亏(U)">
<input type="text" id="or-f-hold" placeholder="持有时长" readonly>
</div>
<div class="or-form-grid2">
<input type="text" id="or-f-strategy" placeholder="策略标签" required>
@@ -132,7 +106,7 @@
</div>
{% endfor %}
</div>
<p class="sub muted" style="margin-top:0">可只传部分周期;选文件后即时上传,保存后详情可查看</p>
<p class="sub muted" style="margin-top:0">可只传部分周期;选文件后即时上传(与合约复盘相同 5m/15m/1h/4h)</p>
<div class="or-mood-grid">
<label><input type="checkbox" class="or-mood" value="怕踏空">怕踏空</label>
@@ -145,13 +119,43 @@
<textarea id="or-f-note" rows="2" placeholder="备注" style="width:100%"></textarea>
<div class="form-row" style="margin-top:10px;gap:8px">
<button type="button" class="btn" id="or-save-btn">保存复盘记录</button>
<button type="button" class="btn-secondary" id="or-clear-btn">收起</button>
<button type="button" class="btn-secondary" id="or-clear-btn">清空表单</button>
<button type="button" class="btn-secondary" id="or-del-btn">删除复盘</button>
<span class="muted" id="or-save-status"></span>
</div>
<div id="or-legs-host" style="margin-top:12px"></div>
</form>
</div>
</div>
<div class="card" style="margin-bottom:12px">
<h3 style="margin-top:0">统计</h3>
<div id="or-kpi" class="form-row" style="flex-wrap:wrap;gap:12px"></div>
<div id="or-stats-groups" style="margin-top:12px;display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px"></div>
</div>
<div class="card">
<h3 style="margin-top:0" id="or-list-title">期权交易记录</h3>
<p class="muted" style="margin-top:0">点选一行,上方复盘表单会自动填入该笔数据.</p>
<div class="options-strike-table-wrap">
<table class="options-strike-table or-trades-table" id="or-trades-table">
<thead>
<tr>
<th>类型</th>
<th>标的/合约</th>
<th>盈亏</th>
<th>开/平</th>
<th>持有</th>
<th>策略</th>
<th>状态</th>
</tr>
</thead>
<tbody id="or-trades-tbody">
<tr><td colspan="7" class="muted">加载中…</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<script src="/static/options_review.js?v=2"></script>
<script src="/static/options_review.js?v=3"></script>