Dashboard 规格说明
定义 Dashboard 页面展示新增Overview的两个图表的数据来源和计算方式。
一、Total Tasks(任务状态分布)
数据全部来自 tasks 表。
1.1 顶部展示
1.2 数据来源字段
1.3 每条柱子的 4 个状态
1.4 SQL
每行右侧显示该 type_category 的总数。
二、Impacted Revenue(营收归因表格)
数据来自 tasks 表(close_result 字段)+ 店铺配置(假设价格/系数)。
2.1 顶部展示
2.2 Date Range 选择器
时间基准是
closed_at(关闭时间),不是created_at。营收归因在 task 关闭时确定(close_result写入),因此按关闭时间统计。一个 3 月创建、4 月关闭的 task,算 4 月的营收。时间精度为天。
- Actual:
WHERE closed_at BETWEEN from AND to AND close_result IN (9 个正向)- Expected:
WHERE created_at <= to(所有在该时间范围内创建或之前创建的 task,不限 closed_at)- Leakage:Expected - Actual(包含该时间范围内还没关闭的 pending task)
趋势对比逻辑:自动取与当前选择相同天数的前一个周期对比。
2.3 close_result 枚举(13 个)
2.4 表格列定义
2.5 Expected 计算:type_category → 理想金额
Expected 基于 type_category(11 个)计算,API 层固定映射,不存 DB:
2.6 Actual 计算:close_result → 实际金额
Actual 基于 close_result(9 个正向)计算,只算已关闭 task:
tasks 表没有金额字段,营收金额由 API 层用
close_result查店铺配置实时算出。默认值可在 Rules → Revenue Benchmarks 编辑。
2.7 Leakage 来源
- 还没关闭的 task(pending)— 贡献了 Expected 但没有 Actual
- 关闭了但不是正向结果的 task(
lead_outreached/wrong_number/do_not_contact/other)— Actual = 0 - type_category 与 close_result 不匹配(如
cancellation_risktask 最终close_result = other)
2.8 汇总行
详见 任务与营收归因。