字典排序

This commit is contained in:
caoqianming 2021-03-31 10:49:19 +08:00
parent 223182d61b
commit 6a112b32c2
2 changed files with 5 additions and 2 deletions

View File

@ -70,6 +70,9 @@
<el-table-column label="代号/编号">
<template slot-scope="scope">{{ scope.row.code }}</template>
</el-table-column>
<el-table-column label="排序">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column>
<el-table-column label="描述">
<template slot-scope="scope">{{ scope.row.desc }}</template>
</el-table-column>

View File

@ -141,8 +141,8 @@ class DictViewSet(ModelViewSet):
serializer_class = DictSerializer
search_fields = ['name', 'code']
filterset_fields = ['type__code', 'type', 'is_used']
ordering_fields = ['id']
ordering = 'id'
ordering_fields = ['sort']
ordering = 'sort'
def paginate_queryset(self, queryset):
"""
如果查询参数里没有page但有type或type__code时则不分页,否则请求分页