feat(zone): 三区标记M3——新增BotSourceTag组件(最近Bot更新时间/来源/批次,缺失隐藏),接入/kpis/:id、/bot-kpis、/alerts三页 (three-zone P0-①)

This commit is contained in:
Hermes CI Fix
2026-09-03 17:52:10 +08:00
parent 4c01f2bf21
commit 92873456ab
4 changed files with 83 additions and 1 deletions
+12
View File
@@ -9,6 +9,10 @@
</div>
</div>
<div style="margin:0 0 8px;display:flex;justify-content:flex-end;">
<BotSourceTag :updated-at="latestAlertTime" source="预警引擎" />
</div>
<!-- 顶部选项卡 -->
<div style="margin:12px 0;display:flex;gap:12px;align-items:center;">
<el-radio-group v-model="activeTab" size="small">
@@ -342,6 +346,7 @@ import { ref, computed, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import { alertApi, userApi, actionPlanApi, kpiApi, alertRulesApi } from '../api/index'
import BotSourceTag from '../components/BotSourceTag.vue'
import RiskCell from '../components/charts/RiskCell.vue'
const route = useRoute()
@@ -398,6 +403,13 @@ function isTrendAlert(msg: string): boolean {
return msg?.startsWith('[趋势') || msg?.startsWith('[动态')
}
// ── C区标注:预警数据由预警引擎(定时规则)自动生成,展示最近生成时间(无预警行则不显示) ──
const latestAlertTime = computed(() => {
const times = alerts.value.map((a: any) => a.created_at || '').filter(Boolean)
if (!times.length) return ''
return formatTime(times.sort((x: string, y: string) => y.localeCompare(x))[0])
})
function formatTime(t: string): string {
if (!t) return '-'
try { return new Date(t).toLocaleString('zh-CN', { hour12: false }) } catch { return t }