提交 c4774539 authored 作者: matian's avatar matian

课程学习增加排序

上级 f8733d23
...@@ -31,8 +31,24 @@ export default { ...@@ -31,8 +31,24 @@ export default {
{ label: '班级人数', prop: 'student_total', align: 'center', sortable: 'custom' }, { label: '班级人数', prop: 'student_total', align: 'center', sortable: 'custom' },
{ label: '完成人数', prop: 'finished_student_total', align: 'center', sortable: 'custom' }, { label: '完成人数', prop: 'finished_student_total', align: 'center', sortable: 'custom' },
{ label: '课程完成率', prop: 'course_completion_rate', align: 'center', sortable: 'custom' }, { label: '课程完成率', prop: 'course_completion_rate', align: 'center', sortable: 'custom' },
{ label: '累计学习时长', prop: 'study_length', align: 'center', sortable: 'custom' }, {
{ label: '人均学习时长', prop: 'avg_study_length', align: 'center', sortable: 'custom' } label: '累计学习时长',
prop: 'study_length',
align: 'center',
sortable: 'custom',
computed({ row }) {
return row.study_length_format
}
},
{
label: '人均学习时长',
prop: 'avg_study_length',
align: 'center',
sortable: 'custom',
computed({ row }) {
return row.avg_study_length_format
}
}
] ]
} }
} }
...@@ -56,11 +72,13 @@ export default { ...@@ -56,11 +72,13 @@ export default {
}) })
}, },
sortChange(columns) { sortChange(columns) {
console.log(columns, 'hfjsdfhs')
if (columns.order === 'ascending') { if (columns.order === 'ascending') {
this.tableOptions.remote.params.sort = columns.prop this.tableOptions.remote.params.sort = 'asc'
this.tableOptions.remote.params.sort_column = columns.prop
} else { } else {
columns.prop = '-' + columns.prop this.tableOptions.remote.params.sort = 'desc'
this.tableOptions.remote.params.sort = columns.prop this.tableOptions.remote.params.sort_column = columns.prop
} }
this.$refs.list.refetch() this.$refs.list.refetch()
} }
......
...@@ -47,7 +47,15 @@ export default { ...@@ -47,7 +47,15 @@ export default {
columns: [ columns: [
{ label: '图片', prop: 'course_picture', slots: 'table-img' }, { label: '图片', prop: 'course_picture', slots: 'table-img' },
{ label: '课程名称', prop: 'course_name', align: 'center' }, { label: '课程名称', prop: 'course_name', align: 'center' },
{ label: '人均学习时长', prop: 'course_avg_study_len', align: 'center', sortable: 'custom' }, {
label: '人均学习时长',
prop: 'course_avg_study_len',
align: 'center',
sortable: 'custom',
computed({ row }) {
return row.course_avg_study_len_format
}
},
{ label: '课程完成率', prop: 'course_finish_progress', align: 'center', sortable: 'custom' }, { label: '课程完成率', prop: 'course_finish_progress', align: 'center', sortable: 'custom' },
{ label: '操作', align: 'center', slots: 'table-operate' } { label: '操作', align: 'center', slots: 'table-operate' }
] ]
...@@ -59,11 +67,13 @@ export default { ...@@ -59,11 +67,13 @@ export default {
}, },
methods: { methods: {
sortChange(columns) { sortChange(columns) {
console.log(columns, 'hfjsdfhs')
if (columns.order === 'ascending') { if (columns.order === 'ascending') {
this.tableOptions.remote.params.sort = columns.prop this.tableOptions.remote.params.sort = 'asc'
this.tableOptions.remote.params.sort_column = columns.prop
} else { } else {
columns.prop = '-' + columns.prop this.tableOptions.remote.params.sort = 'desc'
this.tableOptions.remote.params.sort = columns.prop this.tableOptions.remote.params.sort_column = columns.prop
} }
this.$refs.list.refetch() this.$refs.list.refetch()
}, },
......
...@@ -49,11 +49,13 @@ export default { ...@@ -49,11 +49,13 @@ export default {
}) })
}, },
sortChange(columns) { sortChange(columns) {
console.log(columns, 'hfjsdfhs')
if (columns.order === 'ascending') { if (columns.order === 'ascending') {
this.tableOptions.remote.params.sort = columns.prop this.tableOptions.remote.params.sort = 'asc'
this.tableOptions.remote.params.sort_column = columns.prop
} else { } else {
columns.prop = '-' + columns.prop this.tableOptions.remote.params.sort = 'desc'
this.tableOptions.remote.params.sort = columns.prop this.tableOptions.remote.params.sort_column = columns.prop
} }
this.$refs.list.refetch() this.$refs.list.refetch()
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论