diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js index 3281454..f44d74d 100644 --- a/manual_trading_hub/static/app.js +++ b/manual_trading_hub/static/app.js @@ -1537,7 +1537,9 @@ .join(""); } - function renderPositionBlock(exchangeId, exchangeKey, x, monitorOrder, trendPlan, tickMap) { + function renderPositionBlock(exchangeId, exchangeKey, x, monitorOrder, trendPlan, tickMap, opts) { + const options = opts || {}; + const compact = !!options.compact; const symAttr = esc(x.symbol || "").replace(/"/g, """); const exKeyAttr = esc(exchangeKey || exchangeId || "").replace(/"/g, """); const sideAttr = esc((x.side || "").toLowerCase()).replace(/"/g, """); @@ -1551,6 +1553,15 @@ const tpAttr = esc(String(tpsl.tp)).replace(/"/g, """); const mktAttrs = marketOpenBtnAttrs(exchangeId, exchangeKey, x.symbol, x, monitorOrder, trendPlan); const symBeBadge = beSecured ? ` ${breakevenBadgeHtml()}` : ""; + const actionCell = compact + ? `` + : `
+ + +
`; + const ordersBlock = compact + ? "" + : renderOrdersCollapse(exchangeId, x.symbol, cond, reg, tickMap); return `
@@ -1561,16 +1572,11 @@ - +
合约方向开仓价标记价张数浮盈操作
${fmtMarkPrice(x, tickMap)} ${fmt(x.contracts, 4)} ${fmt(x.unrealized_pnl, 2)} -
- - -
-
${actionCell}
- ${renderOrdersCollapse(exchangeId, x.symbol, cond, reg, tickMap)} + ${ordersBlock}
`; } @@ -1590,63 +1596,15 @@ p, findMonitorOrder(orders, p.symbol, p.side), findTrendPlan(trends, p.symbol, p.side), - tickMap + tickMap, + { compact: true } ) ) .join(""); } else { inner += '
无持仓
'; } - if (orders.length) { - inner += `
下单监控 · ${orders.length}
`; - orders.forEach((o) => { - const sym = o.exchange_symbol || o.symbol || ""; - inner += `
${esc(o.symbol || o.exchange_symbol)} · ${renderDirectionHtml(o.direction)} · 触发 ${fmtSymbolPrice(o.trigger_price, sym, tickMap)}
`; - }); - } - if ((row.capabilities || []).includes("key")) { - inner += `
关键位 · ${keys.length}
`; - if (!flaskOk) { - const fe = row.flask_error || hm.msg || hm.error || "策略 Flask 未连通"; - inner += `
${esc(fe)}
`; - } else if (!keys.length) { - inner += '
当前无记录
'; - } else { - keys.forEach((k) => { - const kp = kmap[k.id] || kmap[String(k.id)] || {}; - const mt = k.monitor_type || k.type || ""; - const pending = keyHasPendingOrder(k, kp); - const lineCls = pending ? "list-line hub-key-pending" : "list-line"; - let line = `${esc(k.symbol)} · ${esc(mt)}`; - if (k.direction) line += ` · ${renderDirectionHtml(k.direction)}`; - if (pending) line += ` · 挂单`; - const amtTxt = fmtKeyOrderAmount(k); - if (amtTxt) line += ` · 数量 ${esc(amtTxt)}`; - line += ` · ${esc(k.upper)} / ${esc(k.lower)}`; - if (kp.price_display != null || kp.price != null) { - line += ` · ${esc(kp.price_display != null ? kp.price_display : kp.price)}`; - } - line += ` · ${esc(kp.gate_summary || "-")}`; - inner += `
${line}
`; - }); - } - } - if ((row.capabilities || []).includes("trend") && trends.length) { - inner += `
趋势回调 · ${trends.length}
`; - trends.forEach((t) => { - const sym = t.exchange_symbol || t.symbol || ""; - const sl = t.stop_loss_display || fmtSymbolPrice(t.stop_loss, sym, tickMap); - const tp = t.take_profit_display || fmtSymbolPrice(t.take_profit, sym, tickMap); - inner += `
#${t.id} ${esc(t.symbol)} ${renderDirectionHtml(t.direction)} · 均价 ${esc(t.avg_entry_price_display || fmtSymbolPrice(t.avg_entry_price, sym, tickMap))} · SL ${esc(sl)} · TP ${esc(tp)}${trendAddSummaryHtml(t, tickMap)}
`; - }); - } - if (rolls.length) { - inner += `
顺势加仓 · ${rolls.length}
`; - rolls.forEach((g) => { - inner += `
组 #${g.id} · 监控 #${g.order_monitor_id || "—"} · ${g.leg_count != null ? g.leg_count : "—"} 腿
`; - }); - } - inner += `
点击标题栏放大全屏 · 查看持仓卡片 / 关键位 / 策略详情
`; + inner += `
点击标题栏进入全屏 · 委托 / 关键位 / 下单监控 / 趋势回调 / 顺势加仓
`; return inner; } diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index 8ce4c06..e168fe8 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -246,6 +246,6 @@
- +