全栈: 接收任务写入remark — 后端receive接口+Body参数+前端接收弹窗备注输入

This commit is contained in:
2026-08-05 16:16:35 +08:00
parent 353633f061
commit 62422e7558
3 changed files with 15 additions and 7 deletions

View File

@ -227,13 +227,14 @@ async def get_all_tasks(
# ============================================================
async def receive_task(
db: AsyncSession, task_id: uuid.UUID, operator_id: str | None = None
db: AsyncSession, task_id: uuid.UUID, operator_id: str | None = None,
remark: str | None = None,
) -> TaskResponse:
"""
操作员确认接收任务。
校验:只有状态为 PENDING 的任务可接收。
动作:状态改为 WIP记录 received_at 为当前时间
动作:状态改为 WIP记录 received_at,写入 remark
"""
task = await _get_task_or_404(db, task_id)
@ -247,12 +248,14 @@ async def receive_task(
now = get_beijing_time()
task.status = TASK_STATUS_WIP
task.received_at = now
if remark:
task.remark = remark
await _create_task_log(
db, task_id,
action_type="receive",
operator_id=operator_id,
remark=f"操作员确认接收任务「{task.task_name}",
remark=remark or f"操作员确认接收任务「{task.task_name}",
)
await db.commit()