var url;
//模糊查询
function searchUser(){
var keyword = $("#keyword").val();
var queryparam = {
silent:true,
query:{
keyword:keyword
}
};
$('#table_user').bootstrapTable('refresh',queryparam);
}
//返回
function returnBack(){
$('#table_user').bootstrapTable('refresh');//调用方法查取table列表
}
//封装的table方法
function boostrap_table(k){
$('#table_user').bootstrapTable({
url: '',
dataType: "json",
type:"post",
queryParams : function (params) {
var temp = {
rows: params.limit,
page: (params.offset / params.limit) + 1,
keyword:k,
};
return temp;
},
striped: true,//设置为 true 会有隔行变色效果
undefinedText: "空",//当数据为 undefined 时显示的字符
pagination: true, //分页
pageList: [10, 15, 20, 25, 30],
paginationPreText: '‹',//指定分页条中上一页按钮的图标或文字,这里是<
paginationNextText: '›',//指定分页条中下一页按钮的图标或文字,这里是>
singleSelect: false,//设置True 将禁止多选
data_local: "zh-US",//表格汉化
fitColumns: true,
singleSelect: true,
sidePagination: "server", //服务端处理分页
columns: [
{checkbox: true},
{field:'id',title:'ID',align:'center',valign: 'middle'},
{field:'username',title:'登录名',align:'center',valign: 'middle'},
{field:'fullname',title:'姓名',align:'center',valign: 'middle'},
{field:'sex',title:'性别',align:'center',valign: 'middle',
formatter:function(value, row, index){
//判断性别
if(row.sex == 0){
return "女";
}else if(row.sex == 1){
return "男";
}
}
},
{field:'roleName',title:'用户角色',align:'center',valign: 'middle'},
{field:'address',title:'用户地址',align:'center',valign: 'middle'},
{field:'email',title:'邮箱',align:'center',valign: 'middle'},
{field:'phone',title:'电话',align:'center',valign: 'middle'},
{field:'status',title:'状态',align:'center',valign: 'middle',
formatter:function(value, row, index){
//判断性别
if(row.status == 0){
return "禁用";
}else if(row.status == 1){
return "启用";
}
}
},
{field:'description',title:'备注',align:'center',valign: 'middle'},
{field:'value',title:'操作',align:'center',valign: 'middle',
formatter:function(value, row, index){
var e = ' ';
return e ;
}
}
]
});
}