From c1f545bc68ce6cf67310e01a0d0258b79f80cb3d Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 27 Apr 2020 11:35:36 +0800 Subject: [PATCH] sort --- test_client/src/views/analyse/examtest.vue | 15 +++++++++++++-- test_client/src/views/crm/consumer.vue | 12 ++++++------ test_client/src/views/login/index.vue | 2 +- test_server/crm/views.py | 4 ++-- test_server/examtest/views.py | 2 +- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/test_client/src/views/analyse/examtest.vue b/test_client/src/views/analyse/examtest.vue index 2cf4e3d..70c8dc8 100644 --- a/test_client/src/views/analyse/examtest.vue +++ b/test_client/src/views/analyse/examtest.vue @@ -60,6 +60,7 @@ v-loading="listLoading" highlight-current-row max-height="600" + @sort-change="changeSort" > @@ -74,10 +75,10 @@ - + - + @@ -214,6 +215,16 @@ export default { this.listQuery.start = this.value[0], this.listQuery.end = this.value[1], this.getList() + }, + changeSort (val) { + if(val.order == 'ascending'){ + this.listQuery.ordering = val.prop + }else{ + this.listQuery.ordering = '-' + val.prop + } + + this.getList() + } } }; diff --git a/test_client/src/views/crm/consumer.vue b/test_client/src/views/crm/consumer.vue index 8305d8d..15859ab 100644 --- a/test_client/src/views/crm/consumer.vue +++ b/test_client/src/views/crm/consumer.vue @@ -86,7 +86,7 @@ - + @@ -95,7 +95,7 @@ - + - + @@ -317,9 +317,9 @@ export default { if (!value) return true; return data.label.indexOf(value) !== -1; }, - getList(query = this.listQuery) { + getList() { this.listLoading = true; - getConsumerList(query).then(response => { + getConsumerList(this.listQuery).then(response => { this.consumerList = response.data.results; this.total = response.data.count; this.listLoading = false; @@ -453,7 +453,7 @@ export default { this.listQuery.ordering = '-' + val.prop } - this.getList() + this.getList() } } diff --git a/test_client/src/views/login/index.vue b/test_client/src/views/login/index.vue index 0018a1b..a8645ba 100644 --- a/test_client/src/views/login/index.vue +++ b/test_client/src/views/login/index.vue @@ -3,7 +3,7 @@