增加任务执行状态

Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
vilson 2020-03-04 10:42:51 +08:00
parent 893449ab6c
commit cec4cf5024
2 changed files with 8 additions and 4 deletions

View File

@ -34,7 +34,7 @@ class TaskStages extends CommonModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function tasks($stageCode, $deleted = 0, $done = -1, $title = '', $pri = [], $executor = [], $creator = [], $joiner = [], $endTime = [], $beginTime = [], $createTime = [], $doneTime = [])
public function tasks($stageCode, $deleted = 0, $done = -1, $title = '', $pri = [], $executor = [], $creator = [], $joiner = [], $status = [], $endTime = [], $beginTime = [], $createTime = [], $doneTime = [])
{
$where = ['pcode' => '', 'deleted' => $deleted];
if ($done != -1) {
@ -43,7 +43,7 @@ class TaskStages extends CommonModel
$taskModel = Task::alias('t')->where($where);
if (is_array($stageCode)) {
$taskModel = $taskModel->whereIn('t.stage_code', $stageCode);
}else{
} else {
$taskModel = $taskModel->where('t.stage_code', $stageCode);
}
if ($title) {
@ -52,6 +52,9 @@ class TaskStages extends CommonModel
if ($pri) {
$taskModel = $taskModel->whereIn('t.pri', $pri);
}
if ($status) {
$taskModel = $taskModel->whereIn('t.status', $status);
}
if ($endTime) {
$taskModel = $taskModel->whereBetween('t.end_time', implode(',', $endTime));
}
@ -62,7 +65,7 @@ class TaskStages extends CommonModel
$taskModel = $taskModel->whereBetween('t.create_time', implode(',', $createTime));
}
if ($doneTime) {
$taskModel = $taskModel->leftJoin('project_log pl', 't.code = pl.source_code')->where(['pl.action_type'=> 'task', 'pl.type' => 'done'])->whereBetween('pl.create_time', $doneTime);
$taskModel = $taskModel->leftJoin('project_log pl', 't.code = pl.source_code')->where(['pl.action_type' => 'task', 'pl.type' => 'done'])->whereBetween('pl.create_time', $doneTime);
}
//todo 查询范围问题
$joinTaskMember = false;

View File

@ -69,6 +69,7 @@ class TaskStages extends BasicApi
$done = Request::param('done', -1);
$title = Request::param('title', '');
$pri = json_decode(Request::post('pri', ''));
$status = json_decode(Request::post('status', ''));
$stage = json_decode(Request::post('stage', ''));
$executor = json_decode(Request::post('executor', ''));
$creator = json_decode(Request::post('creator', ''));
@ -81,7 +82,7 @@ class TaskStages extends BasicApi
$this->error("数据解析异常");
}
$where[] = ['stage_code', '=', $code];
$list = $this->model->tasks($code, 0, $done, $title, $pri, $executor, $creator, $joiner, $endTime, $beginTime, $createTime, $doneTime);
$list = $this->model->tasks($code, 0, $done, $title, $pri, $executor, $creator, $joiner, $status, $endTime, $beginTime, $createTime, $doneTime);
// $list = \app\common\Model\Task::alias('t')->join('member m','t.assign_to = m.code')->field()->where(['stage_code'=>$code])->select();
$this->success('', $list);