feat(版本详情): 完善任务流程与风险预警

This commit is contained in:
Script Generator
2026-06-29 18:14:22 +08:00
parent b48a7e2049
commit b7d48f66aa
24 changed files with 3085 additions and 118 deletions

View File

@@ -152,6 +152,10 @@ export function TestCaseTab({ versionId, requirementIds }: Props) {
const requirementMap = useMemo(() => new Map(requirements.map((r) => [r.id, r])), [requirements]);
const categoryMap = useMemo(() => new Map(categories.map((c) => [c.id, c])), [categories]);
const categoryLabelWidthEm = useMemo(
() => Math.max(4, ...categories.map((category) => category.name.length)) + 1,
[categories],
);
const bugCountByCase = useMemo(() => {
const map = new Map<string, number>();
for (const b of versionBugs) map.set(b.testCaseId, (map.get(b.testCaseId) ?? 0) + 1);
@@ -230,21 +234,19 @@ export function TestCaseTab({ versionId, requirementIds }: Props) {
<div className="pl-4 flex items-center">
<input type="checkbox" checked={cases.every((c) => selectedIds.has(c.id))} onChange={() => { const ids = cases.map((c) => c.id); const allSel = ids.every((id) => selectedIds.has(id)); const next = new Set(selectedIds); if (allSel) ids.forEach((id) => next.delete(id)); else ids.forEach((id) => next.add(id)); setSelectedIds(next); }} className="h-3.5 w-3.5 rounded border-[var(--line)]" />
</div>
<div className="flex flex-1 min-w-0 items-center gap-3 px-4 py-2">
<div className="flex flex-1 min-w-0 items-center gap-2 px-4 py-2">
<span className="h-2 w-2 shrink-0" />
<span className="w-14 min-w-0 shrink-0 truncate text-[11px] font-mono text-[var(--ink-muted)]" title={req?.code || '通用'}>{req?.code || '通用'}</span>
{deliveryStatus ? (
<span className={`inline-flex h-5 w-24 shrink-0 items-center justify-center rounded px-1.5 text-[10px] font-medium whitespace-nowrap ${
<span className="text-[12px] font-medium text-[var(--ink)] flex-1 truncate">{req?.title || '未关联需求'}</span>
{deliveryStatus && (
<span className={`inline-flex h-5 w-14 shrink-0 items-center justify-center rounded px-1.5 text-[10px] font-medium whitespace-nowrap ${
deliveryStatus === 'submitted'
? 'bg-emerald-50 text-emerald-600 border border-emerald-100'
: 'bg-orange-50 text-orange-600 border border-orange-100'
}`}>
{deliveryStatus === 'submitted' ? '已提测' : '待提测'}
</span>
) : (
<span className="h-5 w-24 shrink-0" />
)}
<span className="text-[12px] font-medium text-[var(--ink)] flex-1 truncate">{req?.title || '未关联需求'}</span>
<span className="text-[11px] text-[var(--ink-muted)]">{reqPassed}/{cases.length} </span>
</div>
</div>
@@ -254,7 +256,7 @@ export function TestCaseTab({ versionId, requirementIds }: Props) {
<input type="checkbox" checked={selectedIds.has(c.id)} onChange={() => toggleSelect(c.id)} className="h-3.5 w-3.5 rounded border-[var(--line)]" onClick={(e) => e.stopPropagation()} />
</div>
<div className="flex-1 min-w-0">
<TestCaseRow testCase={c} category={categoryMap.get(c.categoryId)} bugCount={bugCountByCase.get(c.id) ?? 0} onClick={() => setSelectedCaseId(c.id)} />
<TestCaseRow testCase={c} category={categoryMap.get(c.categoryId)} categoryLabelWidthEm={categoryLabelWidthEm} bugCount={bugCountByCase.get(c.id) ?? 0} onClick={() => setSelectedCaseId(c.id)} />
</div>
</div>
))}