feat(order): 订单列表支持未分配/我的分栏筛选
This commit is contained in:
@@ -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解析成数组
|
||||
|
||||
Reference in New Issue
Block a user