This commit is contained in:
dekun
2026-05-24 08:15:31 +08:00
parent 3b97a59562
commit 88f4166bb7
4 changed files with 130 additions and 76 deletions
+24 -16
View File
@@ -218,11 +218,13 @@
const guess = guessTpslFromCondOrders(x.side, cond);
const slAttr = esc(String(guess.sl)).replace(/"/g, """);
const tpAttr = esc(String(guess.tp)).replace(/"/g, """);
const orderTotal = cond.length + reg.length;
const condAllBtn =
cond.length > 0
? `<button type="button" class="btn-cancel-cond-all ghost" data-ex-id="${esc(exchangeId)}" data-symbol="${symAttr}">撤销全部</button>`
? `<button type="button" class="btn-cancel-cond-all btn-sm ghost" data-ex-id="${esc(exchangeId)}" data-symbol="${symAttr}">撤销条件单</button>`
: "";
const condBody = renderOrderRows(exchangeId, x.symbol, cond, "conditional");
const regBody = renderOrderRows(exchangeId, x.symbol, reg, "limit");
return `<div class="pos-block">
<table class="data-table"><thead><tr><th>合约</th><th>方向</th><th>张数</th><th>浮盈</th><th>操作</th></tr></thead><tbody>
<tr>
@@ -230,25 +232,31 @@
<td>${esc(x.side)}</td>
<td>${fmt(x.contracts, 4)}</td>
<td class="${pnlCls(x.unrealized_pnl)}">${fmt(x.unrealized_pnl, 4)}</td>
<td class="td-actions td-actions-row">
<button type="button" class="btn-place-tpsl ghost" data-ex-id="${esc(exchangeId)}" data-symbol="${symAttr}" data-side="${sideAttr}" data-contracts="${contractsAttr}" data-sl="${slAttr}" data-tp="${tpAttr}">委托</button>
<button type="button" class="btn-close-pos danger" data-ex-id="${esc(exchangeId)}" data-symbol="${symAttr}" data-side="${sideAttr}">平仓</button>
<td class="td-actions">
<div class="pos-action-group">
<button type="button" class="btn-place-tpsl btn-sm ghost" data-ex-id="${esc(exchangeId)}" data-symbol="${symAttr}" data-side="${sideAttr}" data-contracts="${contractsAttr}" data-sl="${slAttr}" data-tp="${tpAttr}">委托</button>
<button type="button" class="btn-close-pos btn-sm danger" data-ex-id="${esc(exchangeId)}" data-symbol="${symAttr}" data-side="${sideAttr}">平仓</button>
</div>
</td>
</tr>
</tbody></table>
<div class="pos-orders">
<details class="orders-collapse">
<summary class="orders-collapse-summary">
<span class="pos-orders-title">条件单 · ${cond.length}</span>
${condAllBtn}
</summary>
<div class="orders-collapse-body">${condBody}</div>
</details>
<div class="pos-orders-head" style="margin-top:10px">
<span class="pos-orders-title">普通委托 · ${reg.length}</span>
<details class="pos-orders-collapse">
<summary class="pos-orders-collapse-summary">
<span class="pos-orders-collapse-label">委托单 <em>${orderTotal}</em></span>
<span class="pos-orders-collapse-meta">条件 ${cond.length} · 普通 ${reg.length}</span>
${condAllBtn}
</summary>
<div class="pos-orders-collapse-body">
<div class="orders-section">
<div class="orders-section-head">条件单</div>
${condBody}
</div>
<div class="orders-section">
<div class="orders-section-head">普通委托</div>
${regBody}
</div>
</div>
${renderOrderRows(exchangeId, x.symbol, reg, "limit")}
</div>
</details>
</div>`;
}