From 3086a40b4c35871abead8b810093cd4a9c23ea0a Mon Sep 17 00:00:00 2001 From: lik Date: Tue, 10 Nov 2026 15:51:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(order):=20=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=94=AF=E6=8C=81=E6=9C=AA=E5=88=86=E9=85=8D/?= =?UTF-8?q?=E6=88=91=E7=9A=84=E5=88=86=E6=A0=8F=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/escort_record.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/handler/escort_record.js b/handler/escort_record.js index fac118b..d73d9a5 100644 --- a/handler/escort_record.js +++ b/handler/escort_record.js @@ -462,7 +462,7 @@ class HandlerEscortRecord { try { const { status, userId, appointmentDate, healthProfileId, cancelStatus, includeCancelled, - paymentStatus, payChannel, startDate, endDate, keyword, + paymentStatus, payChannel, startDate, endDate, keyword, scope, } = ctx.request.query; const { page, pageSize } = HandlerEscortRecord.parsePaging(ctx.request.query); const loginUserId = ctx.state.user?._id; @@ -486,11 +486,30 @@ class HandlerEscortRecord { isInternAttendant = isIntern; // 可见范围由身份决定,前端传什么都会被忽略: // 实习 = 未分配 + 被共享;正式 = 未分配 + 本人已接 + 被共享 - attendantVisibility = { - includeUnassigned: true, + // scope 只用于在已授权的可见范围内收窄(pool=未分配 / mine=我的),不扩大范围 + const mineVisibility = { userId: isIntern ? undefined : loginUserId, employeeId: attendantEmployee._id, }; + const scopeValue = String(scope || ""); + if (scopeValue === "pool") { + attendantVisibility = { includeUnassigned: true }; + } else if (scopeValue === "mine") { + attendantVisibility = mineVisibility; + } else { + attendantVisibility = { includeUnassigned: true, ...mineVisibility }; + } + } + + // 管理端订单页同样按「未分配 / 我的」分栏: + // pool=只看未分配,mine=只看指派给当前账号的订单,不传保持全量 + if (mode === "all") { + const scopeValue = String(scope || ""); + if (scopeValue === "pool") { + attendantVisibility = { includeUnassigned: true }; + } else if (scopeValue === "mine") { + attendantId = loginUserId; + } } // status解析成数组