feat: 全站默认只看在线——监控页/大屏/待连接池同步过滤离线设备(可切换查看全部);18051 main 旧实例已停止(STF 已删,旧代码无保留意义)

This commit is contained in:
2026-09-01 08:58:21 +08:00
parent ac7997176d
commit 22ba9272bd
4 changed files with 23 additions and 4 deletions
+11 -1
View File
@@ -116,6 +116,9 @@ main{position:relative;z-index:2;height:calc(100vh - 88px);overflow-y:auto;paddi
<header>
<div class="title">设备监控大屏</div>
<div class="stats" id="wall-stats"></div>
<label class="wall-btn" style="display:inline-flex;align-items:center;gap:4px;cursor:pointer">
<input type="checkbox" id="wall-filter-online" checked onchange="refreshStatus()"> 只看在线
</label>
<button class="wall-btn" id="btn-wake-all" onclick="wakeAll()">💡 一键亮屏</button>
<div class="clock"><span id="wall-clock">--:--:--</span><div class="date" id="wall-date"></div></div>
</header>
@@ -203,11 +206,18 @@ async function refreshStatus(){
JSON.stringify(_devices.map(d=>[d.serial,d.present,d.worker_status,d.task_job,d.current_action,d.progress,d.device_name,d.model]));
_devices=devs;
renderStats(devs);
if(changed)renderGrid(devs);
if(changed)renderGrid(visibleDevs(devs));
// 操作弹窗打开时同步刷新其标题状态
if(_ctrlSerial)updateCtrlHead();
}
// 「只看在线」勾选时过滤离线设备(默认勾选)
function visibleDevs(devs){
const onlyOnline=document.getElementById('wall-filter-online')
? document.getElementById('wall-filter-online').checked : true;
return onlyOnline? devs.filter(d=>d.present) : devs;
}
function renderStats(devs){
const online=devs.filter(d=>d.present).length;
const running=devs.filter(d=>['running','connecting'].includes(d.worker_status)).length;