Expand options review table columns and color result tags.
Show direction, hold time, and entry logic; paint 盈利 green and 亏损 red. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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 = '<tr><td colspan="8" class="muted">加载中…</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="11" class="muted">加载中…</td></tr>';
|
||||
}
|
||||
var p = baseQs();
|
||||
p.set("reviewed", "1");
|
||||
@@ -449,7 +462,7 @@
|
||||
})
|
||||
.then(function (data) {
|
||||
if (!data.ok) {
|
||||
tbody.innerHTML = '<tr><td colspan="8" class="muted">加载失败</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="11" class="muted">加载失败</td></tr>';
|
||||
endListLoad(wrap);
|
||||
return;
|
||||
}
|
||||
@@ -460,13 +473,16 @@
|
||||
var rows = data.trades || [];
|
||||
reviewedCache = {};
|
||||
if (!rows.length) {
|
||||
tbody.innerHTML = '<tr><td colspan="8" class="muted">暂无复盘记录</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="11" class="muted">暂无复盘记录</td></tr>';
|
||||
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 (
|
||||
'<tr class="or-reviewed-row" data-id="' +
|
||||
t.id +
|
||||
@@ -475,7 +491,10 @@
|
||||
escapeHtml(t.source_label || t.source_type) +
|
||||
"</span></td>" +
|
||||
"<td>" +
|
||||
escapeHtml(tradeTitle(t)) +
|
||||
escapeHtml(tradeContractLabel(t)) +
|
||||
"</td>" +
|
||||
"<td>" +
|
||||
escapeHtml(direction || "—") +
|
||||
"</td>" +
|
||||
'<td style="' +
|
||||
pnlStyle(t.realized_pnl_total) +
|
||||
@@ -489,9 +508,17 @@
|
||||
escapeHtml(t.closed_at || "—") +
|
||||
"</td>" +
|
||||
"<td>" +
|
||||
escapeHtml(fmtHold(t.hold_seconds)) +
|
||||
"</td>" +
|
||||
"<td>" +
|
||||
escapeHtml(t.strategy_tag || "—") +
|
||||
"</td>" +
|
||||
"<td>" +
|
||||
escapeHtml(entryLogic || "—") +
|
||||
"</td>" +
|
||||
'<td style="' +
|
||||
resultStyle(t.result_tag) +
|
||||
'">' +
|
||||
escapeHtml(t.result_tag || "—") +
|
||||
"</td>" +
|
||||
'<td class="muted" style="font-size:12px;white-space:nowrap">' +
|
||||
@@ -509,7 +536,7 @@
|
||||
endListLoad(wrap);
|
||||
})
|
||||
.catch(function () {
|
||||
tbody.innerHTML = '<tr><td colspan="8" class="muted">加载失败</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="11" class="muted">加载失败</td></tr>';
|
||||
endListLoad(wrap);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user