总览持仓展示出场;内嵌打开改为打开并去掉新标签。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -403,6 +403,16 @@ button, .btn {
|
|||||||
.pos-brief li {
|
.pos-brief li {
|
||||||
margin: 2px 0;
|
margin: 2px 0;
|
||||||
}
|
}
|
||||||
|
.pos-exit {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 0.76rem;
|
||||||
|
color: var(--text);
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
.pos-exit.muted {
|
||||||
|
color: var(--muted);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
.card-grid {
|
.card-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||||
|
|||||||
+30
-14
@@ -24,12 +24,36 @@
|
|||||||
.replace(/"/g, """);
|
.replace(/"/g, """);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatExitBrief(p) {
|
||||||
|
if (p && p.target_monitor_text && String(p.target_monitor_text).trim() && p.target_monitor_text !== "—") {
|
||||||
|
return String(p.target_monitor_text).trim();
|
||||||
|
}
|
||||||
|
const parts = [];
|
||||||
|
const tgt = Number(p && p.target_index);
|
||||||
|
if (Number.isFinite(tgt) && tgt > 0) {
|
||||||
|
const ot = String((p && p.opt_type) || "").toUpperCase();
|
||||||
|
const side = ot === "P" ? "Put≤" : ot === "C" ? "Call≥" : "目标";
|
||||||
|
parts.push(side + " " + tgt);
|
||||||
|
}
|
||||||
|
if (p && p.profit_exit_enabled) {
|
||||||
|
const m = Number(p.profit_exit_mult);
|
||||||
|
if (Number.isFinite(m) && m > 0) {
|
||||||
|
parts.push(Math.abs(m - Math.round(m)) < 1e-9 ? Math.round(m) + "倍" : m + "倍");
|
||||||
|
} else {
|
||||||
|
parts.push("利润出场");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parts.length ? parts.join(" · ") : "未设出场";
|
||||||
|
}
|
||||||
|
|
||||||
function positionSummary(brief) {
|
function positionSummary(brief) {
|
||||||
const list = brief || [];
|
const list = brief || [];
|
||||||
if (!list.length) return '<span class="muted">暂无持仓</span>';
|
if (!list.length) return '<span class="muted">暂无持仓</span>';
|
||||||
const items = list.slice(0, 8).map(function (p) {
|
const items = list.slice(0, 8).map(function (p) {
|
||||||
const id = p.inst_id || "";
|
const id = p.inst_id || "";
|
||||||
const sheets = escapeHtml(String(p.sheets != null ? p.sheets : "—"));
|
const sheets = escapeHtml(String(p.sheets != null ? p.sheets : "—"));
|
||||||
|
const exitText = formatExitBrief(p);
|
||||||
|
const exitCls = exitText === "未设出场" ? "muted" : "";
|
||||||
return (
|
return (
|
||||||
"<li>" +
|
"<li>" +
|
||||||
escapeHtml(id) +
|
escapeHtml(id) +
|
||||||
@@ -37,7 +61,11 @@
|
|||||||
sheets +
|
sheets +
|
||||||
"张 · " +
|
"张 · " +
|
||||||
fmtPnlHtml(p.pnl_usdt) +
|
fmtPnlHtml(p.pnl_usdt) +
|
||||||
"</li>"
|
'<div class="pos-exit ' +
|
||||||
|
exitCls +
|
||||||
|
'">出场: ' +
|
||||||
|
escapeHtml(exitText) +
|
||||||
|
"</div></li>"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
const more =
|
const more =
|
||||||
@@ -233,10 +261,7 @@
|
|||||||
'<td><div class="overview-actions">' +
|
'<td><div class="overview-actions">' +
|
||||||
'<a class="btn" href="/desk?id=' +
|
'<a class="btn" href="/desk?id=' +
|
||||||
encodeURIComponent(row.id) +
|
encodeURIComponent(row.id) +
|
||||||
'">内嵌打开</a>' +
|
'">打开</a>' +
|
||||||
'<button type="button" class="btn" data-open-tab="' +
|
|
||||||
encodeURIComponent(row.id) +
|
|
||||||
'">新标签</button>' +
|
|
||||||
closeActionButtons(brief, row.id, online) +
|
closeActionButtons(brief, row.id, online) +
|
||||||
"</div></td>" +
|
"</div></td>" +
|
||||||
"</tr>"
|
"</tr>"
|
||||||
@@ -442,15 +467,6 @@
|
|||||||
"</tr></thead><tbody>" +
|
"</tr></thead><tbody>" +
|
||||||
list.map(renderRow).join("") +
|
list.map(renderRow).join("") +
|
||||||
"</tbody></table></div>";
|
"</tbody></table></div>";
|
||||||
grid.querySelectorAll("[data-open-tab]").forEach(function (btn) {
|
|
||||||
btn.addEventListener("click", async function () {
|
|
||||||
const id = btn.getAttribute("data-open-tab");
|
|
||||||
const rr = await fetch("/api/instances/" + id + "/open_url");
|
|
||||||
const dd = await rr.json();
|
|
||||||
if (dd.ok && dd.url) window.open(dd.url, "_blank", "noopener");
|
|
||||||
else alert(dd.msg || "无法打开");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
grid.querySelectorAll("[data-close-opt]").forEach(function (btn) {
|
grid.querySelectorAll("[data-close-opt]").forEach(function (btn) {
|
||||||
btn.addEventListener("click", function () {
|
btn.addEventListener("click", function () {
|
||||||
requestClose(btn);
|
requestClose(btn);
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
<div id="overview-grid"></div>
|
<div id="overview-grid"></div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ url_for('static', filename='hub.js') }}?v=10"></script>
|
<script src="{{ url_for('static', filename='hub.js') }}?v=11"></script>
|
||||||
<script>HubOverview.boot();</script>
|
<script>HubOverview.boot();</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user