Dashboard — 计算配置

Source of truth: studio-website-monorepo/apps/api/src/routes/v3/dashboard-summary.ts · dashboard-staff.ts last_verified: 2026-06-15

Dashboard 指标来自多个 endpoint,全部按 store_id 隔离。


Performance Tab

KPI 卡片

数据来自 GET /v3/dashboard/summary?storeId=...&period=week|month

指标产品定义SQL 口径状态
Call Volume选定时段内的通话总数COUNT(*) from calls WHERE store_id + time range✅ 已接线
Outbound外呼数COUNT(*) FILTER (WHERE direction = 'Outbound')✅ 已接线
Intros Booked成功的 revenue_impacting 通话数COUNT(*) FILTER (WHERE primary_outcome_result = 'success' AND primary_category = 'revenue_impacting')✅ 已接线
Cancel Saves挽留成功数COUNT(*) FILTER (WHERE primary_outcome_result = 'retained')✅ 已接线
Tasks Closed选定时段内关闭的任务数COUNT(*) FROM tasks WHERE status = 'closed' AND closed_at >= 当期起点✅ 已接线

Intros Booked 口径注意:summary endpoint 用的是 primary_outcome_result = 'success' AND primary_category = 'revenue_impacting',不是按 intro_booking subcategory 筛选。与 multi-store endpoint 的 intro_booking 口径不同。

趋势:当期 vs 上期同长度时段,delta = (当期 - 上期) / 上期 × 100

快捷牵引

牵引数据来源
Lead Follow-upGET /v3/dashboard/overviewleadFunnel 查询
Task QueuetasksWHERE status = 'open' AND due_at < NOW() 计数(逾期未完成任务,对应 multi-store endpoint 的 tasks_overdue;无独立的纯 open 计数端点)
Manager ReviewGET /v3/dashboard/coaching-highlights

Team Tab

数据来自 GET /v3/dashboard/staff?storeId=...&startDate=...&endDate=...

staff_name 分组聚合,只统计 call_state IN ('human_conversation', 'voicemail')staff_name IS NOT NULL 的通话。

指标SQL 口径状态
CallsCOUNT(*) per staff✅ 已接线
Inbound / OutboundFILTER (WHERE direction = 'Inbound'/'Outbound')✅ 已接线
Intro CallsFILTER (WHERE primary_subcategory = 'intro_booking')✅ 已接线
Membership SalesFILTER (WHERE primary_category = 'revenue_impacting' AND primary_subcategory IN ('membership_purchase_related', 'reactivation_purchase') AND primary_outcome_result = 'success')✅ 已接线
Cancellation SavesFILTER (WHERE primary_subcategory = 'membership_cancel' AND primary_outcome_result = 'retained')✅ 已接线
Task Completion Ratetasks 表按 closed_by_staff_name 聚合 closed / total✅ 已接线
Coaching Flag Ratecoaching_worthy / eligible_calls(eligible = duration > 60s + 有 coaching 内容)✅ 已接线
WoW Direction当期 vs 上期 total_calls 对比 → up / down / flat✅ 已接线

Live / Voicemail / No Answer:prototype 的 Team tab 展示这三列。⚠️ 待开发 — 当前 staff endpoint 不返回这三类拆分,且 SQL 过滤了 call_state IN ('human_conversation', 'voicemail')no_answer 不在结果集中。需后端扩展。