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
+14
View File
@@ -7,6 +7,7 @@
<el-tag type="warning" size="small" effect="plain">2026年7月</el-tag>
</div>
<div class="header-right">
<BotSourceTag :updated-at="latestBotUpdate?.time || ''" :source="latestBotUpdate?.source || ''" :batch="latestBotUpdate?.batch || ''" style="margin-right:10px;" />
<el-button size="small" @click="refresh" :loading="loading">刷新</el-button>
</div>
</div>
@@ -163,6 +164,7 @@
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import { botKpiApi } from '../api/index'
import BotSourceTag from '../components/BotSourceTag.vue'
import { DataBoard, WarningFilled, User } from '@element-plus/icons-vue'
const loading = ref(false)
@@ -193,6 +195,18 @@ const alertsInfo = computed(() => {
return cnt > 0 ? `🚨 ${cnt} 个KPI需要关注` : '✅ 一切正常'
})
// ── C区标注:Bot KPI看板数据最近一次更新(取各KPI最新值回填时间中的最大值,无则不显示) ──
const latestBotUpdate = computed(() => {
const rows = kpis.value.filter((k: any) => k.value_updated_at)
if (!rows.length) return null
const row = rows.slice().sort((a: any, b: any) => String(b.value_updated_at).localeCompare(String(a.value_updated_at)))[0]
return {
time: row.value_updated_at || '',
source: row.value_source_batch || 'finance-bot',
batch: row.value_source_batch || '',
}
})
function formatVal(val: any, unit: string) {
if (val == null) return '-'
if (unit === '%') return val + '%'