This commit is contained in:
weiz 2024-01-25 09:56:34 +08:00
parent fbc4b19d7a
commit 25cb0a0c43
2 changed files with 13 additions and 3 deletions

View File

@ -58,13 +58,17 @@ class BuildReportDetailLists extends BaseAdminDataLists implements ListsSearchIn
*/
public function lists(): array
{
$params = $this->request->get(['project_id']);
$params = $this->request->get(['project_id','plan_id']);
$where = [];
if(isset($params['project_id']) && $params['project_id'] != 0){
$plan_ids = BuildPlan::where('project_id',$params['project_id'])->column('id');
$report_ids = BuildReport::where('plan_id','in',$plan_ids)->column('id');
$where[] = ['report_id','in',$report_ids];
}
if(isset($params['plan_id']) && $params['plan_id'] != 0){
$report_ids = BuildReport::where('plan_id',$params['plan_id'])->column('id');
$where[] = ['report_id','in',$report_ids];
}
return BuildReportDetail::where($this->searchWhere)->where($where)
->field(['id', 'report_id', 'person_id', 'work_num', 'remark'])
->limit($this->limitOffset, $this->limitLength)
@ -99,13 +103,17 @@ class BuildReportDetailLists extends BaseAdminDataLists implements ListsSearchIn
*/
public function count(): int
{
$params = $this->request->get(['project_id']);
$params = $this->request->get(['project_id','plan_id']);
$where = [];
if(isset($params['project_id']) && $params['project_id'] != 0){
$plan_ids = BuildPlan::where('project_id',$params['project_id'])->column('id');
$report_ids = BuildReport::where('plan_id','in',$plan_ids)->column('id');
$where[] = ['report_id','in',$report_ids];
}
if(isset($params['plan_id']) && $params['plan_id'] != 0){
$report_ids = BuildReport::where('plan_id',$params['plan_id'])->column('id');
$where[] = ['report_id','in',$report_ids];
}
return BuildReportDetail::where($this->searchWhere)->where($where)->count();
}

View File

@ -44,7 +44,9 @@ class BuildReportLists extends BaseAdminDataLists implements ListsSearchInterfac
*/
public function setSearch(): array
{
return [];
return [
'=' => ['plan_id']
];
}