var type = localStorage.getItem("type"); var postType; $(function() { initTable(); }); function responseHandler(res) { console.log(res); var datas=[]; console.log(res.total); datas.push({total:res.total,rows:res.list}); return datas[0]; } function initTable() { //初始化Table $("#table").bootstrapTable({ classes: 'table table-hover', url: dataUrl + 'workerPost/getWorkerPostInfo', method: 'post', responseHandler: responseHandler, //处理服务器返回的数据格式 height: $(window).height() - ($(window).height() * 0.13), undefinedText: '', //当数据为 undefined 时显示的字符 queryParams: function(param) { param = { companyId:companyId, type:type, pageSize: param.limit, pageNum: param.offset / param.limit + 1, sort: param.sort, //排序列名 sortOrder: param.order //排位命令(desc,asc) } return param; }, sortable: true, //是否启用排序 sortOrder: "asc", //排序方式 cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) pagination: true, pageNumber: 1, pageSize: 50, pageList: [50, 100, 200, 300], smartDisplay: false, showColumns: false, sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*) contentType: "application/x-www-form-urlencoded", minimumCountColumns: 2, //最少允许的列数 uniqueId: "no", //每一行的唯一标识,一般为主键列 columns: [ { title: '序号', formatter: function(value, row, index) { return index + 1; }, rowspan: 1, align: 'center', valign: 'middle', width: '5%' }, // { // title: '统计级别', // field: 'orgName', // rowspan: 1, // align: 'center', // valign: 'middle', // sortable: true, // width: '35%' // }, { title: type, field: 'postName', rowspan: 1, align: 'center', valign: 'middle', sortable: true, width: '30%' }, { title: '数量', field: '', formatter: function(value, row, index) { var content = ""+row.counts+""; return content; }, rowspan: 1, align: 'center', valign: 'middle', sortable: true, width: '30%' } ], onLoadSuccess: function(data) { top.layer.close(index); if(type == '施工人员'){ //$("#dataCount").html("施工人员统计数量:" + data.total); }else if(type == '公司'){ //$("#dataCount").html("公司统计数量:" + data.total); }else if(type == '省份'){ $("#dataCount").html("省份数量:" + data.total); }else if(type == '工种'){ $("#dataCount").html("工种类型数量:" + data.total); }else if(type == '年龄结构'){ //$("#dataCount").html("年龄结构统计数量:" + data.total); }else if(type == '持证情况'){ $("#dataCount").html("持证类型数量:" + data.total); }else if(type == '性别'){ //$("#dataCount").html("性别比例统计数量:" + data.total); }else if(type == '考勤天数'){ //$("#dataCount").html("考勤统计数量:" + data.total); }else if(type == '劳动合同'){ // $("#dataCount").html("劳动合同统计数量:" + data.total); } }, onLoadError: function() { $("#dataCount").html("统计数量:0"); $("#table").bootstrapTable('removeAll'); top.layer.close(index); }, }); } var index; // function showWorkerPostPeople(type,postName){ if(type=="安全培训"){ var index = top.layer.open({ title: false, type: 2, content: '../../page/tarin/trainInfo.html', area: ['90%', '90%'], maxmin: false }); }else{ localStorage.setItem("type", type); localStorage.setItem("postName", postName); var index = top.layer.open({ title: false, type: 2, content: '../../page/workerPost/workerPostPeople.html', area: ['80%', '80%'], maxmin: false }); } }