/** * 工单结案率统计报表 * */ $(function() { //初始化时间 layui.use('laydate', function() { var laydate = layui.laydate; laydate.render({ elem: '#sc_time', range: '~', theme: '#1ab394', calendar: true, done: function(){ $('#sc_year').val(''); $('#sc_season').selectpicker('val', ''); } }); laydate.render({ elem: '#sc_year', theme: '#1ab394', type: 'year', done: function(){ $('#sc_time').val(''); } }); }); $('#sc_season').on('change', function(){ $('#sc_time').val(''); }); getTableDataList(); //获取表格数据 //获取区域项目期号 helper.getDropList.getProLocations($('#sc_rengin'), $('#sc_pro'), $('#sc_floor')); //获取工单来源 helper.getDropList.getlistDropByDic($('#sc_source'), 'GDLY'); //搜索 $("#sc_btns").click(function() { getTableDataList(); //获取表格数据 }) }); function getTableDataList() { var colsArr = []; var loadindex; if ($('#sc_season').val() && !$('#sc_year').val()) { layer.confirm('请选择年度!', { icon: 2, btn: ['确定'] }); return; } $.ajax({ type: 'get', url: huayi.config.callcenter_url + "WorkOrdersCloseRate/GetDataList", async: true, dataType: 'json', beforeSend: function() { loadindex = layer.load() }, data: { iseffective: $('#sc_iseffective').val(), //否 int 是否有效工单 gdly: $('#sc_source').val(),// 否 int 工单来源id stime: $('#sc_time').val() && $('#sc_time').val().split(' ~ ')[0], //否 string 工单起止时间 endtime: $('#sc_time').val() && $('#sc_time').val().split(' ~ ')[1], //否 string 工单起止时间 years: $('#sc_year').val(), //年度 season: $('#sc_season').val(), //季度 areaid: $('#sc_rengin').val(), //否 string 区域id // regionid: $('#sc_pro').val(), //否 string 项目id // stageid: $('#sc_floor').val(), //否 string 期号id token: $.cookie("token"), }, success: function(data) { if(data.state.toLowerCase() == "success") { var res = data.data; var colsArr1 = []; if(res && res.length > 0) { colsArr1.push({ field: '区域', title: '区域', align: 'center', fixed: true, //sort: true, width: 200, }); for(var i in res[0]) { if(i === "区域" || i === "结案率") { continue; } else { colsArr1.push({ field: i, title: i, align: 'center', }); } } colsArr1.push({ field: '结案率', title: '结案率', align: 'center', fixed: 'right', //sort: true, templet: function(d) { return '' + d.结案率 + '' }, width: 318, }); colsArr.push(colsArr1); layui.use('table', function() { var table = layui.table; //方法级渲染 table.render({ elem: '#t_callTotal', skin: 'row', //line (行边框风格) row (列边框风格) nob (无边框风格) even: true, //开启隔行背景 size: 'md', //sm,lg,md尺寸的表格 cellMinWidth: 160, //page: true, cols: colsArr, data: res, limit: res.length,//默认是10 //height: 'full-150' }); }) } } }, }).then(function() { layer.close(loadindex); }); } //格式化序号 function setCode(val, row, index) { return ++index; } //导出 function dcexcel(obj) { var url = huayi.config.callcenter_url + "WorkOrdersCloseRate/ExportExcel?token=" + $.cookie("token"); // url += "&iseffective=" + $('#sc_iseffective').val(); //否 int 是否有效工单 url += "&gdlx=" + $('#sc_type').val(); //否 string 工单类型 url += "&stime=" + ($('#sc_time').val() && $('#sc_time').val().split(' ~ ')[0]); //否 string 工单起止时间 url += "&endtime=" + ($('#sc_time').val() && $('#sc_time').val().split(' ~ ')[1]); //否 string 工单起止时间 url += "&areaid=" + $('#sc_rengin').val(); //否 string 区域id url += "&years=" + $('#sc_year').val(); //否 年度 url += "&season=" + $('#sc_season').val(); //否 季度 // url += "®ionid=" + $('#sc_pro').val(); //否 string 项目id // url += "&stageid=" + $('#sc_floor').val(); //否 string 期号id obj.href = url; }