feat: 优化我的报送任务页面排序和交互

任务列表按年份+周期倒序(年置于该年最底部);点击行高亮当前选中行;切换公司时重置到第一页并清除高亮。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
TianyangZhang 2026-05-09 13:10:46 +08:00
parent 37b8a0afb0
commit bc0dded968
2 changed files with 8 additions and 4 deletions

View File

@ -16,7 +16,7 @@
:value="item.id"
/>
</el-select>
<el-table :data="dataList.results" @row-click="itemClick">
<el-table ref="taskTable" :data="dataList.results" highlight-current-row @row-click="itemClick">
<el-table-column type="expand" >
<template slot-scope="props" v-if="props.row.task2_&&props.row.task2_.type==20">
<el-form label-position="left" inline class="demo-table-expand">
@ -801,7 +801,7 @@
type: 10,
};
const listQuery = {
page: 0,
page: 1,
belong_dept:null,
page_size: 20,
};
@ -1031,6 +1031,10 @@
that.deptName = item.name;
}
})
that.listQuery.page = 1;
if (that.$refs.taskTable) {
that.$refs.taskTable.setCurrentRow();
}
that.getList();
},
close_dialog(){

View File

@ -561,8 +561,8 @@ class Task2DoViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
"""
mydept = request.user.dept
belong_depts = get_child_queryset2(mydept)
queryset = Task2Do.objects.filter(belong_dept__in = belong_depts).exclude(task2__state=10).order_by('-create_time')
queryset = self.filter_queryset(queryset)
queryset = Task2Do.objects.filter(belong_dept__in = belong_depts).exclude(task2__state=10)
queryset = self.filter_queryset(queryset).order_by('-task2__year', '-task2__cycle')
page = self.paginate_queryset(queryset)
if page is not None:
serializer = Task2DoSerializer(page, many=True)