<div class="panel panel-default">
<div class="panel-body form-horizontal">
<table id="cusTableModel" cellspacing="0" cellpadding="0" border="0" class="cusTable datatable table table-striped table-bordered table-hover dataTable" style="word-break:break-all; word-wrap:break-all;">
</table>
</div>
</div>
function initTable() {
//cusTable 爲頁面的table對應的ID
$("#cusTable").bootstrapTable('destroy').bootstrapTable({
//請求方法
method: 'post',
contentType:"application/x-www-form-urlencoded",
striped: true,
cache: false,
pagination: true,
sortable: false,
sortOrder: "asc",
pageSize: 10, //每頁顯示的記錄數
pageNumber:1, //當前第幾頁
pageList: [10, 20, 30, 40, 50], //記錄數可選列表
queryParamsType : "undefined",
//這個接口需要處理bootstrap table傳遞的固定參數,並返回特定格式的json數據
url: "/overcharge/showChargeList" ,
queryParams: function(params) {
//傳參
var param = {
page: params.pageNumber,
rows: params.pageSize,
parkingName: $("#parkingName").val(),
parkingId: $("#parkingId").val(),
plateNum:$("#plateNum").val(),
};
return param;
},
sidePagination: "server",
strictSearch: true,
pagination: true,
idField : "id",
//行
columns: [
{ field : 'parkingId'},
{ field : 'parkingName', title:'場站名稱'},
{ field : 'plateNumber', title:'車牌號'},
{ field: 'contractName', title: '合同名稱'},
{ field: 'createTime', title: '超停創建時間'},
{ field: 'startTime', title: '超停開始時間'},
{ field: 'endTime', title: '超停結束時間'},
{ field: 'overstopsTimeMinutes', title: '超停時間(分鐘)'},
{ field: 'overstopsMoney', title: '超停費用(元)'},
{ field: 'isEndStatus', title: '是否結束超停',formatter:function(value,row,index){
if (value == 1){
return "未結束";
}else if(value = 2){
return "結束";
}
}},
{ field: '', title: '操作', width: 150, align: 'center', formatter: editAndDeleteButton },
]
});
//隱藏域
$('#cusTable').bootstrapTable('hideColumn', 'parkingId');
}