fix: th函数加_colBtnsOn开关+渲染循环设置(第一个表格A股当前市才显示?§按钮)

This commit is contained in:
xxm
2026-08-17 08:49:04 +08:00
parent 2f9f370bde
commit f2959b30fa
+7 -2
View File
@@ -2516,9 +2516,11 @@ function renderStrategyTable(strategies) {
};
const th = (key, label, cls, title, colKey) => {
const arrow = window._sortKey === key ? (window._sortDir === 'desc' ? '▼' : '▲') : '';
const helpBtns = colKey ? `<span class="spec-btn colinfo" title="看这列是干嘛的" onclick="event.stopPropagation();showColumnHelp('${colKey}')">ⓘ</span><span class="spec-btn ai" title="看策略模块spec(接口/约束)" onclick="event.stopPropagation();showModuleHelp('strategy','ai')">§</span>` : '';
// 2026-08-17 老莫:?§按钮只保留第一个表格表头(_colBtnsOn 控制)
const showBtns = colKey && window._colBtnsOn !== false;
const helpBtns = showBtns ? `<span class="spec-btn colinfo" title="看这列是干嘛的" onclick="event.stopPropagation();showColumnHelp('${colKey}')">ⓘ</span><span class="spec-btn ai" title="看策略模块spec(接口/约束)" onclick="event.stopPropagation();showModuleHelp('strategy','ai')">§</span>` : '';
// 2026-08-17 老莫:ⓘ§按钮放第二行(spec-th-row),列名一行保持列宽,避免横向滚动条
const thInner = colKey
const thInner = showBtns
? `<div class="spec-th-col"><div class="spec-th-label">${label}${arrow ? ' ' + arrow : ''}</div><div class="spec-th-btns">${helpBtns}</div></div>`
: `${label}${arrow ? ' ' + arrow : ''}`;
return `<th class="${cls || 'text-right'} px-2 py-1 cursor-pointer hover:text-slate-300 select-none align-top" onclick="sortBy('${key}')" title="${title || '点击排序'}">${thInner}</th>`;
@@ -2851,8 +2853,11 @@ function renderStrategyTable(strategies) {
return ' · 温度: <b>' + bandIcon + ' ' + bandName + '</b>' + (hasRsi && reg.temp_rsi ? ' <span class="text-slate-500 text-xs">RSI=' + reg.temp_rsi + '</span>' : '');
};
let html = '';
// 2026-08-17 老莫:?§按钮只保留第一个表格(A股当前市)表头
window._colBtnsOn = true;
// 头两个:A股当前市 + 港股当前市(标题尾部带温度)
if (aCur) html += renderRegimeTable(aStrats, aCur, true, '🇨🇳 A股', tempHtml(regA, true));
window._colBtnsOn = false;
if (hkCur) html += renderRegimeTable(hkStrats, hkCur, true, '🇭🇰 港股', tempHtml(regHK, false));
// 后四个:A股其他2市 + 港股其他2市
for (const rg of REGIME_ORDER) if (rg !== aCur) html += renderRegimeTable(aStrats, rg, false, '🇨🇳 A股', '');