fix: restore primary task detail editing access
This commit is contained in:
parent
650851b10d
commit
0edd74dc0d
@ -963,7 +963,24 @@ public class TaskService {
|
||||
|
||||
// 非管理员只能看到分配给自己的待审核任务
|
||||
if (!isAdmin) {
|
||||
wrapper.eq(Task::getCurrentApproverId, userId);
|
||||
boolean isDemandDeptMember = userService.getUserDepartments(userId).stream()
|
||||
.filter(java.util.Objects::nonNull)
|
||||
.anyMatch(dept -> "demand".equals(dept.getDeptType())
|
||||
&& dept.getStatus() != null && dept.getStatus() == 1
|
||||
&& (dept.getDeleted() == null || dept.getDeleted() == 0));
|
||||
|
||||
if (isDemandDeptMember) {
|
||||
wrapper.and(w -> w
|
||||
.eq(Task::getCurrentApproverId, userId)
|
||||
.or(ow -> ow
|
||||
.eq(Task::getApprovalStatus, "pending_detail_completion")
|
||||
.eq(Task::getIsPrimaryTask, 1)
|
||||
)
|
||||
);
|
||||
log.info("需求部门成员 {} 查询待审核任务,包含一级需求任务待完善明细列表", userId);
|
||||
} else {
|
||||
wrapper.eq(Task::getCurrentApproverId, userId);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据任务类型筛选
|
||||
|
||||
@ -5641,14 +5641,27 @@ const canRejectTask = (task: Task) => {
|
||||
return canApproveTask(task)
|
||||
}
|
||||
|
||||
const isDemandDepartmentMember = () => {
|
||||
const userInfo = currentUserInfo.value || JSON.parse(localStorage.getItem('userInfo') || '{}')
|
||||
const departments = Array.isArray(userInfo.departments) ? userInfo.departments : []
|
||||
|
||||
if (departments.some((dept: any) => dept?.deptType === 'demand')) {
|
||||
return true
|
||||
}
|
||||
|
||||
return userInfo.deptType === 'demand'
|
||||
}
|
||||
|
||||
// 判断是否可以编辑完善任务明细(一级需求部门任务)
|
||||
const canEditDetailTask = (task: Task) => {
|
||||
const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
|
||||
const currentUserId = userInfo.id
|
||||
|
||||
// 只有待完善明细状态的任务,且当前用户是指定的完善人
|
||||
// 一级需求任务在待完善明细状态下,需求部门成员也允许补充任务明细
|
||||
if (task.approvalStatus === 'pending_detail_completion') {
|
||||
return task.currentApproverId === currentUserId || task.detailCompleterId === currentUserId
|
||||
return task.currentApproverId === currentUserId
|
||||
|| task.detailCompleterId === currentUserId
|
||||
|| isDemandDepartmentMember()
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user