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
- WHEN a project has 100% completion rate AND the admin clicks "标记为已完成" button THEN the system SHALL update the project status to "completed"
- WHEN a project status is not 100% complete THEN the system SHALL disable the "标记为已完成" button
- WHEN a project is marked as completed THEN the system SHALL record the completion timestamp
- WHEN a project status is updated to completed THEN the system SHALL refresh the project list view
- 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
- WHEN the admin opens the project detail modal THEN the system SHALL display two action buttons: "标记为已完成" and "导出数据"
- WHEN the admin clicks "标记为已完成" button AND project is 100% complete THEN the system SHALL update project status to completed
- WHEN the admin clicks "导出数据" button THEN the system SHALL display an export dialog with format selection
- WHEN the export dialog is open THEN the system SHALL show a dropdown menu with export format options (JSON, CSV, COCO, YOLO)
- 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
- WHEN the admin selects an export format THEN the system SHALL validate the format is one of: JSON, CSV, COCO, YOLO
- WHEN the admin initiates an export THEN the system SHALL call the backend export API with the selected format
- WHEN the export is in progress THEN the system SHALL display a loading indicator
- WHEN the export completes successfully THEN the system SHALL provide a download link or trigger file download
- IF the export fails THEN the system SHALL display an error message with details
- 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
- WHEN the export dialog opens THEN the system SHALL display a dropdown/select menu on the left side for format selection
- WHEN the export dialog is displayed THEN the system SHALL show format options: JSON, CSV, COCO, YOLO
- WHEN a format is selected THEN the system SHALL display a description of that format
- WHEN the admin clicks the export button THEN the system SHALL initiate the export with the selected format
- WHEN the export is in progress THEN the system SHALL disable the export button and show loading state
- 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
- WHEN the frontend sends a PATCH request to update project status THEN the system SHALL validate the new status is valid
- WHEN the new status is "completed" THEN the system SHALL update the project status and record completion timestamp
- WHEN the status update is successful THEN the system SHALL return the updated project object
- IF the project is not 100% complete THEN the system SHALL reject the status update with appropriate error
- 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
- WHEN the frontend calls the export API with a format parameter THEN the system SHALL create an export job
- WHEN the export job is created THEN the system SHALL return a job ID and status
- WHEN the export is complete THEN the system SHALL provide a download URL
- WHEN the export fails THEN the system SHALL return an error message
- WHEN the frontend polls for export status THEN the system SHALL return current progress and status