feat: 定时执行工单 — 新建工单+自动任务管理全面重构

后端:
- Ticket 模型新增 scheduled_at 字段 (DateTime, nullable)
- TicketStatus 新增 SCHEDULED 状态
- 状态转换图: approved→scheduled, scheduled→executing/approved
- execute_ticket: scheduled_at 在未来时进入 scheduled 状态
- ticket_scheduler.py: asyncio 后台定时执行器
- GET /tickets/scheduled/list: 列出定时执行中工单
- POST /tickets/{id}/cancel-schedule: 取消定时执行

前端:
- TicketCreatePage: 新增定时执行 checkbox + datetime-local picker (秒级精度)
- AutoTaskPage: 全面重写为真实定时任务管理页
  - 实时倒计时显示 (Xh Xm 后执行)
  - DB 类型图标 (MySQL/PG/Redis/MongoDB)
  - SQL 预览 + 取消定时执行
  - 每 30 秒自动刷新
This commit is contained in:
logan committed 2026-05-25 00:02:21 +08:00
1 parent 478e663313
commit ffb3d24e2a
6 files changed
+418 -262

No files matched your search

+1
View File
@@ -24,4 +24,5 @@ class Ticket(Base):
create_time = Column(DateTime, server_default=func.now())
review_time = Column(DateTime, nullable=True)
execute_time = Column(DateTime, nullable=True)
scheduled_at = Column(DateTime, nullable=True, comment="定时执行时间,NULL=立即执行")
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())