docs: 整理项目问题文档,修复审批列表数据混乱
- 新增 PROJECT_ISSUES.md 统一管理所有问题和解决方案 - 精简 CLAUDE.md,移除重复的问题记录部分 - 修复审批列表数据混乱问题(React 18 StrictMode + 状态管理) - 修复首次加载不显示数据问题(requestIdRef 清理时机) - 修复页码初始值错误(hasMore 默认值) - 修复后端响应序列化问题(Eloquent 模型转数组) - 添加审批人和抄送人重复校验 - 修复双 header 问题 - 调整申请页面 padding-bottom Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -183,10 +183,12 @@ class ApprovalService
|
||||
switch ($type) {
|
||||
case 'my':
|
||||
$query->where('applicant_id', $userId);
|
||||
error_log("🔍 Debug 'my' query: userId={$userId}");
|
||||
break;
|
||||
case 'pending':
|
||||
// 获取用户待审批的订单
|
||||
$pendingOrderIds = $this->getPendingOrderIds($userId);
|
||||
error_log("🔍 Debug 'pending' query: userId={$userId}, pendingOrderIds=" . json_encode($pendingOrderIds));
|
||||
$query->whereIn('id', $pendingOrderIds);
|
||||
break;
|
||||
case 'approved':
|
||||
@@ -197,19 +199,43 @@ class ApprovalService
|
||||
->pluck('order_id')
|
||||
->unique()
|
||||
->toArray();
|
||||
error_log("🔍 Debug 'approved' query: userId={$userId}, approvedOrderIds=" . json_encode($approvedOrderIds));
|
||||
$query->whereIn('id', $approvedOrderIds)
|
||||
->whereIn('status', [ApprovalOrder::STATUS_APPROVED, ApprovalOrder::STATUS_REJECTED, ApprovalOrder::STATUS_CANCELLED]);
|
||||
break;
|
||||
}
|
||||
|
||||
$total = $query->count();
|
||||
error_log("🔍 Debug total count: type={$type}, total={$total}");
|
||||
|
||||
$list = $query->orderBy('created_at', 'desc')
|
||||
->offset(($page - 1) * $pageSize)
|
||||
->limit($pageSize)
|
||||
->get();
|
||||
|
||||
error_log("🔍 Debug list count: type={$type}, page={$page}, count=" . $list->count());
|
||||
|
||||
// 转换为数组避免序列化问题
|
||||
$listArray = $list->map(function ($item) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'title' => $item->title,
|
||||
'business_type' => $item->business_type,
|
||||
'status' => $item->status,
|
||||
'created_at' => $item->created_at ? $item->created_at->toDateTimeString() : null,
|
||||
'applicant' => $item->applicant ? [
|
||||
'id' => $item->applicant->id,
|
||||
'name' => $item->applicant->name,
|
||||
] : null,
|
||||
'flow' => $item->flow ? [
|
||||
'id' => $item->flow->id,
|
||||
'name' => $item->flow->name,
|
||||
] : null,
|
||||
];
|
||||
})->toArray();
|
||||
|
||||
return [
|
||||
'list' => $list,
|
||||
'list' => $listArray,
|
||||
'total' => $total,
|
||||
'page' => $page,
|
||||
'page_size' => $pageSize,
|
||||
|
||||
Reference in New Issue
Block a user