fix: narrow pending review groups to actual approver dept

This commit is contained in:
Your Name 2026-03-31 16:47:14 +08:00
parent 765289c102
commit d059481aed
2 changed files with 21 additions and 18 deletions

View File

@ -1845,28 +1845,21 @@ public class TaskItemService {
hasPermission = true;
log.info("管理员模式,有权限");
} else {
// 部门负责人:检查子任务的任务类型配置的 allowed_dept_ids 是否包含该部门
// 部门负责人只应看到真正路由到自己部门负责人审核的子任务组,
// 不能仅因任务类型配置里包含父级/兄弟部门就放行。
List<Long> targetDeptIds = getTargetDeptIdsFromTaskType(item.getTaskTypeId());
log.info("子任务 {} 的目标部门ID列表: {}, 查询的部门ID: {}",
item.getId(), targetDeptIds, receiverDeptId);
if (targetDeptIds.contains(receiverDeptId)) {
hasPermission = true;
log.info("匹配成功(通过任务类型配置)");
}
if (!hasPermission) {
com.designhub.entity.Department approvalDept = resolveReceivingApprovalDeptForItem(item);
if (approvalDept != null && approvalDept.getId().equals(receiverDeptId)) {
com.designhub.entity.Department approvalDept = resolveReceivingApprovalDeptForItem(item);
if (approvalDept != null) {
log.info("子任务 {} 实际审核部门: {} ({})",
item.getId(), approvalDept.getId(), approvalDept.getDeptName());
if (approvalDept.getId().equals(receiverDeptId)) {
hasPermission = true;
log.info("匹配成功(通过子任务接单部门负责人兜底)");
log.info("匹配成功(通过实际审核部门)");
}
}
// 兼容:也检查主任务的 receiver_dept_id
if (!hasPermission && mainTask.getReceiverDeptId() != null
&& mainTask.getReceiverDeptId().equals(receiverDeptId)) {
hasPermission = true;
log.info("匹配成功(通过主任务接单部门)");
}
}
log.info("子任务 {} 权限检查结果: {}", item.getId(), hasPermission);
@ -1980,6 +1973,7 @@ public class TaskItemService {
if (approvalDept != null && approvalDept.getLeaderId() != null) {
com.designhub.entity.User leader = userMapper.selectById(approvalDept.getLeaderId());
if (leader != null) {
groupInfo.put("currentApproverId", leader.getId());
groupInfo.put("currentApproverName", leader.getRealName());
groupInfo.put("currentApproverRole", "receiving_leader");
groupInfo.put("approvalStatus", "pending_receiving_approval");

View File

@ -626,11 +626,19 @@
<!-- 操作按钮 -->
<div class="task-actions">
<template v-if="task._itemType === 'taskGroup'">
<a-button type="primary" size="small" @click="handleApproveTaskGroupFromReview(task)">
<a-button
v-if="canApproveTask(task)"
type="primary"
size="small"
@click="handleApproveTaskGroupFromReview(task)">
<Icon name="check" size="sm" style="margin-right: 4px;" />
审核通过
</a-button>
<a-button danger size="small" @click="handleRejectTaskGroupFromReview(task)">
<a-button
v-if="canRejectTask(task)"
danger
size="small"
@click="handleRejectTaskGroupFromReview(task)">
<Icon name="x" size="sm" style="margin-right: 4px;" />
驳回
</a-button>
@ -5436,6 +5444,7 @@ const loadReviewTasks = async (newFilters?: any) => {
detailCompleterId: group.detailCompleterId,
detailCompleterName: group.detailCompleterName,
// 审核人信息(流程阶段显示)
currentApproverId: group.currentApproverId,
currentApproverName: group.currentApproverName,
currentApproverRole: group.currentApproverRole,
approvalStatus: group.approvalStatus,