bootstrap使用总结

 

1. 表格里面展示后端传来的Date类型的时间,yyyy-MM-dd HH:mm:ss

//列表中添加格式转换
{title: '处理时间', field: 'replyTime', visible: true, align: 'center', valign: 'middle',
    formatter: function (value, row, index) {
        return changeDateFormat(value);
    }
}

//创建函数
function changeDateFormat(cellval) {
    if (cellval) {
        var date = new Date(cellval);
        var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
        var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
        var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
        var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
        var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
        return date.getFullYear() + "-" + month + "-" + currentDate+" "+hours+":"+minutes+":"+seconds;
    }
    return "";
}

 

2.  自定义查询参数

$('#tb_departments').bootstrapTable({
      queryParams: function(params){
            var temp={
                  limit: params.limit,
                  offset: params.offset,
                  id: id
            };
            return temp;
      },//传递参数(*)

 

 

 
posted @ 2020-12-06 17:29  华格瑞沙  阅读(102)  评论(0编辑  收藏  举报