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 -1
View File
@@ -146,7 +146,8 @@
<el-tab-pane label="历史数据" name="history">
<div style="display:flex;justify-content:flex-end;margin-bottom:8px;">
<el-button size="small" type="primary" plain @click="openAddValueDialog">➕ 录入数据</el-button>
<BotSourceTag :updated-at="latestBotValue?.updated_at || ''" :source="latestBotSource" />
<el-button size="small" type="primary" plain @click="openAddValueDialog" style="margin-left:10px;">➕ 录入数据</el-button>
</div>
<v-chart :option="chartOption" autoresize class="full-width-chart" />
<el-table :data="values" size="small" class="data-table">
@@ -359,10 +360,20 @@ import { kpiApi, mapApi, kpiCausalityApi, orgApi, userApi } from '../api/index'
import api from '../api/index'
import { useFormGuard } from '../composables/useFormGuard'
import BotSourceTag from '../components/BotSourceTag.vue'
const route = useRoute()
const kpi = ref<any>(null)
const values = ref<any[]>([])
// ── C区标注:该KPI最近一次Bot回填(source_type=bot 的最新值;无则不显示) ──
const latestBotValue = computed(() => {
const botVals = values.value.filter((v: any) => v.source_type === 'bot' && (v.updated_at || v.source_batch))
if (!botVals.length) return null
return botVals.slice().sort((a: any, b: any) => String(b.updated_at || '').localeCompare(String(a.updated_at || '')))[0]
})
const latestBotSource = computed(() => latestBotValue.value?.source_batch || '')
// ── 人工录入数据 ──
const showAddValue = ref(false)
const addValueSaving = ref(false)