You've already forked DataMate
feat(annotation): 添加标注任务编辑功能
- 新增编辑模式支持,通过 editTask 属性控制 - 添加 getAnnotationTaskByIdUsingGet 和 updateAnnotationTaskByIdUsingPut API 接口 - 实现编辑模式下的任务详情加载和表单填充 - 编辑模式下禁用数据集修改和配置模式切换 - 更新模态框标题为动态显示(创建/编辑) - 在任务列表操作菜单中添加编辑按钮 - 编辑模式下只允许修改标签取值,限制模板结构调整 - 添加任务详情加载状态显示
This commit is contained in:
@@ -3,6 +3,7 @@ import { Card, Button, Table, message, Modal, Tabs } from "antd";
|
||||
import {
|
||||
PlusOutlined,
|
||||
EditOutlined,
|
||||
FormOutlined,
|
||||
DeleteOutlined,
|
||||
DownloadOutlined,
|
||||
} from "@ant-design/icons";
|
||||
@@ -29,6 +30,7 @@ export default function DataAnnotation() {
|
||||
const [viewMode, setViewMode] = useState<"list" | "card">("list");
|
||||
const [showCreateDialog, setShowCreateDialog] = useState(false);
|
||||
const [exportTask, setExportTask] = useState<AnnotationTask | null>(null);
|
||||
const [editTask, setEditTask] = useState<AnnotationTask | null>(null);
|
||||
|
||||
const {
|
||||
loading,
|
||||
@@ -56,6 +58,10 @@ export default function DataAnnotation() {
|
||||
setExportTask(task);
|
||||
};
|
||||
|
||||
const handleEdit = (task: AnnotationTask) => {
|
||||
setEditTask(task);
|
||||
};
|
||||
|
||||
const handleDelete = (task: AnnotationTask) => {
|
||||
Modal.confirm({
|
||||
title: `确认删除标注任务「${task.name}」吗?`,
|
||||
@@ -116,6 +122,12 @@ export default function DataAnnotation() {
|
||||
),
|
||||
onClick: handleAnnotate,
|
||||
},
|
||||
{
|
||||
key: "edit",
|
||||
label: "编辑",
|
||||
icon: <FormOutlined className="w-4 h-4" style={{ color: "#722ed1" }} />,
|
||||
onClick: handleEdit,
|
||||
},
|
||||
{
|
||||
key: "export",
|
||||
label: "导出",
|
||||
@@ -264,9 +276,13 @@ export default function DataAnnotation() {
|
||||
)}
|
||||
|
||||
<CreateAnnotationTask
|
||||
open={showCreateDialog}
|
||||
onClose={() => setShowCreateDialog(false)}
|
||||
open={showCreateDialog || !!editTask}
|
||||
onClose={() => {
|
||||
setShowCreateDialog(false);
|
||||
setEditTask(null);
|
||||
}}
|
||||
onRefresh={() => fetchData()}
|
||||
editTask={editTask}
|
||||
/>
|
||||
|
||||
<ExportAnnotationDialog
|
||||
|
||||
Reference in New Issue
Block a user