diff --git a/lib/common/static/instance_theme.css b/lib/common/static/instance_theme.css index 9257f69..a9b30d6 100644 --- a/lib/common/static/instance_theme.css +++ b/lib/common/static/instance_theme.css @@ -3401,6 +3401,21 @@ html[data-theme="light"] .opt-be-dist-down { background: rgba(74, 124, 255, 0.45); box-shadow: inset 0 0 0 1px rgba(140, 175, 255, 0.6); } +.options-page-wrap .opt-pick-btn:disabled, +.options-page-wrap .opt-pick-btn.is-locked { + opacity: 0.42; + cursor: not-allowed; + color: #8b95a8; + background: rgba(20, 28, 44, 0.55); + border-color: rgba(80, 90, 110, 0.5); + box-shadow: none; +} +html[data-theme="light"] .options-page-wrap .opt-pick-btn:disabled, +html[data-theme="light"] .options-page-wrap .opt-pick-btn.is-locked { + color: #7a8799; + background: rgba(148, 163, 184, 0.28); + border-color: rgba(148, 163, 184, 0.55); +} .opt-strike-row.opt-row-selected td { background: rgba(74, 124, 255, 0.1); } diff --git a/lib/common/static/options_panel.js b/lib/common/static/options_panel.js index c0c21d3..53dd931 100644 --- a/lib/common/static/options_panel.js +++ b/lib/common/static/options_panel.js @@ -30,6 +30,7 @@ targetDraftByInst: {}, /** 翻倍倍数草稿,避免轮询重绘把正在输入的值刷回 1 */ profitExitDraftByInst: {}, + condOrderLocked: false, }; let lastGoodPositions = null; @@ -103,14 +104,35 @@ return document.getElementById("opt-order-panel-host"); } + function applyCondPickLock() { + const locked = !!state.condOrderLocked; + document.querySelectorAll(".opt-pick-btn").forEach(function (btn) { + btn.disabled = locked; + btn.classList.toggle("is-locked", locked); + if (locked) { + btn.classList.remove("active"); + btn.title = "中控条件单占用中,禁止手动开仓"; + if (!btn.dataset.origText) btn.dataset.origText = "选择"; + btn.textContent = btn.dataset.origText; + } else { + btn.removeAttribute("title"); + } + }); + const openBtn = document.getElementById("opt-open-btn"); + if (openBtn && locked) { + openBtn.disabled = true; + openBtn.title = "中控条件单占用中,禁止手动开仓"; + } + } + function syncPickButtons(instId) { document.querySelectorAll(".opt-pick-btn").forEach(function (btn) { - const on = !!instId && btn.getAttribute("data-inst") === instId; + const on = !state.condOrderLocked && !!instId && btn.getAttribute("data-inst") === instId; btn.classList.toggle("active", on); - btn.disabled = false; if (!btn.dataset.origText) btn.dataset.origText = "选择"; btn.textContent = on ? "已选" : btn.dataset.origText; }); + applyCondPickLock(); } function parkOrderPanel() { @@ -651,7 +673,16 @@ function pickBtnHtml(instId) { if (!instId) return "—"; - return ''; + const locked = !!state.condOrderLocked; + return ( + '" + ); } function syncMoneyFilterButtons() { @@ -1167,6 +1198,11 @@ function finishStrikeRender(tbody, prevSelected, matchedSelected) { bindStrikePickButtons(tbody); + applyCondPickLock(); + if (state.condOrderLocked) { + state.selectedInst = null; + return; + } if (matchedSelected && prevSelected) { selectContract(prevSelected, null, true); } else if (!matchedSelected) { @@ -1407,6 +1443,10 @@ } async function selectContract(instId, pickBtn, silent) { + if (state.condOrderLocked) { + applyCondPickLock(); + return null; + } const seq = ++selectSeq; state.selectedInst = instId; placeOrderPanelAfter(instId); @@ -2332,6 +2372,10 @@ if (!card) return; const order = d && d.cond_order; const locked = !!(d && d.cond_order_locked); + const wasLocked = !!state.condOrderLocked; + state.condOrderLocked = locked || !!order; + if (state.condOrderLocked && !wasLocked) closeOrderDialog(); + applyCondPickLock(); if (!order && !locked) { card.hidden = true; return; diff --git a/lib/instance/templates/embed_shell.html b/lib/instance/templates/embed_shell.html index dc58b96..a179c04 100644 --- a/lib/instance/templates/embed_shell.html +++ b/lib/instance/templates/embed_shell.html @@ -9,7 +9,7 @@ - + diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index 0196997..60d5b0a 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -19,7 +19,7 @@ {{ pwa_app_name }} - + - +