- 核心库:dev-task.ts(类型+状态机+进度计算)、task-worklog.ts(工时)、task-category.ts(字典)、work-item.ts(聚合契约) - Store:useDevTaskStore(CRUD+状态流转)、useTaskWorklogStore(工时记录)、useTaskCategoryStore(字典管理) - UI组件:DevTaskTab、DevTaskCreateModal、DevTaskDetailDrawer、DevTaskRow、WorklogPanel、StatusBadge、CategoryChip - 集成:版本详情页"开发任务"Tab、"与我相关"工作台开发任务分组、任务类型管理页 - 设计文档:spec + 实施计划 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import type { DevTask } from './dev-task';
|
|
import type { VersionPlan } from './version-plan';
|
|
import type { Priority } from './derive';
|
|
|
|
export type WorkItemEntityType = 'plan' | 'devTask' | 'testCase' | 'bug';
|
|
|
|
export interface WorkItem {
|
|
entityType: WorkItemEntityType;
|
|
entityId: string;
|
|
title: string;
|
|
status: string;
|
|
isBlocked?: boolean;
|
|
assigneeId: string;
|
|
reviewerId?: string;
|
|
versionId: string;
|
|
versionName?: string;
|
|
priority?: Priority;
|
|
dueDate?: string;
|
|
categoryLabel?: string;
|
|
}
|
|
|
|
export function planToWorkItem(plan: VersionPlan): WorkItem {
|
|
return {
|
|
entityType: 'plan',
|
|
entityId: plan.id,
|
|
title: plan.title,
|
|
status: plan.status,
|
|
assigneeId: plan.owner,
|
|
versionId: plan.versionId,
|
|
dueDate: plan.endTime.slice(0, 10),
|
|
categoryLabel: plan.type === 'research' ? '调研' : plan.type === 'product' ? '产品方案' : 'UI设计',
|
|
};
|
|
}
|
|
|
|
export function devTaskToWorkItem(task: DevTask, versionId: string, categoryLabel?: string): WorkItem {
|
|
return {
|
|
entityType: 'devTask',
|
|
entityId: task.id,
|
|
title: task.title,
|
|
status: task.status,
|
|
isBlocked: task.isBlocked,
|
|
assigneeId: task.assigneeId,
|
|
reviewerId: task.reviewerId,
|
|
versionId,
|
|
priority: task.priority,
|
|
dueDate: task.dueDate,
|
|
categoryLabel,
|
|
};
|
|
}
|