liuyu
4 小时以前 82a74ba0402ab546ba524d23ce62198c4d00d2f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import type { ArchiveStatus, RecordListMode } from './types';
 
export const ARCHIVE_STATUS_OPTIONS: { id: ArchiveStatus; fullName: string }[] = [
  { id: 'pending', fullName: '待归档' },
  { id: 'ready', fullName: '可归档' },
  { id: 'archived', fullName: '已归档' },
  { id: 'invalid', fullName: '无效' },
];
 
export const LIST_MODE_LABEL: Record<RecordListMode, string> = {
  main: '培训记录',
  ready: '可归档列表',
  archived: '已归档列表',
};
 
/** 各列表页路由 */
export const RECORD_LIST_PATH: Record<RecordListMode, string> = {
  main: '/tms/record',
  ready: '/tms/record/ready',
  archived: '/tms/record/archived',
};
 
export function labelOfArchiveStatus(status?: ArchiveStatus) {
  return ARCHIVE_STATUS_OPTIONS.find((x) => x.id === status)?.fullName || status || '-';
}
 
export function colorOfArchiveStatus(status?: ArchiveStatus) {
  if (status === 'ready') return '#1677ff';
  if (status === 'archived') return '#52c41a';
  if (status === 'invalid') return '#ff4d4f';
  return undefined;
}