diff --git a/internal/web/ui/templates/devices.html b/internal/web/ui/templates/devices.html index 704ef07..3c88644 100644 --- a/internal/web/ui/templates/devices.html +++ b/internal/web/ui/templates/devices.html @@ -47,10 +47,7 @@ {{if $allOffline}} {{end}} - {{$drift := false}}{{range .DeviceRows}}{{if and (gt .TimeDriftSec $.TimeSyncThreshold) (hasString $.SelectedDeviceIDs .Device.DeviceID)}}{{$drift = true}}{{end}}{{end}} - {{if $drift}} - - {{end}} + 下发设备分配 清空选择 @@ -178,6 +175,19 @@ }); cleanupBtn.style.display = allOffline ? '' : 'none'; } + // Show/hide time sync button if any selected device has time drift + const syncBtn = document.getElementById('time-sync-btn'); + if (syncBtn) { + let hasDrift = false; + checked.forEach(cb => { + const row = cb.closest('tr'); + if (row) { + const driftEl = row.querySelector('.pill.bad'); + if (driftEl && driftEl.textContent.includes('偏差')) hasDrift = true; + } + }); + syncBtn.style.display = hasDrift ? '' : 'none'; + } }; for (const box of selectedBoxes) { box.addEventListener('change', syncSelected); diff --git a/safesightd.json b/safesightd.json index 8c21f99..2146aa1 100644 --- a/safesightd.json +++ b/safesightd.json @@ -8,8 +8,10 @@ "data_dir": "data", "db_path": "data/app.db", "log_dir": "data/logs", + "alarm_retention_days": 30, + "company_name": "金航数码有限公司", + "time_sync_threshold_sec": 10, "device_aliases": { "d12a4719c91641df91b76ab271280797": "盒子A" - }, - "alarm_retention_days": 30 -} + } +} \ No newline at end of file