Split journal order type from entry reason and fix review edit toggle in embed shell.
Adds order_type to journal uploads, removes legacy swing/trend labels from entry reason options, and ensures review-edit buttons sync when the records tab loads dynamically. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -100,10 +100,14 @@
|
||||
if (!revisit && tab === "strategy" && typeof global.initStrategyRollForm === "function") {
|
||||
global.initStrategyRollForm();
|
||||
}
|
||||
if (!revisit && tab === "records") {
|
||||
if (typeof global.loadJournals === "function") global.loadJournals();
|
||||
if (typeof global.loadReviews === "function") global.loadReviews();
|
||||
if (typeof global.toggleReviewMode === "function") global.toggleReviewMode();
|
||||
if (tab === "records") {
|
||||
if (!revisit && typeof global.loadJournals === "function") global.loadJournals();
|
||||
if (!revisit && typeof global.loadReviews === "function") global.loadReviews();
|
||||
if (global.InstanceTheme && typeof global.InstanceTheme.initReviewEditModeSync === "function") {
|
||||
global.InstanceTheme.initReviewEditModeSync();
|
||||
} else if (typeof global.toggleReviewMode === "function") {
|
||||
global.toggleReviewMode();
|
||||
}
|
||||
}
|
||||
if (!revisit && tab === "stats") {
|
||||
if (typeof global.initStatsSegmentFromUrl === "function") global.initStatsSegmentFromUrl();
|
||||
|
||||
@@ -1999,6 +1999,7 @@ html[data-theme="light"] .symbol-live-price--ok {
|
||||
|
||||
.journal-card .journal-form-row2 {
|
||||
grid-template-columns:
|
||||
minmax(6.5rem, 0.85fr)
|
||||
minmax(7.5rem, 1.15fr)
|
||||
minmax(7rem, 1fr)
|
||||
minmax(0, 1.35fr)
|
||||
@@ -2006,6 +2007,7 @@ html[data-theme="light"] .symbol-live-price--ok {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.journal-card .journal-form-row2 select[name="order_type"],
|
||||
.journal-card .journal-form-row2 select[name="entry_reason"] {
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.35;
|
||||
|
||||
@@ -290,7 +290,7 @@
|
||||
apply(data.theme, { skipStore: true });
|
||||
}
|
||||
|
||||
/** 交易记录页:核对开关与按钮 disabled 保持同步(iframe 软导航/表单恢复后不触发 change) */
|
||||
/** 交易记录页:核对开关与按钮 disabled 保持同步(含 iframe 软导航后动态挂载的 toggle) */
|
||||
function syncReviewEditButtons() {
|
||||
const toggle = document.getElementById("review-mode-toggle");
|
||||
if (!toggle) return;
|
||||
@@ -301,13 +301,17 @@
|
||||
}
|
||||
|
||||
function initReviewEditModeSync() {
|
||||
const toggle = document.getElementById("review-mode-toggle");
|
||||
if (!toggle) return;
|
||||
if (toggle.dataset.instReviewModeBound !== "1") {
|
||||
toggle.dataset.instReviewModeBound = "1";
|
||||
toggle.addEventListener("input", () => {
|
||||
if (!global.__instReviewModeBound) {
|
||||
global.__instReviewModeBound = true;
|
||||
const onToggle = () => {
|
||||
if (typeof global.toggleReviewMode === "function") global.toggleReviewMode();
|
||||
else syncReviewEditButtons();
|
||||
};
|
||||
document.addEventListener("change", (ev) => {
|
||||
if (ev.target && ev.target.id === "review-mode-toggle") onToggle();
|
||||
});
|
||||
document.addEventListener("input", (ev) => {
|
||||
if (ev.target && ev.target.id === "review-mode-toggle") onToggle();
|
||||
});
|
||||
}
|
||||
const run = () => {
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
`平仓时间:${escapeHtml(o.close_datetime || "-")}`,
|
||||
`持仓时长:${escapeHtml(o.hold_duration || "-")}`,
|
||||
`盈亏:${formatPnlSpan(o.pnl)}`,
|
||||
`下单类型:${escapeHtml(o.order_type || "无")}`,
|
||||
`开仓类型:${escapeHtml(o.entry_reason || "无")}`,
|
||||
`平仓/离场:${escapeHtml(exitText)}`,
|
||||
`预期RR:${escapeHtml(o.expect_rr || "-")}`,
|
||||
@@ -198,27 +199,28 @@
|
||||
|
||||
function parseTradeRecordRow(tr) {
|
||||
const cells = tr.querySelectorAll("td");
|
||||
if (cells.length < 14) return null;
|
||||
const dirBadge = cells[2].querySelector(".badge");
|
||||
if (cells.length < 15) return null;
|
||||
const dirBadge = cells[3].querySelector(".badge");
|
||||
return {
|
||||
rowId: tr.id,
|
||||
symbol: cells[0].textContent.trim(),
|
||||
type: cells[1].textContent.trim(),
|
||||
directionHtml: (dirBadge ? dirBadge.outerHTML : cells[2].innerHTML).trim(),
|
||||
directionText: cells[2].textContent.trim(),
|
||||
trigger: cells[3].textContent.trim(),
|
||||
stopLoss: cells[4].textContent.trim(),
|
||||
takeProfit: cells[5].textContent.trim(),
|
||||
margin: cells[6].textContent.trim(),
|
||||
leverage: cells[7].textContent.trim(),
|
||||
holdMinutes: cells[8].textContent.trim(),
|
||||
openedAt: cells[9].textContent.trim(),
|
||||
closedAt: cells[10].textContent.trim(),
|
||||
pnlHtml: cells[11].innerHTML.trim(),
|
||||
pnlText: cells[11].textContent.trim(),
|
||||
resultHtml: cells[12].innerHTML.trim(),
|
||||
resultText: cells[12].textContent.trim(),
|
||||
actionsHtml: cells[13].innerHTML,
|
||||
entryReason: cells[2].textContent.trim(),
|
||||
directionHtml: (dirBadge ? dirBadge.outerHTML : cells[3].innerHTML).trim(),
|
||||
directionText: cells[3].textContent.trim(),
|
||||
trigger: cells[4].textContent.trim(),
|
||||
stopLoss: cells[5].textContent.trim(),
|
||||
takeProfit: cells[6].textContent.trim(),
|
||||
margin: cells[7].textContent.trim(),
|
||||
leverage: cells[8].textContent.trim(),
|
||||
holdMinutes: cells[9].textContent.trim(),
|
||||
openedAt: cells[10].textContent.trim(),
|
||||
closedAt: cells[11].textContent.trim(),
|
||||
pnlHtml: cells[12].innerHTML.trim(),
|
||||
pnlText: cells[12].textContent.trim(),
|
||||
resultHtml: cells[13].innerHTML.trim(),
|
||||
resultText: cells[13].textContent.trim(),
|
||||
actionsHtml: cells[14].innerHTML,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -240,7 +242,8 @@
|
||||
function buildTradeRecordDetailHtml(row) {
|
||||
return `<div class="trade-record-detail">${
|
||||
tradeDetailRow("品种", escapeHtml(row.symbol)) +
|
||||
tradeDetailRow("类型", escapeHtml(row.type)) +
|
||||
tradeDetailRow("下单类型", escapeHtml(row.type)) +
|
||||
tradeDetailRow("开仓类型", escapeHtml(row.entryReason || "-")) +
|
||||
tradeDetailRow("方向", row.directionHtml) +
|
||||
tradeDetailRow("成交价", escapeHtml(row.trigger)) +
|
||||
tradeDetailRow("止损(开仓)", escapeHtml(row.stopLoss)) +
|
||||
|
||||
Reference in New Issue
Block a user