export type CategoryGroup = 'development' | 'implementation' | 'other'; export interface TaskCategory { id: string; name: string; group: CategoryGroup; color?: string; sortOrder: number; isSystem: boolean; } export const CATEGORY_GROUP_LABEL: Record = { development: '开发', implementation: '实施', other: '其他', }; export const PRESET_CATEGORIES: TaskCategory[] = [ { id: 'cat-1', name: '前端开发', group: 'development', color: '#3b82f6', sortOrder: 1, isSystem: true }, { id: 'cat-2', name: '后端开发', group: 'development', color: '#6366f1', sortOrder: 2, isSystem: true }, { id: 'cat-3', name: '数据库设计', group: 'development', color: '#8b5cf6', sortOrder: 3, isSystem: true }, { id: 'cat-4', name: '接口联调', group: 'development', color: '#0ea5e9', sortOrder: 4, isSystem: true }, { id: 'cat-5', name: '数据处理', group: 'implementation', color: '#f59e0b', sortOrder: 5, isSystem: true }, { id: 'cat-6', name: '实施支持', group: 'implementation', color: '#10b981', sortOrder: 6, isSystem: true }, ]; export function getCategoryById(categories: TaskCategory[], id: string): TaskCategory | undefined { return categories.find((c) => c.id === id); } export function getCategoriesByGroup(categories: TaskCategory[], group: CategoryGroup): TaskCategory[] { return categories.filter((c) => c.group === group).sort((a, b) => a.sortOrder - b.sortOrder); }