export const API_OP_LOG_PLATFORM_OPTIONS = [ { label: '后台', value: 0 }, { label: '用户移动端', value: 1 }, { label: '医生移动端', value: 2 }, { label: '互医内部接口', value: 3 }, ] as const; export function getApiOpLogPlatformLabel( platformType: number | string | null | undefined, ): string { const value = Number(platformType); const found = API_OP_LOG_PLATFORM_OPTIONS.find((item) => item.value === value); return found?.label ?? '历史/未知'; } export function getApiOpLogOperatorLabel(row: { platform_type?: number; admin?: { nick_name?: string }; user?: { nickname?: string }; }): string { const type = row.platform_type; if (type === 3) { return '互医中转'; } if (type === 2) { return row?.user?.nickname || row?.admin?.nick_name || '-'; } if (type === 1) { return row?.user?.nickname || '获取失败'; } if (type === 0) { return row?.admin?.nick_name || '获取失败'; } return row?.admin?.nick_name || row?.user?.nickname || '-'; }