This commit is contained in:
weiz 2024-01-09 17:02:02 +08:00
parent 03c6e5f51e
commit a2eea43852

View File

@ -59,7 +59,13 @@ class MaterialPurchaseRequestDetailLists extends BaseAdminDataLists implements L
*/
public function lists(): array
{
return MaterialPurchaseRequestDetail::where($this->searchWhere)
$params = $this->request->get(['project_id']);
$where = [];
if(isset($params['project_id']) && $params['project_id'] != ''){
$material_purchase_request_ids = MaterialPurchaseRequest::where('project_id',$params['project_id'])->column('id');
$where[] = ['material_purchase_request_id','in',$material_purchase_request_ids];
}
return MaterialPurchaseRequestDetail::where($this->searchWhere)->where($where)
->field(['id', 'project_material_budget_detail_id', 'num'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
@ -101,7 +107,13 @@ class MaterialPurchaseRequestDetailLists extends BaseAdminDataLists implements L
*/
public function count(): int
{
return MaterialPurchaseRequestDetail::where($this->searchWhere)->count();
$params = $this->request->get(['project_id']);
$where = [];
if(isset($params['project_id']) && $params['project_id'] != ''){
$material_purchase_request_ids = MaterialPurchaseRequest::where('project_id',$params['project_id'])->column('id');
$where[] = ['material_purchase_request_id','in',$material_purchase_request_ids];
}
return MaterialPurchaseRequestDetail::where($this->searchWhere)->where($where)->count();
}
}