fix: 修复任务审核弹窗UI对齐和设计师列表权限问题,排查详情信息缺失

1. 前端 TaskHall.vue:
   - 修复接单方式单选框的对齐问题,改为 Flex 布局并排显示且等高
   - 调整样式使其更整齐

2. 后端 UserController.java:
   - getDesignersWithWorkload 方法增加权限控制
   - 如果未传 deptId,非管理员用户强制使用自己的 deptId
   - 修复了其他部门负责人可以看到全公司设计师的问题

3. 后端 TaskApprovalService.java:
   - 在 getPendingApprovalTasks 中添加日志
   - 记录品牌、类目、平台信息填充失败的情况,便于排查数据问题
This commit is contained in:
Your Name 2026-01-03 13:44:23 +08:00
parent 6113bb3b0c
commit 2bd4163328
3 changed files with 27 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.designhub.common.Result;
import com.designhub.entity.User;
import com.designhub.service.UserService;
import com.designhub.util.JwtUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
@ -24,6 +25,7 @@ import java.util.Map;
public class UserController {
private final UserService userService;
private final JwtUtil jwtUtil;
@Operation(summary = "分页查询用户列表")
@GetMapping
@ -129,8 +131,23 @@ public class UserController {
@Operation(summary = "获取设计师列表及工作量", description = "获取部门内的设计师列表,包含每个设计师当前进行中的任务数量")
@GetMapping("/designers-with-workload")
public Result<List<Map<String, Object>>> getDesignersWithWorkload(
@RequestParam(required = false) Long deptId
@RequestParam(required = false) Long deptId,
@RequestHeader("Authorization") String authHeader
) {
// 如果没有传入deptId,则根据当前用户角色判断
if (deptId == null) {
String token = jwtUtil.extractTokenFromHeader(authHeader);
Long userId = jwtUtil.getUserIdFromToken(token);
// 如果不是管理员,强制使用自己的部门ID
if (!userService.isAdminUser(userId)) {
User currentUser = userService.getUserById(userId);
if (currentUser != null) {
deptId = currentUser.getDeptId();
}
}
}
log.info("获取设计师列表及工作量: deptId={}", deptId);
return Result.success(userService.getDesignersWithWorkload(deptId));
}

View File

@ -389,6 +389,8 @@ public class TaskApprovalService {
if (brand != null) {
// Brand实体类中name字段映射到brand_name,使用getName()
task.setBrandName(brand.getName());
} else {
log.warn("任务 {} 品牌ID {} 不存在", task.getId(), task.getBrandId());
}
}
@ -398,6 +400,8 @@ public class TaskApprovalService {
if (category != null) {
// Category实体类中name字段映射到category_name,使用getName()
task.setCategoryName(category.getName());
} else {
log.warn("任务 {} 类目ID {} 不存在", task.getId(), task.getCategoryId());
}
}
@ -407,6 +411,8 @@ public class TaskApprovalService {
if (platform != null) {
// Platform实体类中name字段映射到platform_name,使用getName()
task.setPlatformName(platform.getName());
} else {
log.warn("任务 {} 平台ID {} 不存在", task.getId(), task.getPlatformId());
}
}

View File

@ -1872,14 +1872,14 @@
<div class="section-header" style="margin-bottom: 12px;">
<span class="section-title" style="font-weight: 600; color: #fff;">选择接单方式</span>
</div>
<a-radio-group v-model:value="approveAssignType" class="assign-type-group" style="width: 100%;">
<a-radio value="auto" class="assign-option" style="display: flex; width: 100%; margin-bottom: 12px; padding: 16px; border: 1px solid #303030; border-radius: 8px; background: #141414; align-items: center;">
<a-radio-group v-model:value="approveAssignType" class="assign-type-group" style="width: 100%; display: flex; gap: 12px;">
<a-radio value="auto" class="assign-option" style="flex: 1; display: flex; padding: 16px; border: 1px solid #303030; border-radius: 8px; background: #141414; align-items: center; margin-right: 0;">
<div class="option-content" style="display: inline-flex; flex-direction: column; margin-left: 8px;">
<span class="option-title" style="font-weight: 500; color: #fff; font-size: 14px;">发布到任务大厅</span>
<span class="option-desc" style="font-size: 12px; color: #888; margin-top: 4px;">所有设计师均可抢单</span>
</div>
</a-radio>
<a-radio value="manual" class="assign-option" style="display: flex; width: 100%; padding: 16px; border: 1px solid #303030; border-radius: 8px; background: #141414; align-items: center;">
<a-radio value="manual" class="assign-option" style="flex: 1; display: flex; padding: 16px; border: 1px solid #303030; border-radius: 8px; background: #141414; align-items: center;">
<div class="option-content" style="display: inline-flex; flex-direction: column; margin-left: 8px;">
<span class="option-title" style="font-weight: 500; color: #fff; font-size: 14px;">指定设计师接单</span>
<span class="option-desc" style="font-size: 12px; color: #888; margin-top: 4px;">直接分配给特定设计师</span>