diff --git a/app/Http/Controllers/Api/ProjectController.php b/app/Http/Controllers/Api/ProjectController.php index debee3174..7abf59c96 100755 --- a/app/Http/Controllers/Api/ProjectController.php +++ b/app/Http/Controllers/Api/ProjectController.php @@ -2340,6 +2340,7 @@ public function task__move() $flow_item_id = intval(Request::input('flow_item_id')); $owner = Request::input('owner', []); $assist = Request::input('assist', []); + $completeAt = trim(Request::input('complete_at', '')); // $task = ProjectTask::userTask($task_id); // @@ -2360,9 +2361,13 @@ public function task__move() if (empty($flowItem)) { return Base::retError('任务状态不存在'); } + } else if (!$flow_item_id && !$completeAt) { + if (projectFlowItem::whereProjectId($project->id)->count() > 0) { + return Base::retError('请选择移动后状态', [], 102); + } } // - $task->moveTask($project_id, $column_id, $flow_item_id, $owner, $assist); + $task->moveTask($project_id, $column_id, $flow_item_id, $owner, $assist, $completeAt); // $task = ProjectTask::userTask($task_id); // diff --git a/app/Models/ProjectTask.php b/app/Models/ProjectTask.php index 118e1cbc0..1e67182cb 100644 --- a/app/Models/ProjectTask.php +++ b/app/Models/ProjectTask.php @@ -1721,9 +1721,9 @@ public function taskPush($userids, int $type, string $suffix = "") * @param array $assist * @return bool */ - public function moveTask(int $projectId, int $columnId,int $flowItemId = 0,array $owner = [], array $assist = []) + public function moveTask(int $projectId, int $columnId,int $flowItemId = 0,array $owner = [], array $assist = [], string $completeAt='') { - AbstractModel::transaction(function () use ($projectId, $columnId, $flowItemId, $owner, $assist) { + AbstractModel::transaction(function () use ($projectId, $columnId, $flowItemId, $owner, $assist, $completeAt) { $newTaskUser = array_merge($owner, $assist); // $this->project_id = $projectId; @@ -1765,9 +1765,14 @@ public function moveTask(int $projectId, int $columnId,int $flowItemId = 0,array $this->completeTask(null); } } else { + $this->flow_item_id = 0; $this->flow_item_name = ''; } // + if ($completeAt) { + $this->complete_at = $completeAt; + } + // $this->save(); // $this->addLog("移动{任务}"); diff --git a/resources/assets/js/pages/manage/components/TaskMove.vue b/resources/assets/js/pages/manage/components/TaskMove.vue index bfb061ed7..a3f000307 100644 --- a/resources/assets/js/pages/manage/components/TaskMove.vue +++ b/resources/assets/js/pages/manage/components/TaskMove.vue @@ -248,14 +248,10 @@ export default { }, async onConfirm() { - if( this.task.project_id == this.cascader[0] && this.task.column_id == this.cascader[1]){ + if (this.task.project_id == this.cascader[0] && this.task.column_id == this.cascader[1]) { $A.messageError("未变更移动项"); return; } - if( !this.updateData.flow.flow_item_id ){ - $A.messageError("请选择移动后状态"); - return; - } this.loadIng++; this.$store.dispatch("call", { url: "project/task/move", @@ -263,7 +259,8 @@ export default { task_id: this.task.id, project_id: this.cascader[0], column_id: this.cascader[1], - flow_item_id: this.updateData.flow.flow_item_id, + flow_item_id: this.updateData.flow.flow_item_id || 0, + complete_at: this.updateData.flow.complete_at || '', owner: this.updateData.owner_userids, assist: this.updateData.assist_userids, } @@ -274,9 +271,13 @@ export default { this.$store.dispatch("saveTask", data); $A.messageSuccess(msg); this.close() - }).catch(({msg}) => { + }).catch(({msg, ret}) => { this.loadIng--; - $A.modalError(msg); + if (ret == 102) { + $A.messageError("请选择移动后状态"); + } else { + $A.modalError(msg); + } }) }, @@ -290,6 +291,9 @@ export default { }, onStatusUpdate(val) { + if (val.complete_at && !val.flow_item_id) { + val.flow_item_name = this.$L('已完成'); + } this.tasks.flow_item_id = val.flow_item_id; this.updateData.flow = val } diff --git a/resources/mobile b/resources/mobile index cdc56dd68..3dc08b77c 160000 --- a/resources/mobile +++ b/resources/mobile @@ -1 +1 @@ -Subproject commit cdc56dd6808631bc81d261f2b0b7cd35e1015a00 +Subproject commit 3dc08b77c7adaabfb91508f2f104c1df921a9dab