From df284ff6f5dd182ce9f5147387a0a439980c5655 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 17 Jun 2021 20:18:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=88=97=E8=A1=A8=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=8E=92=E5=BA=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/core/web/page/PageDomain.java | 9 +++++++++ ruoyi-ui/src/views/system/logininfor/index.vue | 17 +++++++++++++---- ruoyi-ui/src/views/system/operlog/index.vue | 17 +++++++++++++---- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java index 9f1ea8e0..e681c672 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/PageDomain.java @@ -67,6 +67,15 @@ public class PageDomain public void setIsAsc(String isAsc) { + // 兼容前端排序类型 + if ("ascending".equals(isAsc)) + { + isAsc = "asc"; + } + else if ("descending".equals(isAsc)) + { + isAsc = "desc"; + } this.isAsc = isAsc; } } diff --git a/ruoyi-ui/src/views/system/logininfor/index.vue b/ruoyi-ui/src/views/system/logininfor/index.vue index 400d2ab8..a0e9569b 100644 --- a/ruoyi-ui/src/views/system/logininfor/index.vue +++ b/ruoyi-ui/src/views/system/logininfor/index.vue @@ -90,14 +90,14 @@ - + - + - + @@ -137,6 +137,8 @@ export default { statusOptions: [], // 日期范围 dateRange: [], + // 默认排序 + defaultSort: {prop: 'loginTime', order: 'descending'}, // 查询参数 queryParams: { pageNum: 1, @@ -177,13 +179,20 @@ export default { resetQuery() { this.dateRange = []; this.resetForm("queryForm"); + this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) this.handleQuery(); }, - // 多选框选中数据 + /** 多选框选中数据 */ handleSelectionChange(selection) { this.ids = selection.map(item => item.infoId) this.multiple = !selection.length }, + /** 排序触发事件 */ + handleSortChange(column, prop, order) { + this.queryParams.orderByColumn = column.prop; + this.queryParams.isAsc = column.order; + this.getList(); + }, /** 删除按钮操作 */ handleDelete(row) { const infoIds = row.infoId || this.ids; diff --git a/ruoyi-ui/src/views/system/operlog/index.vue b/ruoyi-ui/src/views/system/operlog/index.vue index e66fdf7a..19b35567 100644 --- a/ruoyi-ui/src/views/system/operlog/index.vue +++ b/ruoyi-ui/src/views/system/operlog/index.vue @@ -106,16 +106,16 @@ - + - + - + @@ -212,6 +212,8 @@ export default { statusOptions: [], // 日期范围 dateRange: [], + // 默认排序 + defaultSort: {prop: 'operTime', order: 'descending'}, // 表单参数 form: {}, // 查询参数 @@ -262,13 +264,20 @@ export default { resetQuery() { this.dateRange = []; this.resetForm("queryForm"); + this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) this.handleQuery(); }, - // 多选框选中数据 + /** 多选框选中数据 */ handleSelectionChange(selection) { this.ids = selection.map(item => item.operId) this.multiple = !selection.length }, + /** 排序触发事件 */ + handleSortChange(column, prop, order) { + this.queryParams.orderByColumn = column.prop; + this.queryParams.isAsc = column.order; + this.getList(); + }, /** 详细按钮操作 */ handleView(row) { this.open = true;