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 9f1ea8e0e..e681c672b 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 400d2ab83..a0e9569bd 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 e66fdf7a6..19b355673 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;