This commit is contained in:
yml
2026-04-08 16:30:42 +08:00
commit 313c036845
131 changed files with 22393 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
export function formatStatusWithRaw(status: string, labelMap: Record<string, string> = {}) {
const normalized = String(status || '').trim()
if (!normalized) {
return '-'
}
const key = normalized.toLowerCase()
const label = labelMap[key]
if (!label || label === normalized) {
return normalized
}
return `${label} (${normalized})`
}
export function formatAuditAction(action: string) {
const labelMap: Record<string, string> = {
admin_user_created: '创建后台用户',
admin_user_role_updated: '修改用户角色',
admin_user_status_updated: '修改用户状态',
admin_user_password_reset: '重置用户密码',
task_release_cdk: '释放任务 CDK',
task_regenerate_claim_link: '重发领取链接',
task_closed: '关闭任务',
task_mark_manual_review: '转人工处理',
inventory_cdk_released: '释放库存 CDK',
inventory_cdk_invalidated: '作废库存 CDK',
webhook_replayed: '重放 Webhook',
}
return formatStatusWithRaw(action, labelMap)
}
export function formatAuditTargetType(targetType: string) {
const labelMap: Record<string, string> = {
admin_user: '后台用户',
task: '交付任务',
cdk: 'CDK 库存',
webhook_event: 'Webhook 事件',
}
return formatStatusWithRaw(targetType, labelMap)
}