feat: allow department leaders to grab tasks

This commit is contained in:
Your Name 2026-03-30 10:47:58 +08:00
parent 802fc7c75e
commit 4c1c715bfa
3 changed files with 3 additions and 18 deletions

View File

@ -553,12 +553,7 @@ public class TaskItemService {
throw new BusinessException(ResultCode.FORBIDDEN, "只有接单部门成员可以接收任务");
}
// 检查3:部门负责人不能抢单
if (department.getLeaderId() != null && department.getLeaderId().equals(userId)) {
throw new BusinessException(ResultCode.FORBIDDEN, "部门负责人不能接单,请分配给设计师");
}
// 检查4:如果子任务已指定接单部门,则仅允许该部门(含子部门)成员接单
// 检查3:如果子任务已指定接单部门,则仅允许该部门(含子部门)成员接单
if (item.getReceiverDeptId() != null
&& !isDeptMatchedOrInherited(user.getDeptId(), item.getReceiverDeptId())) {
throw new BusinessException(ResultCode.FORBIDDEN, "该任务仅允许指定接单部门成员接单");

View File

@ -2349,12 +2349,7 @@ public class TaskService {
throw new BusinessException(ResultCode.FORBIDDEN, "只有接单部门成员可以接收任务");
}
// 检查3:部门负责人不能抢单
if (department.getLeaderId() != null && department.getLeaderId().equals(userId)) {
throw new BusinessException(ResultCode.FORBIDDEN, "部门负责人不能接单,请分配给设计师");
}
// 检查4:验证部门是否允许接该需求类型
// 检查3:验证部门是否允许接该需求类型
if (task.getDemandTypeId() != null) {
validateAllowedDemandTypes(department, task.getDemandTypeId());
}

View File

@ -6141,12 +6141,7 @@ const canGrabTask = (task: TaskOrSubTask) => {
return { canGrab: false, reason: '需求部门成员不能接单' }
}
// 检查3:部门负责人不能抢单(如果是切换到其他部门视角则允许)
if (currentDeptView.value === undefined && (userInfo.isDepartmentLeader === 1 || userInfo.isDepartmentLeader === true)) {
return { canGrab: false, reason: '部门负责人不能接单' }
}
// 检查4:验证部门是否允许接该需求类型(如果任务有需求类型限制)
// 检查3:验证部门是否允许接该需求类型(如果任务有需求类型限制)
const taskTypeId = task.isSubTask ? task.taskTypeId : (task as any).taskTypeId
if (taskTypeId) {
// 从配置store中获取任务类型详情