feat: 调度表单重构、登录门控、批量任务与页面缓存对齐
调度页执行周期可视化/单次执行/分类选机/推送源对齐;登录 IP 门控与无缝导航; 服务器批量后台任务、执行记录、凭据合并、各页激活刷新与错误提示修复。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -94,12 +94,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { usePageActivateRefresh } from '@/composables/usePageActivateRefresh'
|
||||
import { http } from '@/api'
|
||||
import { useSnackbar } from '@/composables/useSnackbar'
|
||||
import type { PaginatedResponse, AlertLogItem, AlertStatsResponse } from '@/types/api'
|
||||
import { headersWithoutSort } from '@/constants/dataTable'
|
||||
|
||||
defineOptions({ name: 'AlertsPage' })
|
||||
|
||||
const snackbar = useSnackbar()
|
||||
|
||||
// ── State ──
|
||||
@@ -148,8 +151,8 @@ async function loadStats() {
|
||||
} catch { snackbar('加载统计失败', 'error') }
|
||||
}
|
||||
|
||||
async function loadAlerts() {
|
||||
loading.value = true
|
||||
async function loadAlerts(silent = false) {
|
||||
if (!silent) loading.value = true
|
||||
try {
|
||||
const res = await http.get<PaginatedResponse<AlertLogItem>>('/alert-history/', {
|
||||
page: page.value,
|
||||
@@ -160,7 +163,7 @@ async function loadAlerts() {
|
||||
alerts.value = res.items || []
|
||||
total.value = res.total || 0
|
||||
} catch { alerts.value = [] }
|
||||
finally { loading.value = false }
|
||||
finally { if (!silent) loading.value = false }
|
||||
}
|
||||
|
||||
// ── Helpers ──
|
||||
@@ -178,8 +181,9 @@ function typeIcon(t: string) {
|
||||
return 'mdi-lan-disconnect'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadStats()
|
||||
loadAlerts()
|
||||
})
|
||||
async function refreshAlertsPage(silent = false) {
|
||||
await Promise.all([loadStats(), loadAlerts(silent)])
|
||||
}
|
||||
|
||||
usePageActivateRefresh((silent) => refreshAlertsPage(silent))
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user