update
This commit is contained in:
parent
ef2995cfe1
commit
a8fe4ddc15
@ -16,6 +16,7 @@ namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\task\TaskAllocation;
|
||||
use app\common\model\TaskDetail;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
@ -54,11 +55,20 @@ class TaskDetailLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return TaskDetail::where($this->searchWhere)
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(!empty($params['task_allocation_num'])){
|
||||
$task_allocation_ids = TaskAllocation::where('num','like','%'.$params['task_allocation_num'].'%')->column('id');
|
||||
$where[] = ['task_allocation_id','in',$task_allocation_ids];
|
||||
}
|
||||
return TaskDetail::where($this->searchWhere)->where($where)
|
||||
->with(['taskTypeInfo', 'taskAllocation'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->select()->each(function($data){
|
||||
$task_allocation = TaskAllocation::field('num')->where('id',$data['task_allocation_id'])->findOrEmpty();
|
||||
$data['task_allocation_num'] = $task_allocation['num'];
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
@ -71,7 +81,13 @@ class TaskDetailLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return TaskDetail::where($this->searchWhere)->count();
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(!empty($params['task_allocation_num'])){
|
||||
$task_allocation_ids = TaskAllocation::where('num','like','%'.$params['task_allocation_num'].'%')->column('id');
|
||||
$where[] = ['task_allocation_id','in',$task_allocation_ids];
|
||||
}
|
||||
return TaskDetail::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user