111 lines
3.9 KiB
TypeScript
111 lines
3.9 KiB
TypeScript
import {
|
|
BadgeCheck,
|
|
BriefcaseBusiness,
|
|
Clock3,
|
|
PackagePlus,
|
|
TriangleAlert,
|
|
UsersRound,
|
|
type LucideIcon,
|
|
} from 'lucide-react'
|
|
|
|
export type CoreMetricKey =
|
|
| 'ongoing-projects'
|
|
| 'monthly-launches'
|
|
| 'on-time-delivery'
|
|
| 'first-pass-rate'
|
|
| 'team-workload'
|
|
| 'risks'
|
|
|
|
export type CoreMetric = {
|
|
key: CoreMetricKey
|
|
label: string
|
|
exampleValue: string
|
|
exampleNumericValue?: number
|
|
description: string
|
|
icon: LucideIcon
|
|
detailDescription: string
|
|
plannedFields: string[]
|
|
}
|
|
|
|
export const CORE_METRICS: CoreMetric[] = [
|
|
{
|
|
key: 'ongoing-projects',
|
|
label: '进行中项目',
|
|
exampleValue: '42',
|
|
description: '2026 年 4 月 1 日起发起且当前未完结的钉钉流程总量。',
|
|
icon: BriefcaseBusiness,
|
|
detailDescription: '展示 2026 年 4 月 1 日起发起、当前仍在流转中的钉钉审批流程,并按最近更新时间排序。',
|
|
plannedFields: ['流程名称', '当前状态', '发起部门', '待办任务', '发起时间', '最近更新'],
|
|
},
|
|
{
|
|
key: 'monthly-launches',
|
|
label: '本月上新',
|
|
exampleValue: '18/24',
|
|
description: '本月已完结的新品美术设计流程与当前进行中新品美术设计流程的对照。',
|
|
icon: PackagePlus,
|
|
detailDescription: '查看 2026 年 4 月 1 日起发起的新品美术设计流程;分子按本月整条流程完结时间统计,分母为本月已完结与当前进行中流程之和。',
|
|
plannedFields: ['流程编码', '品牌', '发起人', '所在部门', '当前节点', '业务时间'],
|
|
},
|
|
{
|
|
key: 'on-time-delivery',
|
|
label: '按时交付',
|
|
exampleValue: '94.6%',
|
|
exampleNumericValue: 94.6,
|
|
description: '本月未超时审核节点完成流程占本月审核节点完成流程的比例,待计算流程不计入分母。',
|
|
icon: Clock3,
|
|
detailDescription: '查看本月审核节点完成流程的标准时效、实际用时与超时判定;待计算流程不计入分母,美术沿用外部看板规则,内容视频沿用包含排队顺延的外部看板规则。',
|
|
plannedFields: ['流程', '发起人', '计时节点', '标准时效', '实际用时', '判定结果'],
|
|
},
|
|
{
|
|
key: 'first-pass-rate',
|
|
label: '首轮通过',
|
|
exampleValue: '82.3%',
|
|
description: 'V1版审核通过作品数占所有已通过作品数的比例。',
|
|
icon: BadgeCheck,
|
|
detailDescription: '查看作品过稿中每个作品的 V1 审核结果,以及首轮通过率的真实统计口径。',
|
|
plannedFields: ['交付内容', '评审人', '首轮结果', '修改轮次', '评审时间'],
|
|
},
|
|
{
|
|
key: 'team-workload',
|
|
label: '团队负荷',
|
|
exampleValue: '87%',
|
|
description: '当前任务负荷相对可用产能的占比。',
|
|
icon: UsersRound,
|
|
detailDescription: '用于对照团队可用产能、已分配任务与负荷风险。',
|
|
plannedFields: ['团队或人员', '可用产能', '已分配', '负荷率', '风险状态'],
|
|
},
|
|
{
|
|
key: 'risks',
|
|
label: '风险',
|
|
exampleValue: '4项',
|
|
description: '当前需要重点跟进的风险事项数量。',
|
|
icon: TriangleAlert,
|
|
detailDescription: '用于集中查看风险事项、责任人、截止时间与处理进度。',
|
|
plannedFields: ['风险事项', '风险等级', '负责人', '截止时间', '处理状态'],
|
|
},
|
|
]
|
|
|
|
export function getCoreMetric(key: string): CoreMetric | null {
|
|
return CORE_METRICS.find((metric) => metric.key === key) || null
|
|
}
|
|
|
|
export function getCoreMetricHref(key: CoreMetricKey): string {
|
|
return `/workspaces/dashboard/core-metrics/${key}`
|
|
}
|
|
|
|
export function getCoreMetricParams() {
|
|
return CORE_METRICS.map((metric) => ({
|
|
section: 'dashboard',
|
|
item: 'core-metrics',
|
|
metric: metric.key,
|
|
}))
|
|
}
|
|
|
|
export type OnTimeDeliveryBand = 'green' | 'yellow' | 'red'
|
|
|
|
export function getOnTimeDeliveryBand(rate: number): OnTimeDeliveryBand {
|
|
if (rate > 95) return 'green'
|
|
if (rate >= 90) return 'yellow'
|
|
return 'red'
|
|
}
|