feat(management): 驾驶舱KPI环比(prev_kpis+delta)+异常卡带员工名跳详情+列表进详情带筛选

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-10 12:20:28 +08:00
parent be0d6f844e
commit 422a726ee8
7 changed files with 160 additions and 13 deletions
@@ -44,6 +44,7 @@
<ManagementKpiCard
label="活跃客户"
:value="kpis?.active_customers ?? null"
:delta="deltaOf('active_customers')"
unit="人"
:hint="threadsHint"
/>
@@ -52,6 +53,7 @@
<ManagementKpiCard
label="活跃员工"
:value="kpis?.active_employees ?? null"
:delta="deltaOf('active_employees')"
unit="人"
hint="期内有数据天数>0 口径"
/>
@@ -65,6 +67,7 @@
<ManagementKpiCard
label="消息量"
:value="kpis?.msg_total ?? null"
:delta="deltaOf('msg_total')"
unit="条"
hint="1:1口径·与数据看板口径不同"
/>
@@ -209,6 +212,16 @@ watch([channel, start, end, compare], load, { immediate: true })
const kpis = computed(() => resp.value?.kpis ?? null)
const actions = computed(() => resp.value?.action_summary ?? null)
// 三 KPI 卡环比(批次D):客户端统一按 (cur-prev)/prev 自 prev_kpis 计算
// (数据同载荷都在;后端 msg_delta 备用未用)。prev_kpis 缺失(旧缓存
// 响应)或 prev=0(前窗无数据)→ null 不显示
function deltaOf(key: 'active_customers' | 'active_employees' | 'msg_total'): number | null {
const k = resp.value?.kpis
const p = resp.value?.prev_kpis
if (!k || !p || !p[key]) return null
return (k[key] - p[key]) / p[key]
}
// 活跃客户辅助行:串/被回(口径与 KPI 同载荷,管理域跨日精确串)
const threadsHint = computed(() => {
const k = kpis.value