feat(开发任务): 状态流转接入单条工作流

This commit is contained in:
Script Generator
2026-06-25 14:04:45 +08:00
parent 168c748835
commit 52833d81ac
6 changed files with 187 additions and 109 deletions

View File

@@ -57,6 +57,7 @@ export function DevTaskCreateModal({ versionId, requirementIds, versionDeadline,
const [predecessorIds, setPredecessorIds] = useState<string[]>([]);
const [description, setDescription] = useState('');
const [overdueVersionReason, setOverdueVersionReason] = useState('');
const [prototypeNotes, setPrototypeNotes] = useState('');
useEffect(() => {
if (categories[0] && !categoryId) setCategoryId(categories[0].id);
@@ -95,6 +96,15 @@ export function DevTaskCreateModal({ versionId, requirementIds, versionDeadline,
const handleSubmit = () => {
if (!canSubmit) return;
const reqRef = versionReqs.find((r) => r.id === requirementId);
const references = [
...(reqRef ? [{ type: 'requirement' as const, id: reqRef.code, label: `${reqRef.code} ${reqRef.title}` }] : []),
...prototypeNotes.split(/[,\s]+/).map((s) => s.trim()).filter(Boolean).map((note) => ({
type: 'prototype_note' as const,
id: note,
label: note,
})),
];
createTask({
requirementId,
title: title.trim(),
@@ -105,6 +115,7 @@ export function DevTaskCreateModal({ versionId, requirementIds, versionDeadline,
priority: effectivePriority,
expectedStartAt: expectedStartISO,
expectedEndAt: expectedEndISO,
estimateHours,
actualStartAt: undefined,
actualEndAt: undefined,
status: 'todo',
@@ -114,6 +125,7 @@ export function DevTaskCreateModal({ versionId, requirementIds, versionDeadline,
riskLevel: undefined,
delayReason: undefined,
overdueVersionReason: isOverdueVersion ? overdueVersionReason.trim() : undefined,
references: references.length > 0 ? references : undefined,
createdBy: user?.name || '系统',
});
onCreated?.();
@@ -212,6 +224,11 @@ export function DevTaskCreateModal({ versionId, requirementIds, versionDeadline,
<label className="block text-[12px] text-[var(--ink-soft)] mb-1"></label>
<textarea rows={3} value={description} onChange={(e) => setDescription(e.target.value)} className="w-full rounded-lg border border-[var(--line)] bg-[var(--bg)] px-3 py-2 text-[13px] focus:border-[var(--accent)] focus:outline-none resize-none" placeholder="任务描述(可选)" />
</div>
<div>
<label className="block text-[12px] text-[var(--ink-soft)] mb-1"></label>
<input value={prototypeNotes} onChange={(e) => setPrototypeNotes(e.target.value)} className="h-8 w-full rounded-lg border border-[var(--line)] bg-[var(--bg)] px-3 text-[13px] focus:border-[var(--accent)] focus:outline-none" placeholder="如 QY0007, QY0023" />
<p className="mt-1 text-[11px] text-[var(--ink-muted)]"></p>
</div>
</div>
<div className="flex justify-end gap-2 pt-4 border-t border-[var(--line)] mt-4">
<button onClick={onClose} className="h-8 px-3 rounded-lg text-[12px] font-medium border border-[var(--line)] text-[var(--ink-soft)] hover:bg-[var(--bg-subtle)]"></button>