requirements.md 5.4 KB

Requirements Document: Project Management Enhancement

Introduction

本需求文档定义了项目管理界面的增强功能,包括项目状态管理和数据导出功能。这些功能允许管理员在项目完成后标记为已完成,并支持多种格式的数据导出。

Glossary

  • Project: 标注项目,包含多个任务
  • Task: 单个标注任务,属于某个项目
  • Admin: 管理员用户,拥有项目管理权限
  • Export Format: 数据导出格式(JSON、CSV、COCO、YOLO)
  • Project Status: 项目状态(草稿、配置中、待分发、进行中、已完成)
  • Completion Rate: 项目完成率,已完成任务数 / 总任务数

Requirements

Requirement 1: Project Completion Status Update

User Story: As an admin, I want to mark a project as completed when all tasks are done, so that I can track project lifecycle and archive completed work.

Acceptance Criteria

  1. WHEN a project has 100% completion rate AND the admin clicks "标记为已完成" button THEN the system SHALL update the project status to "completed"
  2. WHEN a project status is not 100% complete THEN the system SHALL disable the "标记为已完成" button
  3. WHEN a project is marked as completed THEN the system SHALL record the completion timestamp
  4. WHEN a project status is updated to completed THEN the system SHALL refresh the project list view
  5. IF the status update fails THEN the system SHALL display an error message and keep the previous status

Requirement 2: Project Edit Modal Enhancement

User Story: As an admin, I want to access project completion and data export features from the project detail view, so that I can manage project lifecycle and retrieve results efficiently.

Acceptance Criteria

  1. WHEN the admin opens the project detail modal THEN the system SHALL display two action buttons: "标记为已完成" and "导出数据"
  2. WHEN the admin clicks "标记为已完成" button AND project is 100% complete THEN the system SHALL update project status to completed
  3. WHEN the admin clicks "导出数据" button THEN the system SHALL display an export dialog with format selection
  4. WHEN the export dialog is open THEN the system SHALL show a dropdown menu with export format options (JSON, CSV, COCO, YOLO)
  5. WHEN the admin selects an export format and clicks export THEN the system SHALL initiate the export process

Requirement 3: Data Export Functionality

User Story: As an admin, I want to export project data in multiple formats, so that I can use the annotated data in different downstream systems.

Acceptance Criteria

  1. WHEN the admin selects an export format THEN the system SHALL validate the format is one of: JSON, CSV, COCO, YOLO
  2. WHEN the admin initiates an export THEN the system SHALL call the backend export API with the selected format
  3. WHEN the export is in progress THEN the system SHALL display a loading indicator
  4. WHEN the export completes successfully THEN the system SHALL provide a download link or trigger file download
  5. IF the export fails THEN the system SHALL display an error message with details
  6. WHEN the export dialog is open THEN the system SHALL display export format options with descriptions

Requirement 4: Export Dialog UI

User Story: As an admin, I want a clear interface for selecting export format and initiating export, so that I can easily export data without confusion.

Acceptance Criteria

  1. WHEN the export dialog opens THEN the system SHALL display a dropdown/select menu on the left side for format selection
  2. WHEN the export dialog is displayed THEN the system SHALL show format options: JSON, CSV, COCO, YOLO
  3. WHEN a format is selected THEN the system SHALL display a description of that format
  4. WHEN the admin clicks the export button THEN the system SHALL initiate the export with the selected format
  5. WHEN the export is in progress THEN the system SHALL disable the export button and show loading state
  6. WHEN the export completes THEN the system SHALL close the dialog and show success message

Requirement 5: Backend API for Project Status Update

User Story: As a backend service, I need to support updating project status to completed, so that the frontend can mark projects as finished.

Acceptance Criteria

  1. WHEN the frontend sends a PATCH request to update project status THEN the system SHALL validate the new status is valid
  2. WHEN the new status is "completed" THEN the system SHALL update the project status and record completion timestamp
  3. WHEN the status update is successful THEN the system SHALL return the updated project object
  4. IF the project is not 100% complete THEN the system SHALL reject the status update with appropriate error
  5. IF the user is not an admin THEN the system SHALL return 403 Forbidden error

Requirement 6: Export API Integration

User Story: As a backend service, I need to provide export functionality that the frontend can call, so that project data can be exported in multiple formats.

Acceptance Criteria

  1. WHEN the frontend calls the export API with a format parameter THEN the system SHALL create an export job
  2. WHEN the export job is created THEN the system SHALL return a job ID and status
  3. WHEN the export is complete THEN the system SHALL provide a download URL
  4. WHEN the export fails THEN the system SHALL return an error message
  5. WHEN the frontend polls for export status THEN the system SHALL return current progress and status