From 008040d96c73051fca6db388b35077a0ca7b5b5b Mon Sep 17 00:00:00 2001 From: weifs <605403358@qq.com> Date: Mon, 3 Jun 2024 11:13:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A6=82=E6=9E=9C=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=B5=81=E7=A8=8B=EF=BC=8C=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=A7=BB=E5=8A=A8=E5=90=8E=E7=9A=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=8C=E4=B9=9F=E6=B2=A1=E5=8A=9E=E6=B3=95=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E7=A7=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Api/ProjectController.php | 7 ++++++- app/Models/ProjectTask.php | 9 +++++++-- .../js/pages/manage/components/TaskMove.vue | 20 +++++++++++-------- 3 files changed, 25 insertions(+), 11 deletions(-) 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 }