|
@@ -8,6 +8,8 @@ use App\Http\Logic\Aside\Task\TaskLogic; |
|
@@ -8,6 +8,8 @@ use App\Http\Logic\Aside\Task\TaskLogic; |
|
8
|
use App\Http\Logic\Aside\Task\TaskOwnerLogic;
|
8
|
use App\Http\Logic\Aside\Task\TaskOwnerLogic;
|
|
9
|
use App\Http\Requests\Aside\Task\TaskFollowRequest;
|
9
|
use App\Http\Requests\Aside\Task\TaskFollowRequest;
|
|
10
|
use App\Http\Requests\Aside\Task\TaskRequest;
|
10
|
use App\Http\Requests\Aside\Task\TaskRequest;
|
|
|
|
11
|
+use App\Models\Manage\Manage;
|
|
|
|
12
|
+use App\Models\Project\Project;
|
|
11
|
use App\Models\Task\Task;
|
13
|
use App\Models\Task\Task;
|
|
12
|
use App\Models\Task\TaskOwner;
|
14
|
use App\Models\Task\TaskOwner;
|
|
13
|
use Illuminate\Http\Request;
|
15
|
use Illuminate\Http\Request;
|
|
@@ -27,15 +29,24 @@ class TaskController extends BaseController |
|
@@ -27,15 +29,24 @@ class TaskController extends BaseController |
|
27
|
public function list(TaskLogic $logic)
|
29
|
public function list(TaskLogic $logic)
|
|
28
|
{
|
30
|
{
|
|
29
|
$map = [];
|
31
|
$map = [];
|
|
30
|
- if(!empty($this->param['search'])){
|
|
|
|
31
|
- $map[] = ['content', 'like', "%{$this->param['search']}%"];
|
32
|
+ if(!empty($this->param['search']) && !empty($this->param['search_type'])){
|
|
|
|
33
|
+ if($this->param['search_type'] == 'project'){
|
|
|
|
34
|
+ $map[] = ['project_id', 'in', Project::where('title', 'like', "%{$this->param['search']}%")->pluck('id')->toarray()];
|
|
|
|
35
|
+ }else{
|
|
|
|
36
|
+ $map[] = [$this->param['search_type'], 'like', "%{$this->param['search']}%"];
|
|
32
|
}
|
37
|
}
|
|
33
|
- if(!empty($this->param['created_manage_id'])){
|
|
|
|
34
|
- $map[] = ['created_manage_id', $this->param['created_manage_id']];
|
|
|
|
35
|
}
|
38
|
}
|
|
36
|
- if(!empty($this->param['owner_manage_id'])){
|
39
|
+ if(!empty($this->param['dep_id'])){
|
|
|
|
40
|
+ $manage_ids = Manage::where('dept_id', $this->param['dep_id'])->pluck('id')->toArray();
|
|
|
|
41
|
+ $map[] = ['id', 'in', TaskOwner::whereIn('manage_id',$manage_ids)->pluck('task_id')->toArray()];
|
|
|
|
42
|
+ }
|
|
|
|
43
|
+ if(!empty($this->param['created_manage_id']) && !empty($this->param['type'])){
|
|
|
|
44
|
+ if($this->param['type'] == 1){
|
|
|
|
45
|
+ $map[] = ['created_manage_id', $this->param['created_manage_id']];
|
|
|
|
46
|
+ }else{
|
|
37
|
$map[] = ['id', 'in', TaskOwner::where('manage_id', $this->param['owner_manage_id'])->pluck('task_id')->toArray()];
|
47
|
$map[] = ['id', 'in', TaskOwner::where('manage_id', $this->param['owner_manage_id'])->pluck('task_id')->toArray()];
|
|
38
|
}
|
48
|
}
|
|
|
|
49
|
+ }
|
|
39
|
|
50
|
|
|
40
|
$sort = ['id' => 'desc'];
|
51
|
$sort = ['id' => 'desc'];
|
|
41
|
$data = $logic->getList($map, $sort, ['id', 'project_id', 'workload', 'priority', 'content', 'attachment', 'status', 'end_at', 'created_manage_id']);
|
52
|
$data = $logic->getList($map, $sort, ['id', 'project_id', 'workload', 'priority', 'content', 'attachment', 'status', 'end_at', 'created_manage_id']);
|