mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 03:52:50 +00:00
fix: 如果项目没有流程,无法选择移动后的状态,也没办法确定移动
This commit is contained in:
parent
79065a7675
commit
008040d96c
@ -2340,6 +2340,7 @@ class ProjectController extends AbstractController
|
|||||||
$flow_item_id = intval(Request::input('flow_item_id'));
|
$flow_item_id = intval(Request::input('flow_item_id'));
|
||||||
$owner = Request::input('owner', []);
|
$owner = Request::input('owner', []);
|
||||||
$assist = Request::input('assist', []);
|
$assist = Request::input('assist', []);
|
||||||
|
$completeAt = trim(Request::input('complete_at', ''));
|
||||||
//
|
//
|
||||||
$task = ProjectTask::userTask($task_id);
|
$task = ProjectTask::userTask($task_id);
|
||||||
//
|
//
|
||||||
@ -2360,9 +2361,13 @@ class ProjectController extends AbstractController
|
|||||||
if (empty($flowItem)) {
|
if (empty($flowItem)) {
|
||||||
return Base::retError('任务状态不存在');
|
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);
|
$task = ProjectTask::userTask($task_id);
|
||||||
//
|
//
|
||||||
|
|||||||
@ -1721,9 +1721,9 @@ class ProjectTask extends AbstractModel
|
|||||||
* @param array $assist
|
* @param array $assist
|
||||||
* @return bool
|
* @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);
|
$newTaskUser = array_merge($owner, $assist);
|
||||||
//
|
//
|
||||||
$this->project_id = $projectId;
|
$this->project_id = $projectId;
|
||||||
@ -1765,9 +1765,14 @@ class ProjectTask extends AbstractModel
|
|||||||
$this->completeTask(null);
|
$this->completeTask(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$this->flow_item_id = 0;
|
||||||
$this->flow_item_name = '';
|
$this->flow_item_name = '';
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
if ($completeAt) {
|
||||||
|
$this->complete_at = $completeAt;
|
||||||
|
}
|
||||||
|
//
|
||||||
$this->save();
|
$this->save();
|
||||||
//
|
//
|
||||||
$this->addLog("移动{任务}");
|
$this->addLog("移动{任务}");
|
||||||
|
|||||||
@ -248,14 +248,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async onConfirm() {
|
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("未变更移动项");
|
$A.messageError("未变更移动项");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( !this.updateData.flow.flow_item_id ){
|
|
||||||
$A.messageError("请选择移动后状态");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: "project/task/move",
|
url: "project/task/move",
|
||||||
@ -263,7 +259,8 @@ export default {
|
|||||||
task_id: this.task.id,
|
task_id: this.task.id,
|
||||||
project_id: this.cascader[0],
|
project_id: this.cascader[0],
|
||||||
column_id: this.cascader[1],
|
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,
|
owner: this.updateData.owner_userids,
|
||||||
assist: this.updateData.assist_userids,
|
assist: this.updateData.assist_userids,
|
||||||
}
|
}
|
||||||
@ -274,9 +271,13 @@ export default {
|
|||||||
this.$store.dispatch("saveTask", data);
|
this.$store.dispatch("saveTask", data);
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.close()
|
this.close()
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg, ret}) => {
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
$A.modalError(msg);
|
if (ret == 102) {
|
||||||
|
$A.messageError("请选择移动后状态");
|
||||||
|
} else {
|
||||||
|
$A.modalError(msg);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -290,6 +291,9 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onStatusUpdate(val) {
|
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.tasks.flow_item_id = val.flow_item_id;
|
||||||
this.updateData.flow = val
|
this.updateData.flow = val
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user