refactor: simplify startup logs, batch DB read, remove per-read log

This commit is contained in:
zlm committed 2026-06-10 09:13:34 +08:00
1 parent 33d5442941
commit 11b79075a5
5 files changed
+55 -62

No files matched your search

+5 -5
View File
@@ -65,15 +65,15 @@ let activeSubTab: 'mp' | 'plc' = 'mp'
async function loadConfig() {
configLoaded = true
plcTabLoaded = false
activeSubTab = 'mp'
const el = document.getElementById('page-config')!
const mpActive = activeSubTab === 'mp'
el.innerHTML = `
<div class="flex gap-1 mb-4 border-b border-gray-200 pb-0">
<button id="sub-tab-mp" class="sub-tab active px-4 py-2 text-sm font-medium border-b-2 border-indigo-600 text-indigo-700">检测点配置</button>
<button id="sub-tab-plc" class="sub-tab px-4 py-2 text-sm font-medium text-gray-500 border-b-2 border-transparent hover:text-gray-700">PLC配置</button>
<button id="sub-tab-mp" class="sub-tab px-4 py-2 text-sm font-medium border-b-2 ${mpActive ? 'border-indigo-600 text-indigo-700' : 'border-transparent text-gray-500 hover:text-gray-700'}">检测点配置</button>
<button id="sub-tab-plc" class="sub-tab px-4 py-2 text-sm font-medium border-b-2 ${mpActive ? 'border-transparent text-gray-500 hover:text-gray-700' : 'border-indigo-600 text-indigo-700'}">PLC配置</button>
</div>
<div id="mp-panel"></div>
<div id="plc-panel" class="hidden"></div>`
<div id="mp-panel" class="${mpActive ? '' : 'hidden'}"></div>
<div id="plc-panel" class="${mpActive ? 'hidden' : ''}"></div>`
document.getElementById('sub-tab-mp')!.addEventListener('click', () => switchTab('mp'))
document.getElementById('sub-tab-plc')!.addEventListener('click', () => switchTab('plc'))