Skip to content

Commit

Permalink
perf: 归档任务列表显示完成时间
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Jan 6, 2022
1 parent 7d8856e commit c930e4d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/Http/Controllers/Api/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,10 @@ public function column__remove()
* @apiParam {String} [archived] 归档状态
* - yes:已归档
* - no:未归档(默认)
* @apiParam {Object} sorts 排序方式
* - sorts.complete_at 完成时间:asc|desc
* - sorts.archived_at 归档时间:asc|desc
* - sorts.end_at 到期时间:asc|desc
*
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
* @apiSuccess {String} msg 返回信息(错误描述)
Expand All @@ -884,6 +888,8 @@ public function task__lists()
$time_before = Request::input('time_before');
$complete = Request::input('complete', 'all');
$archived = Request::input('archived', 'no');
$sorts = Request::input('sorts');
$sorts = is_array($sorts) ? $sorts : [];
//
if ($parent_id > 0) {
ProjectTask::userTask($parent_id);
Expand Down Expand Up @@ -921,6 +927,12 @@ public function task__lists()
$builder->whereNull('project_tasks.archived_at');
}
//
foreach ($sorts as $column => $direction) {
if (!in_array($column, ['complete_at', 'archived_at', 'end_at'])) continue;
if (!in_array($direction, ['asc', 'desc'])) continue;
$builder->orderBy('project_tasks.' . $column, $direction);
}
//
$list = $builder->orderByDesc('project_tasks.id')->paginate(Base::getPaginate(200, 100));
//
return Base::retSuccess('success', $list);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
<DrawerOverlay
v-model="archivedTaskShow"
placement="right"
:size="768">
:size="900">
<TaskArchived v-if="archivedTaskShow" :project-id="projectId"/>
</DrawerOverlay>
</div>
Expand Down
8 changes: 8 additions & 0 deletions resources/assets/js/pages/manage/components/TaskArchived.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export default {
return h('AutoTip', row.name);
}
},
{
title: this.$L('完成时间'),
key: 'complete_at',
width: 168,
},
{
title: this.$L('归档时间'),
key: 'archived_at',
Expand Down Expand Up @@ -130,6 +135,9 @@ export default {
data: {
project_id: this.projectId,
archived: 'yes',
sorts: {
archived_at: 'desc'
},
page: Math.max(this.page, 1),
pagesize: Math.max($A.runNum(this.pageSize), 20),
},
Expand Down

0 comments on commit c930e4d

Please sign in to comment.