+12
-7
@@ -207,7 +207,6 @@ button, .btn {
|
|||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
filter: none;
|
filter: none;
|
||||||
}
|
}
|
||||||
.pos-brief-main { min-width: 0; }
|
|
||||||
.panel {
|
.panel {
|
||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
border: 1px solid var(--line);
|
border: 1px solid var(--line);
|
||||||
@@ -227,7 +226,9 @@ button, .btn {
|
|||||||
.inst-row { margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
|
.inst-row { margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
|
||||||
.overview-table-wrap {
|
.overview-table-wrap {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
margin-top: 12px;
|
margin: 12px auto 0;
|
||||||
|
width: fit-content;
|
||||||
|
max-width: 100%;
|
||||||
border: 1px solid var(--line);
|
border: 1px solid var(--line);
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
@@ -235,9 +236,17 @@ button, .btn {
|
|||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
}
|
}
|
||||||
.overview-table {
|
.overview-table {
|
||||||
width: 100%;
|
width: auto;
|
||||||
|
min-width: 720px;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
font-size: 0.88rem;
|
font-size: 0.88rem;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
body.page-dashboard #overview-status {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
body.page-dashboard .page-head {
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.overview-table th,
|
.overview-table th,
|
||||||
.overview-table td {
|
.overview-table td {
|
||||||
@@ -266,10 +275,6 @@ button, .btn {
|
|||||||
}
|
}
|
||||||
.pos-brief li {
|
.pos-brief li {
|
||||||
margin: 2px 0;
|
margin: 2px 0;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
}
|
||||||
.card-grid {
|
.card-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
+40
-23
@@ -24,39 +24,19 @@
|
|||||||
.replace(/"/g, """);
|
.replace(/"/g, """);
|
||||||
}
|
}
|
||||||
|
|
||||||
function positionSummary(brief, instanceId, online) {
|
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 invalid = !!(p.bid_invalid || (p.bid_px == null && (p.bid_sz == null || p.bid_sz === "")));
|
|
||||||
const reason = (p.bid_invalid_reason || "买一无效,禁止平仓").toString();
|
|
||||||
let closeBtn = "";
|
|
||||||
if (online && id) {
|
|
||||||
if (invalid) {
|
|
||||||
closeBtn =
|
|
||||||
'<button type="button" class="btn btn-sm btn-danger" disabled title="' +
|
|
||||||
escapeHtml(reason) +
|
|
||||||
'">平仓</button>';
|
|
||||||
} else {
|
|
||||||
closeBtn =
|
|
||||||
'<button type="button" class="btn btn-sm btn-danger" data-close-inst="' +
|
|
||||||
encodeURIComponent(String(instanceId)) +
|
|
||||||
'" data-close-opt="' +
|
|
||||||
encodeURIComponent(id) +
|
|
||||||
'" title="买一限价全平">平仓</button>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
"<li><span class=\"pos-brief-main\">" +
|
"<li>" +
|
||||||
escapeHtml(id) +
|
escapeHtml(id) +
|
||||||
" · " +
|
" · " +
|
||||||
sheets +
|
sheets +
|
||||||
"张 · " +
|
"张 · " +
|
||||||
fmtPnlHtml(p.pnl_usdt) +
|
fmtPnlHtml(p.pnl_usdt) +
|
||||||
"</span>" +
|
|
||||||
closeBtn +
|
|
||||||
"</li>"
|
"</li>"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -67,6 +47,42 @@
|
|||||||
return "<ul class=\"pos-brief\">" + items.join("") + more + "</ul>";
|
return "<ul class=\"pos-brief\">" + items.join("") + more + "</ul>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeActionButtons(brief, instanceId, online) {
|
||||||
|
if (!online) return "";
|
||||||
|
const list = (brief || []).filter(function (p) {
|
||||||
|
return !!(p && p.inst_id);
|
||||||
|
});
|
||||||
|
if (!list.length) return "";
|
||||||
|
return list
|
||||||
|
.slice(0, 8)
|
||||||
|
.map(function (p) {
|
||||||
|
const id = p.inst_id || "";
|
||||||
|
const invalid = !!(
|
||||||
|
p.bid_invalid ||
|
||||||
|
(p.bid_px == null && (p.bid_sz == null || p.bid_sz === ""))
|
||||||
|
);
|
||||||
|
const reason = (p.bid_invalid_reason || "买一无效,禁止平仓").toString();
|
||||||
|
const tip = list.length > 1 ? id + " · 买一限价全平" : "买一限价全平";
|
||||||
|
if (invalid) {
|
||||||
|
return (
|
||||||
|
'<button type="button" class="btn btn-danger" disabled title="' +
|
||||||
|
escapeHtml(reason) +
|
||||||
|
'">平仓</button>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
'<button type="button" class="btn btn-danger" data-close-inst="' +
|
||||||
|
encodeURIComponent(String(instanceId)) +
|
||||||
|
'" data-close-opt="' +
|
||||||
|
encodeURIComponent(id) +
|
||||||
|
'" title="' +
|
||||||
|
escapeHtml(tip) +
|
||||||
|
'">平仓</button>'
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.join("");
|
||||||
|
}
|
||||||
|
|
||||||
function fmtBidPx(v) {
|
function fmtBidPx(v) {
|
||||||
if (v == null || v === "") return "—";
|
if (v == null || v === "") return "—";
|
||||||
const n = Number(v);
|
const n = Number(v);
|
||||||
@@ -148,7 +164,7 @@
|
|||||||
fmtPnlHtml(pnl) +
|
fmtPnlHtml(pnl) +
|
||||||
"</td>" +
|
"</td>" +
|
||||||
"<td>" +
|
"<td>" +
|
||||||
positionSummary(brief, row.id, online) +
|
positionSummary(brief) +
|
||||||
"</td>" +
|
"</td>" +
|
||||||
"<td>" +
|
"<td>" +
|
||||||
bidLiquiditySummary(brief) +
|
bidLiquiditySummary(brief) +
|
||||||
@@ -163,6 +179,7 @@
|
|||||||
'<button type="button" class="btn" data-open-tab="' +
|
'<button type="button" class="btn" data-open-tab="' +
|
||||||
encodeURIComponent(row.id) +
|
encodeURIComponent(row.id) +
|
||||||
'">新标签</button>' +
|
'">新标签</button>' +
|
||||||
|
closeActionButtons(brief, row.id, online) +
|
||||||
"</div></td>" +
|
"</div></td>" +
|
||||||
"</tr>"
|
"</tr>"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user