fix: 清理按钮移出嵌套表单,独立提交到正确路由

This commit is contained in:
tian 2026-07-24 11:54:09 +08:00
parent 9b0e1eaa3d
commit b1dc893d8e
2 changed files with 7 additions and 7 deletions

View File

@ -46,16 +46,16 @@
<button type="submit" name="action" value="rollback" class="secondary" {{if .RollbackSummary}}onclick='return confirm("将回滚到上一版运行配置:{{.RollbackSummary}}")'{{end}}>回滚运行配置</button>
<a class="btn secondary" href="{{.BatchConfigURL}}">下发设备分配</a>
<a class="btn secondary" href="/devices">清空选择</a>
{{$allOffline := true}}{{range .SelectedDevices}}{{if .Online}}{{$allOffline = false}}{{end}}{{end}}
{{if $allOffline}}
<form method="post" action="/devices/cleanup-offline" style="display:inline" onsubmit="return confirm('确认清理选中的 ' + {{len .SelectedDevices}} + ' 台离线设备及其全部关联数据?此操作不可恢复。')">
{{range .SelectedDevices}}<input type="hidden" name="device_id" value="{{.DeviceID}}">{{end}}
<button type="submit" class="btn danger">清理选中离线设备</button>
</form>
{{end}}
</div>
</div>
{{end}}
{{$allOffline := true}}{{range .SelectedDevices}}{{if .Online}}{{$allOffline = false}}{{end}}{{end}}
{{if and .SelectedDeviceIDs $allOffline}}
<form method="post" action="/devices/cleanup-offline" style="margin:8px 0" onsubmit="return confirm('确认清理选中的 ' + {{len .SelectedDevices}} + ' 台离线设备及其全部关联数据?此操作不可恢复。')">
{{range .SelectedDevices}}<input type="hidden" name="device_id" value="{{.DeviceID}}">{{end}}
<button type="submit" class="btn danger">清理选中离线设备</button>
</form>
{{end}}
<div class="table-wrap">
<table id="device-list">

Binary file not shown.