html
<div class="bootstrap-table">
<div class="fixed-table-container" style="padding-bottom: 0px;">
<div class="fixed-table-body">
<div class="fixed-table-loading" style="top: 41px; display: none;">正在努力地加载数据中,请稍候……</div>
<table id="table"></table>
<div id="pageId" style="margin-left: 42%;margin-top: 1%"></div>
</div>
</div>
</div>
function initTable(pageNumber) {
//初始化操作按钮的方法(表格的后边有添加删除按钮的时候)
window.operateEvents = {
'click .addBtn': function (e, value, row, index) {//添加
AlladdFun(e,row);
},
'click .LookContent': function (e, value, row, index) {//详情
LookContentClick(row);
},
'click .ListEdit': function (e, value, row, index) {//修改
update(row);
}
};
$.ajax({
type: "post",
url: url + "/customer/list",
dataType: "json",
contentType: 'application/json; charset=UTF-8',
data:JSON.stringify({
"address": $("#address").val(),
"connTime": $("#curTime").val(),
"mobile": $("#MPhone").val(),
"name":$("#customName").val(),
"nextTime": $("#FunjctionType").val(),
"pageNum": pageNumber,
"pageSize": 10,
"start": 0,
"tel": $("#Telephone").val()
}),
success: function (res) {
if (res && res.code === 200) {
var res1 = res.data.rows;
total = res.data.total;
$('#table').bootstrapTable('destroy').bootstrapTable({
data: res1,
columns: [{
checkbox: true(有复选框)
},
{
field: 'name',
title: '客户名称'
},
{
field: 'createTime',
title: '创建时间',
formatter:function (row) {
if(row==null){
return ''
}else{
return format(row)
}
}
},
{
field: 'connTime',
title: '最近沟通时间',
formatter:function (row) {
if(row==null){
return ''
}else{
return format(row)
}
}
},
{
field: 'connBody',
title: '最近沟通内容',
formatter:function (row) {
return row == null ? '': row
}
},
{
field: 'nextTime',
title: '下次联系时间',
formatter:function (row) {
if(row==null){
return ''
}else{
return format(row)
}
}
},
{
field: 'linkmanName',
title: '联系人',
formatter:function (row) {
return row == null ? '': row
}
},
{
field: 'mobile',
title: '联系方式',
formatter:function (row) {
return row == null ? '': row
}
},
{
field: 'sourceName',
title: '来源'
},
{
field: 'levelName',
title: '等级'
},
{
title: '操作',
align: 'center',
events: operateEvents,
formatter: operateFormatter
}]
})
}
}
})
}