条件单占用时左侧期权「选择」按钮置灰禁用,避免手动开仓。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-04 18:45:23 +08:00
parent e11651d729
commit bab26c7205
5 changed files with 65 additions and 6 deletions
+15
View File
@@ -3401,6 +3401,21 @@ html[data-theme="light"] .opt-be-dist-down {
background: rgba(74, 124, 255, 0.45); background: rgba(74, 124, 255, 0.45);
box-shadow: inset 0 0 0 1px rgba(140, 175, 255, 0.6); 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 { .opt-strike-row.opt-row-selected td {
background: rgba(74, 124, 255, 0.1); background: rgba(74, 124, 255, 0.1);
} }
+47 -3
View File
@@ -30,6 +30,7 @@
targetDraftByInst: {}, targetDraftByInst: {},
/** 翻倍倍数草稿,避免轮询重绘把正在输入的值刷回 1 */ /** 翻倍倍数草稿,避免轮询重绘把正在输入的值刷回 1 */
profitExitDraftByInst: {}, profitExitDraftByInst: {},
condOrderLocked: false,
}; };
let lastGoodPositions = null; let lastGoodPositions = null;
@@ -103,14 +104,35 @@
return document.getElementById("opt-order-panel-host"); 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) { function syncPickButtons(instId) {
document.querySelectorAll(".opt-pick-btn").forEach(function (btn) { 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.classList.toggle("active", on);
btn.disabled = false;
if (!btn.dataset.origText) btn.dataset.origText = "选择"; if (!btn.dataset.origText) btn.dataset.origText = "选择";
btn.textContent = on ? "已选" : btn.dataset.origText; btn.textContent = on ? "已选" : btn.dataset.origText;
}); });
applyCondPickLock();
} }
function parkOrderPanel() { function parkOrderPanel() {
@@ -651,7 +673,16 @@
function pickBtnHtml(instId) { function pickBtnHtml(instId) {
if (!instId) return "—"; if (!instId) return "—";
return '<button type="button" class="btn-secondary opt-pick-btn" data-inst="' + instId + '">选择</button>'; const locked = !!state.condOrderLocked;
return (
'<button type="button" class="btn-secondary opt-pick-btn' +
(locked ? " is-locked" : "") +
'" data-inst="' +
instId +
'"' +
(locked ? ' disabled title="中控条件单占用中,禁止手动开仓"' : "") +
">选择</button>"
);
} }
function syncMoneyFilterButtons() { function syncMoneyFilterButtons() {
@@ -1167,6 +1198,11 @@
function finishStrikeRender(tbody, prevSelected, matchedSelected) { function finishStrikeRender(tbody, prevSelected, matchedSelected) {
bindStrikePickButtons(tbody); bindStrikePickButtons(tbody);
applyCondPickLock();
if (state.condOrderLocked) {
state.selectedInst = null;
return;
}
if (matchedSelected && prevSelected) { if (matchedSelected && prevSelected) {
selectContract(prevSelected, null, true); selectContract(prevSelected, null, true);
} else if (!matchedSelected) { } else if (!matchedSelected) {
@@ -1407,6 +1443,10 @@
} }
async function selectContract(instId, pickBtn, silent) { async function selectContract(instId, pickBtn, silent) {
if (state.condOrderLocked) {
applyCondPickLock();
return null;
}
const seq = ++selectSeq; const seq = ++selectSeq;
state.selectedInst = instId; state.selectedInst = instId;
placeOrderPanelAfter(instId); placeOrderPanelAfter(instId);
@@ -2332,6 +2372,10 @@
if (!card) return; if (!card) return;
const order = d && d.cond_order; const order = d && d.cond_order;
const locked = !!(d && d.cond_order_locked); const locked = !!(d && d.cond_order_locked);
const wasLocked = !!state.condOrderLocked;
state.condOrderLocked = locked || !!order;
if (state.condOrderLocked && !wasLocked) closeOrderDialog();
applyCondPickLock();
if (!order && !locked) { if (!order && !locked) {
card.hidden = true; card.hidden = true;
return; return;
+1 -1
View File
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4"> <link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4"> <link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
<link rel="stylesheet" href="/static/instance_page.css?v=25"> <link rel="stylesheet" href="/static/instance_page.css?v=25">
<link rel="stylesheet" href="/static/instance_theme.css?v=127"> <link rel="stylesheet" href="/static/instance_theme.css?v=128">
<script src="/static/account_risk_badge.js?v=4"></script> <script src="/static/account_risk_badge.js?v=4"></script>
<script src="/static/open_submit_gate.js?v=1"></script> <script src="/static/open_submit_gate.js?v=1"></script>
<meta name="theme-color" content="#0b0d14"> <meta name="theme-color" content="#0b0d14">
+1 -1
View File
@@ -19,7 +19,7 @@
<link rel="manifest" href="/static/icons/manifest.webmanifest"> <link rel="manifest" href="/static/icons/manifest.webmanifest">
<title>{{ pwa_app_name }}</title> <title>{{ pwa_app_name }}</title>
<link rel="stylesheet" href="/static/instance_page.css?v=25"> <link rel="stylesheet" href="/static/instance_page.css?v=25">
<link rel="stylesheet" href="/static/instance_theme.css?v=127"> <link rel="stylesheet" href="/static/instance_theme.css?v=128">
</head> </head>
<body <body
+1 -1
View File
@@ -364,4 +364,4 @@
</div> </div>
</div> </div>
<script src="/static/options_expiry_countdown.js?v=1"></script> <script src="/static/options_expiry_countdown.js?v=1"></script>
<script src="/static/options_panel.js?v=69"></script> <script src="/static/options_panel.js?v=70"></script>