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