This commit is contained in:
chenbo 2024-02-29 17:16:33 +08:00
parent 0830b5d352
commit d68f042298

View File

@ -93,16 +93,17 @@ class CostConsultationReportController extends BaseAdminController
if ($project_name) { if ($project_name) {
$query->where('p.project_name', 'like', '%'.$project_name.'%'); $query->where('p.project_name', 'like', '%'.$project_name.'%');
} }
})->field('p.*')->append(['task_allocation_status', 'task_handling_three_level_review_status', 'data_reception_status']) ->withAttr('task_allocation_status', function ($data, $value){ })->append(['task_allocation_status', 'task_handling_three_level_review_status', 'data_reception_status'])
$count = TaskAllocation::where('cost_project_id', $value['id'])->count(); ->withAttr('task_allocation_status', function ($data, $value){
return $count > 0 ? 1: 0; $count = TaskAllocation::where('cost_project_id', $value['id'])->count();
})->withAttr('task_handling_three_level_review_status', function ($data, $value){ return $count > 0 ? 1: 0;
$count = TaskHandlingThreeLevelReview::where('project_id', $value['id'])->count(); })->withAttr('task_handling_three_level_review_status', function ($data, $value){
return $count > 0 ? 1: 0; $count = TaskHandlingThreeLevelReview::where('project_id', $value['id'])->count();
})->withAttr('data_reception_status', function ($data, $value){ return $count > 0 ? 1: 0;
$count = DataReception::where('project_id', $value['id'])->count(); })->withAttr('data_reception_status', function ($data, $value){
return $count > 0 ? 1: 0; $count = DataReception::where('project_id', $value['id'])->count();
}); return $count > 0 ? 1: 0;
});
$count = $query->count(); $count = $query->count();
$lists = $query->page($page_no, $page_size)->select(); $lists = $query->page($page_no, $page_size)->select();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size')); return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));