feat: 开发任务和测试用例增加批量删除 + 单条删改

- DevTaskTab: 列表行前增加 checkbox,支持全选/批量删除
- DevTaskDetailDrawer: 顶部增加删除按钮(带确认)
- TestCaseTab: 同上,批量删除时校验关联 Bug(有 Bug 不可删)
- TestCaseDetailDrawer: 顶部增加删除按钮(有关联 Bug 时提示不可删)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Script Generator
2026-06-12 15:08:18 +08:00
parent bf229719ad
commit 3fc387eac5
4 changed files with 129 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
'use client';
import { useState } from 'react';
import { X, AlertTriangle, Link2, ChevronRight, Bug as BugIcon } from 'lucide-react';
import { X, AlertTriangle, Link2, ChevronRight, Bug as BugIcon, Trash2 } from 'lucide-react';
import { TestCaseStatusBadge } from './TestCaseStatusBadge';
import { BugStatusBadge } from '@/components/bug/BugStatusBadge';
import { useTestCaseStore } from '@/stores/useTestCaseStore';
@@ -18,7 +18,7 @@ interface Props {
}
export function TestCaseDetailDrawer({ testCaseId, onClose, onCreateBug }: Props) {
const { testCases, changeStatus } = useTestCaseStore();
const { testCases, changeStatus, deleteTestCase } = useTestCaseStore();
const { bugs } = useBugStore();
const { requirements } = useRequirementStore();
@@ -60,7 +60,10 @@ export function TestCaseDetailDrawer({ testCaseId, onClose, onCreateBug }: Props
<span className="text-[12px] font-mono text-[var(--ink-muted)]">{tc.caseNo}</span>
<span className="text-[14px] font-semibold text-[var(--ink)] truncate max-w-[240px]">{tc.title}</span>
</div>
<button onClick={onClose} className="p-1.5 rounded-lg hover:bg-[var(--bg-subtle)]"><X className="h-4 w-4 text-[var(--ink-muted)]" /></button>
<div className="flex items-center gap-1">
<button onClick={() => { if (relatedBugs.length > 0) { alert('该用例有关联 Bug无法删除'); return; } if (confirm('确定删除此测试用例?')) { deleteTestCase(tc.id); onClose(); } }} className="p-1.5 rounded-lg hover:bg-red-50 text-[var(--ink-muted)] hover:text-red-500" title="删除"><Trash2 className="h-4 w-4" /></button>
<button onClick={onClose} className="p-1.5 rounded-lg hover:bg-[var(--bg-subtle)]"><X className="h-4 w-4 text-[var(--ink-muted)]" /></button>
</div>
</div>
<div className="flex-1 overflow-y-auto p-4 space-y-3">