任务排序优化
Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
parent
0208a06256
commit
54621ee79c
@ -481,7 +481,7 @@ class Task extends CommonModel
|
||||
$nextTask = self::where(['code' => $nextCode])->field('sort')->find();
|
||||
$nextPreTask = self::where('sort', '<', $nextTask['sort'])->where('code', '<>', $nextCode)->where('stage_code', '=', $toStageCode)->where('done', $done)->order('sort desc')->find();
|
||||
$nextPreTaskSort = $nextPreTask ? $nextPreTask['sort'] : 0;
|
||||
$newSort = (int)($nextTask['sort'] - $nextPreTaskSort) / 2;
|
||||
$newSort = (int)($nextTask['sort'] + $nextPreTaskSort) / 2;
|
||||
} else {
|
||||
$maxSort = self::where('stage_code', '=', $toStageCode)->where('done', $done)->max('sort');
|
||||
$newSort = $maxSort + 500;
|
||||
|
@ -190,7 +190,7 @@ class TaskStages extends CommonModel
|
||||
if ($nextCode) {
|
||||
$nextPreStage = self::where('sort', '<', $nextStage['sort'])->where('code', '<>', $nextCode)->where('project_code', '=', $projectCode)->order('sort desc')->find();
|
||||
$nextPreStageSort = $nextPreStage ? $nextPreStage['sort'] : 0;
|
||||
$newSort = (int)($nextStage['sort'] - $nextPreStageSort) / 2;
|
||||
$newSort = (int)($nextStage['sort'] + $nextPreStageSort) / 2;
|
||||
} else {
|
||||
$maxSort = self::where('project_code', $projectCode)->max('sort');
|
||||
$newSort = $maxSort + 500;
|
||||
|
Loading…
x
Reference in New Issue
Block a user