From 5313bb5a898ff931ac85539f3ddb14684dc75221 Mon Sep 17 00:00:00 2001
From: tian <11429339@qq.com>
Date: Fri, 24 Jul 2026 11:55:29 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E5=A4=87=E5=8B=BE=E9=80=89?=
=?UTF-8?q?=E6=94=B9=E7=94=A8AJAX=E6=97=A0=E5=88=B7=E6=96=B0=EF=BC=8C?=
=?UTF-8?q?=E6=B8=85=E7=90=86=E6=8C=89=E9=92=AE=E7=8B=AC=E7=AB=8B=E4=BA=8E?=
=?UTF-8?q?=E6=89=B9=E9=87=8F=E8=A1=A8=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
internal/web/ui/templates/devices.html | 43 +++++++++++++++++++++-----
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/internal/web/ui/templates/devices.html b/internal/web/ui/templates/devices.html
index f22a204..945832d 100644
--- a/internal/web/ui/templates/devices.html
+++ b/internal/web/ui/templates/devices.html
@@ -33,8 +33,7 @@
- {{end}}
-
@@ -158,7 +153,39 @@
}
}
const next = `${url.pathname}${url.searchParams.toString() ? `?${url.searchParams.toString()}` : ''}`;
- window.location.assign(next);
+ history.replaceState(null, '', next);
+ // Toggle batch toolbar visibility without full page reload
+ const toolbar = document.getElementById('batch-config');
+ const checked = document.querySelectorAll('input[type="checkbox"][name="device_id"]:checked');
+ if (toolbar) {
+ toolbar.style.display = checked.length > 0 ? '' : 'none';
+ const countEl = toolbar.querySelector('.batch-toolbar-count');
+ if (countEl) countEl.textContent = `已选 ${checked.length} 台`;
+ }
+ // Show or hide cleanup form based on selected devices' online status
+ const cleanupForm = document.getElementById('cleanup-form');
+ if (cleanupForm) {
+ let allOffline = checked.length > 0;
+ checked.forEach(cb => {
+ const row = cb.closest('tr');
+ if (row) {
+ const statusCell = row.querySelector('td:nth-child(3)');
+ if (statusCell && !statusCell.textContent.includes('离线')) allOffline = false;
+ }
+ });
+ cleanupForm.style.display = allOffline ? '' : 'none';
+ // Update hidden inputs to match selected devices
+ if (allOffline) {
+ cleanupForm.querySelectorAll('input[type="hidden"]').forEach(el => el.remove());
+ checked.forEach(cb => {
+ const input = document.createElement('input');
+ input.type = 'hidden';
+ input.name = 'device_id';
+ input.value = cb.value;
+ cleanupForm.appendChild(input);
+ });
+ }
+ }
};
for (const box of selectedBoxes) {
box.addEventListener('change', syncSelected);