2026-05-20 21:39:12 +08:00

58 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Project 模块
created: 2026-04-13
updated: 2026-04-14
type: entity
tags: [module, project, backend, frontend]
sources: [packages/backend/src/modules/project/, packages/frontend/src/modules/project/]
---
# Project 模块
项目管理模块,支持甘特图、日历、看板、列表四种视图,含完整的工时记录系统。
## 后端数据模型5个表
| 表名 | 用途 |
|------|------|
| `project_info` | 项目信息 |
| `project_phase` | 项目阶段 |
| `project_task` | 任务(支持父子关系、优先级、负责人、工时、进度) |
| `project_task_dependency` | 任务依赖关系 |
| `project_time_log` | 工时记录userId/logDate/hours/description |
### project_task 关键字段
`estimatedHours`(decimal 8,1) | `actualHours`(decimal 8,1) | `progress`(0-100) | `color`(自定义颜色) | `status` | `priority` | `category` | `assigneeName` | `startDate` | `endDate` | `parentId`
## 后端 Service 核心方法
| 方法 | 功能 |
|------|------|
| `tree(projectId)` | 任务树(按阶段分组,含子任务层级) |
| `kanban(projectId)` | 看板数据按状态分组todo/inProgress/done/closed |
| `kanbanSort(items)` | 看板排序/状态变更 |
| `cascadeUpdateFields(id, fields)` | 级联更新子任务字段status/priority/category/assigneeName/dates/estimatedHours |
| `hasChildren(id)` | 检查是否有子任务 |
## 前端四视图
| 视图 | 组件 | 依赖库 |
|------|------|--------|
| 甘特图 | `views/components/gantt.vue` | dhtmlx-gantt 9.1.3 |
| 日历 | `views/components/calendar.vue` | FullCalendar 6.1.20 |
| 看板 | `views/components/kanban.vue` | vuedraggable |
| 列表 | `views/components/table.vue` | Element Plus Table |
## 关键组件
- `task-drawer.vue`:任务详情侧抽屉(含工时显示:预估+实际自动计算、进度滑块、工时记录表)
- `phase-manager.vue`:阶段管理弹窗
- `time-log-dialog.vue`:工时记录弹窗(日期、工时、描述,提交后自动更新 actualHours
## 相关页面
- [[project-overview]] — 项目总览
- [[cool-admin-framework]] — 自动 CRUD
- [[database-entity-overview]] — 5 个业务表