perf: 优化任务排序
This commit is contained in:
parent
b9e435c0e2
commit
7c952822db
@ -604,13 +604,14 @@ class ProjectController extends AbstractController
|
||||
if (!is_array($item['task'])) continue;
|
||||
$index = 0;
|
||||
foreach ($item['task'] as $task_id) {
|
||||
ProjectTask::whereId($task_id)->whereProjectId($project->id)->update([
|
||||
if (ProjectTask::whereId($task_id)->whereProjectId($project->id)->whereCompleteAt(null)->update([
|
||||
'column_id' => $item['id'],
|
||||
'sort' => $index
|
||||
]);
|
||||
ProjectTask::whereParentId($task_id)->whereProjectId($project->id)->update([
|
||||
'column_id' => $item['id'],
|
||||
]);
|
||||
])) {
|
||||
ProjectTask::whereParentId($task_id)->whereProjectId($project->id)->update([
|
||||
'column_id' => $item['id'],
|
||||
]);
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
|
@ -623,10 +623,8 @@ export default {
|
||||
column.tasks = this.transforTasks(allTask.filter(task => {
|
||||
return task.column_id == column.id;
|
||||
})).sort((a, b) => {
|
||||
let at1 = $A.Date(a.complete_at),
|
||||
at2 = $A.Date(b.complete_at);
|
||||
if (at1 || at2) {
|
||||
return at1 - at2;
|
||||
if (a.complete_at || b.complete_at) {
|
||||
return $A.Date(a.complete_at) - $A.Date(b.complete_at);
|
||||
}
|
||||
if (a.sort != b.sort) {
|
||||
return a.sort - b.sort;
|
||||
|
Loading…
x
Reference in New Issue
Block a user