mirror of https://gitee.com/y_project/RuoYi.git
新增支持导出数据字段排序
parent
b5678994da
commit
6ce34b1790
|
@ -345,8 +345,12 @@ var table = {
|
||||||
table.set();
|
table.set();
|
||||||
$.modal.confirm("确定导出所有" + table.options.modalName + "吗?", function() {
|
$.modal.confirm("确定导出所有" + table.options.modalName + "吗?", function() {
|
||||||
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
|
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
|
||||||
|
var params = $("#" + table.options.id).bootstrapTable('getOptions');
|
||||||
|
var dataParam = $("#" + currentId).serializeArray();
|
||||||
|
dataParam.push({ "name": "orderByColumn", "value": params.sortName });
|
||||||
|
dataParam.push({ "name": "isAsc", "value": params.sortOrder });
|
||||||
$.modal.loading("正在导出数据,请稍后...");
|
$.modal.loading("正在导出数据,请稍后...");
|
||||||
$.post(table.options.exportUrl, $("#" + currentId).serializeArray(), function(result) {
|
$.post(table.options.exportUrl, dataParam, function(result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
if (result.code == web_status.SUCCESS) {
|
||||||
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
|
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
|
||||||
} else if (result.code == web_status.WARNING) {
|
} else if (result.code == web_status.WARNING) {
|
||||||
|
|
|
@ -63,6 +63,19 @@ public class BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置请求排序数据
|
||||||
|
*/
|
||||||
|
protected void startOrderBy()
|
||||||
|
{
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
|
||||||
|
{
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
|
PageHelper.orderBy(orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取request
|
* 获取request
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue