提交 a29012d9 编写于 作者: 智布道's avatar 智布道 👁 提交者: Gitee

!25 后台自定义搜索

Merge pull request !25 from wmk/master
......@@ -25,7 +25,8 @@ Table.prototype = {
var $tablelist = $(options.tableBox);
$tablelist.bootstrapTable('destroy').bootstrapTable({
url: options.url,
method: 'post', //请求方式(*)
method: 'method' in options ? options.method : 'post', //请求方式(*)
formId: 'formId' in this.options ? this.options.formId : '#form1',
toolbar: options.showToolbar !== false ? options.toolbar ? options.toolbar : '#toolbar' : '', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
......@@ -199,9 +200,16 @@ Table.prototype = {
this.bindEvent("click", selector, callback);
},
queryParams: function (params) {
params = $.extend({}, params);
params.keywords = params.searchText;
return params;
var formdata = $(this.formId).serialize();
var data = formdata.split('&');
var parameter = {};
for(var i=0;i<data.length;i++) {
data2 = data[i].split('=');
parameter[data2[0]] = data2[1];
}
return {
...parameter, ...params
};
},
refresh: function () {
var options = this.options;
......
......@@ -11,6 +11,20 @@
</ol>
</@breadcrumb>
<div class="x_panel">
<form class="form-inline" id="article1" onclick="return false;">
<div class="form-group">
<label class="control-label">名称和描述:</label>
<input class=" form-control" name="keywords" placeholder="请输入关键字查询" value="">
</div>
<div class="form-group">
<label class="control-label">名称:</label>
<input class="form-control" name="title" placeholder="请输入名称关键字查询" value="">
</div>
<div class="form-group">
<button id="search-button" class="btn btn-primary"><i class="fa fa-search"></i>查询</button>
</div>
</form>
<div class="x_content">
<div class="<#--table-responsive-->">
<div class="btn-group hidden-xs" id="toolbar">
......@@ -68,6 +82,7 @@
$(function () {
var options = {
modalName: "文章",
formId: "#article1",
url: "/article/list",
getInfoUrl: "/article/get/{id}",
removeUrl: "/article/remove",
......@@ -272,5 +287,11 @@
}, 5000);
}
});
// 搜索查询按钮触发事件
$(function() {
$("#search-button").click(function () {
$('#tablelist').bootstrapTable(('refresh')); // 很重要的一步,刷新url!
})
})
</script>
</@footer>
\ No newline at end of file
......@@ -27,5 +27,6 @@ public class ArticleConditionVO extends BaseConditionVO {
private Boolean original;
private Boolean random;
private List<Long> tagIds;
private String title;
}
......@@ -96,6 +96,11 @@
a.keywords LIKE CONCAT('%',#{keywords , jdbcType=VARCHAR},'%')
)
</if>
<if test="title != null and title != '' ">
AND (
a.title LIKE CONCAT('%',#{title , jdbcType=VARCHAR},'%')
)
</if>
GROUP BY a.id
<choose>
<when test="random != null">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册