Pre Merge pull request !76 from zhangmrit/ruoyi

This commit is contained in:
zhangmrit 2019-03-07 12:57:39 +08:00
commit 4f41241668
4 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,14 @@
.jumpto input {
height: 32px;
width: 50px;
margin-left: 5px;
margin-right: 5px;
text-align: center;
display: block;
float:left;
}
.jumpto button {
height: 32px;
display: block;
float:left;
}

View File

@ -0,0 +1,54 @@
/**
* @author Jay <jwang@dizsoft.com>
*/
(function ($) {
'use strict';
var sprintf = $.fn.bootstrapTable.utils.sprintf;
$.extend($.fn.bootstrapTable.defaults, {
showJumpto: false,
exportOptions: {}
});
$.extend($.fn.bootstrapTable.locales, {
formatJumpto: function () {
return '跳转到';
}
});
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initPagination = BootstrapTable.prototype.initPagination;
BootstrapTable.prototype.initPagination = function () {
_initPagination.apply(this, Array.prototype.slice.apply(arguments));
if (this.options.showJumpto) {
var that = this,
$pageGroup = this.$pagination.find('ul.pagination'),
$jumpto = $pageGroup.find('li.jumpto');
if (!$jumpto.length) {
$jumpto = $([
'<li class="jumpto">',
'<input type="text" class="form-control">',
'<button class="btn' +
sprintf(' btn-%s', this.options.buttonsClass) +
sprintf(' btn-%s', this.options.iconSize) +
'" title="' + this.options.formatJumpto() + '" ' +
' type="button">'+this.options.formatJumpto(),
'</button>',
'</li>'].join('')).appendTo($pageGroup);
$jumpto.find('button').click(function () {
var page=parseInt($jumpto.find('input').val())||1;
if(page<1||page>that.options.totalPages){
page=1;
}
that.selectPage(page);
});
}
}
};
})(jQuery);

View File

@ -36,6 +36,7 @@
rightFixedColumns: false,
rightFixedNumber: 0,
queryParams: $.table.queryParams,
showJumpto: false
};
var options = $.extend(defaults, options);
$.table._option = options;
@ -74,6 +75,7 @@
columns: options.columns, // 显示列信息(*
responseHandler: $.table.responseHandler, // 在加载服务器发送来的数据之前处理函数
onLoadSuccess: $.table.onLoadSuccess, // 当所有数据被加载时触发处理函数
showJumpto: options.showJumpto, // 是否显示跳页
});
},
// 查询条件

View File

@ -11,6 +11,7 @@
<link th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/bootstrap-treetable/bootstrap-treetable.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/bootstrap-table/extensions/page-jumpto/bootstrap-table-jumpto.css}" rel="stylesheet"/>
<link th:href="@{/css/animate.css}" rel="stylesheet"/>
<link th:href="@{/css/style.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/select/select2.css}" rel="stylesheet"/>