Skip to content

Commit

Permalink
Merge commit '008040d96c73051fca6db388b35077a0ca7b5b5b' into pro
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Jun 3, 2024
2 parents 49203c1 + 008040d commit 20d8180
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
7 changes: 6 additions & 1 deletion app/Http/Controllers/Api/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
//
Expand All @@ -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);
//
Expand Down
9 changes: 7 additions & 2 deletions app/Models/ProjectTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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("移动{任务}");
Expand Down
20 changes: 12 additions & 8 deletions resources/assets/js/pages/manage/components/TaskMove.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,22 +248,19 @@ 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",
data: {
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,
}
Expand All @@ -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);
}
})
},
Expand All @@ -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
}
Expand Down

0 comments on commit 20d8180

Please sign in to comment.