diff --git a/lib/common/static/instance_ui.js b/lib/common/static/instance_ui.js index 709f783..ca8a73a 100644 --- a/lib/common/static/instance_ui.js +++ b/lib/common/static/instance_ui.js @@ -151,7 +151,14 @@ } function inferJournalDirection(o) { - const text = String((o && o.entry_reason) || ""); + const hint = String((o && (o.direction_hint || o.direction)) || "").toLowerCase(); + if (hint === "long" || hint === "buy" || hint === "多") { + return { text: "做多", cls: "direction-long" }; + } + if (hint === "short" || hint === "sell" || hint === "空") { + return { text: "做空", cls: "direction-short" }; + } + const text = String((o && (o.entry_reason || o.note)) || ""); if (/做空|空头|short/i.test(text)) { return { text: "做空", cls: "direction-short" }; } @@ -164,9 +171,9 @@ function renderJournalListHtml(data) { if (!data || !data.length) return ""; const mobile = isMobileCompactRecords(); - return data - .map(function (o) { - if (mobile) { + if (mobile) { + return data + .map(function (o) { const dir = inferJournalDirection(o); const pnlCls = pnlClassFromValue(o.pnl); const dirHtml = dir @@ -181,20 +188,48 @@ `; - } - const moodTags = (o.mood_issues || []).join(",") || "无"; + }) + .join(""); + } + const rows = data + .map(function (o) { + const moodTags = Array.isArray(o.mood_issues) + ? o.mood_issues.join(",") + : o.mood_issues || ""; + const mood = moodTags || "无"; const id = escapeHtml(o.id); - return `
-
${escapeHtml(o.coin || "-")} ${escapeHtml(o.tf || "-")} | 盈亏:${escapeHtml(o.pnl == null || o.pnl === "" ? "-" : o.pnl)}U
-
开:${escapeHtml(o.open_datetime || "-")} 平:${escapeHtml(o.close_datetime || "-")} 持仓:${escapeHtml(o.hold_duration || "-")}
-
心态标签:${escapeHtml(moodTags)}
-
- - -
-
`; + const pnlCls = pnlClassFromValue(o.pnl); + const pnlTxt = + o.pnl == null || o.pnl === "" ? "-" : String(o.pnl); + const dir = inferJournalDirection(o); + const dirHtml = dir + ? `${escapeHtml(dir.text)}` + : "-"; + return ` + ${escapeHtml(o.coin || "-")} + ${escapeHtml(o.tf || "-")} + ${dirHtml} + ${escapeHtml(o.order_type || "-")} + ${escapeHtml(o.entry_reason || "-")} + ${escapeHtml(pnlTxt)} + ${escapeHtml((o.open_datetime || "-").toString().slice(0, 16))} + ${escapeHtml((o.close_datetime || "-").toString().slice(0, 16))} + ${escapeHtml(o.hold_duration || "-")} + ${escapeHtml(mood)} + + + + + `; }) .join(""); + return `
+ + + + + ${rows} +
品种周期方向下单类型开仓类型盈亏U开仓时间平仓时间持仓心态标签操作
`; } function parseTradeRecordRow(tr) { diff --git a/lib/common/static/records_review_page.js b/lib/common/static/records_review_page.js index 689d91b..d4f7a13 100644 --- a/lib/common/static/records_review_page.js +++ b/lib/common/static/records_review_page.js @@ -324,6 +324,13 @@ journalsPages = Math.max(1, Math.ceil(total / PAGE_SIZE) || 1); if (journalsPage >= journalsPages) journalsPage = Math.max(0, journalsPages - 1); updatePager("journals"); + var hint = $("rr-journals-hint"); + if (hint) { + hint.textContent = + total > 0 + ? "已保存的复盘(共" + total + "条,每页5条)." + : "已保存的复盘(每页5条)."; + } var slice = journalsAll.slice( journalsPage * PAGE_SIZE, journalsPage * PAGE_SIZE + PAGE_SIZE diff --git a/lib/instance/templates/embed_shell.html b/lib/instance/templates/embed_shell.html index b8af073..ef78a50 100644 --- a/lib/instance/templates/embed_shell.html +++ b/lib/instance/templates/embed_shell.html @@ -90,7 +90,7 @@ - + @@ -108,7 +108,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj {% include 'embed_boot_scripts.html' %} - + diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index bce24ff..c4a816d 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -447,7 +447,7 @@ - + @@ -1986,7 +1986,7 @@ setInterval(tickOrderHoldDurations, 1000); tickOrderHoldDurations(); setInterval(refreshPriceSnapshotConditional, {{ price_refresh_seconds * 1000 }}); - + diff --git a/lib/instance/templates/records_panel.html b/lib/instance/templates/records_panel.html index 22221a4..9ff3a89 100644 --- a/lib/instance/templates/records_panel.html +++ b/lib/instance/templates/records_panel.html @@ -126,8 +126,8 @@

交易复盘记录

-

已保存的复盘(每页5条).

-
+

已保存的复盘(每页5条).

+