增加题干排序
This commit is contained in:
parent
f85c0b54cb
commit
bf1bdcae3e
|
@ -2,7 +2,6 @@
|
|||
<div class="app-container">
|
||||
<div style="margin-bottom: 2px">
|
||||
<el-date-picker
|
||||
ref="picker"
|
||||
v-model="daterange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
|
|
|
@ -78,9 +78,10 @@
|
|||
v-loading="listLoading"
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
@sort-change="changeSort"
|
||||
>
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
<el-table-column align="left" label="题干">
|
||||
<el-table-column align="left" label="题干" sortable="custom" prop="name">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="所属题库">
|
||||
|
@ -303,6 +304,15 @@ export default {
|
|||
window.open(response.data.path, "_blank");
|
||||
}).catch(e=>{loading.close()});
|
||||
},
|
||||
changeSort(val) {
|
||||
if (val.order == "ascending") {
|
||||
this.listQuery.ordering = val.prop;
|
||||
} else {
|
||||
this.listQuery.ordering = "-" + val.prop;
|
||||
}
|
||||
|
||||
this.getList();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -98,7 +98,7 @@ class QuestionViewSet(ModelViewSet):
|
|||
queryset = Question.objects.filter(is_delete=0).all()
|
||||
serializer_class = QuestionSerializer
|
||||
pagination_class = CommonPagination
|
||||
ordering_fields = ['id']
|
||||
ordering_fields = ['id', 'name']
|
||||
ordering = ['-create_time']
|
||||
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
|
||||
filterset_fields = ['questioncat','level', 'type']
|
||||
|
|
Loading…
Reference in New Issue