From f736cf0c13c61de14b9d6649141c8b3662d7b69f Mon Sep 17 00:00:00 2001 From: duxingchen Date: Wed, 5 Aug 2026 15:37:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20TaskResponse=E8=A1=A5rema?= =?UTF-8?q?rk=E5=AD=97=E6=AE=B5=20+=20=E8=AE=B0=E5=BD=95=E6=8C=89=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=99=8D=E5=BA=8F=E5=8F=96=E6=9C=80=E6=96=B0=E4=B8=80?= =?UTF-8?q?=E6=9D=A1(latestRecord)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/schemas/task.py | 1 + .../pages/scan/components/TaskTreeNode.vue | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/backend/app/schemas/task.py b/backend/app/schemas/task.py index a0e11c8..62d7ba1 100644 --- a/backend/app/schemas/task.py +++ b/backend/app/schemas/task.py @@ -123,6 +123,7 @@ class TaskResponse(BaseModel): status: str notify_parent_on_complete: bool is_rework: bool = False + remark: str | None = None reject_reason: str | None = None received_at: datetime | None = None completed_at: datetime | None = None diff --git a/track-uniapp/src/pages/scan/components/TaskTreeNode.vue b/track-uniapp/src/pages/scan/components/TaskTreeNode.vue index a8df9eb..f66dc3d 100644 --- a/track-uniapp/src/pages/scan/components/TaskTreeNode.vue +++ b/track-uniapp/src/pages/scan/components/TaskTreeNode.vue @@ -51,23 +51,23 @@ - + - {{ formatTime(task.records[0].created_at) }} + {{ formatTime(latestRecord.created_at) }} - ✏️ - 🗑️ + ✏️ + 🗑️ - {{ task.records[0].remark }} - + {{ latestRecord.remark }} + @@ -89,13 +89,17 @@ export default { emits: ["action", "editRecord", "viewRecords"], computed: { canEditRecord() { - // 双重宽松匹配:assignee_id 可能是数字ID或用户名字符串 if (this.task.assignee_id == this.currentUserId) return true; if (this.task.assignee_id == this.currentUsername) return true; if (this.currentUser && this.currentUser.id == this.task.assignee_id) return true; if (this.currentUser && this.currentUser.username == this.task.assignee_id) return true; return false; }, + latestRecord() { + const recs = this.task.records; + if (!recs || !recs.length) return null; + return [...recs].sort((a, b) => new Date(b.created_at) - new Date(a.created_at))[0]; + }, }, methods: { imageUrl(url) {