From 62422e75587402b2f01df1fe3ee53a81b670f125 Mon Sep 17 00:00:00 2001 From: duxingchen Date: Wed, 5 Aug 2026 16:16:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E6=A0=88:=20=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=86=99=E5=85=A5remark=20=E2=80=94=20?= =?UTF-8?q?=E5=90=8E=E7=AB=AFreceive=E6=8E=A5=E5=8F=A3+Body=E5=8F=82?= =?UTF-8?q?=E6=95=B0+=E5=89=8D=E7=AB=AF=E6=8E=A5=E6=94=B6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E5=A4=87=E6=B3=A8=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/v1/endpoints/tasks.py | 7 ++++--- backend/app/services/task_service.py | 9 ++++++--- track-uniapp/src/pages/scan/detail.vue | 6 +++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/backend/app/api/v1/endpoints/tasks.py b/backend/app/api/v1/endpoints/tasks.py index 6ffe78e..c98627d 100644 --- a/backend/app/api/v1/endpoints/tasks.py +++ b/backend/app/api/v1/endpoints/tasks.py @@ -1,7 +1,7 @@ """任务 API 端点 — 核心业务:接收、驳回返工、裂变转交、无限嵌套子任务""" from __future__ import annotations import uuid -from fastapi import APIRouter, Depends, Query +from fastapi import APIRouter, Depends, Query, Body from sqlalchemy.ext.asyncio import AsyncSession from app.core.database import get_db @@ -110,16 +110,17 @@ async def complete_task_endpoint( async def receive_task_endpoint( task_id: str, operator_id: str | None = Query(None, description="操作人ID"), + remark: str | None = Body(None, description="接收备注", embed=True), db: AsyncSession = Depends(get_db), ): """ **确认接收任务。** 校验:只有状态为 PENDING 的任务可接收。 - 动作:将状态改为 WIP,记录 received_at 为当前时间。 + 动作:将状态改为 WIP,记录 received_at 为当前时间,写入 remark。 """ return await task_service.receive_task( - db, uuid.UUID(task_id), operator_id + db, uuid.UUID(task_id), operator_id, remark ) diff --git a/backend/app/services/task_service.py b/backend/app/services/task_service.py index 1876611..63a612a 100644 --- a/backend/app/services/task_service.py +++ b/backend/app/services/task_service.py @@ -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() diff --git a/track-uniapp/src/pages/scan/detail.vue b/track-uniapp/src/pages/scan/detail.vue index 70dceb8..164e6fb 100644 --- a/track-uniapp/src/pages/scan/detail.vue +++ b/track-uniapp/src/pages/scan/detail.vue @@ -224,6 +224,7 @@ 确认接收任务 {{ actionPopup.task && actionPopup.task.task_name }} 状态: {{ statusLabel(actionPopup.task && actionPopup.task.status) }} → 进行中 +