var fun={ init:function () { fun.dateInit(); fun.createTableData(); }, dateInit:function () { $('#online-daydaterange-btnsta').val(moment().subtract('days', 1).format('YYYY-MM-DD')); $('#online-daydaterange-btnend').val(moment().subtract('days', 1).format('YYYY-MM-DD')); //开始日期 $("#online-daydaterange-btnsta").datetimepicker({ endDate: moment().subtract('days', 1).format('YYYY-MM-DD'), format: 'yyyy-mm-dd', autoclose: true, startView: 2, minView: 2, forceParse: false, locale: "zh-CN", language: 'zh-CN', pickerPosition: "bottom-right" }) $("#online-daydaterange-btnend").datetimepicker({ endDate: moment().subtract('days', 1).format('YYYY-MM-DD'), //startDate:startVal, format: 'yyyy-mm-dd', weekStart: 1, autoclose: true, startView: 2, minView: 2, forceParse: false, locale: "zh-CN", language: 'zh-CN', pickerPosition: "bottom-right" }) }, queryParamManage:function () { /*开始时间*/ var beginTime; /*结束时间*/ var endTime; beginTime = $("#online-daydaterange-btnsta").val(); endTime = $("#online-daydaterange-btnend").val(); beginTime = beginTime + " 00:00:00"; endTime = endTime + " 23:59:59"; beginTime = beginTime == null || beginTime.length == 0 ? null : new Date((beginTime).replace(/-/g, "/")); endTime = endTime == null || endTime.length == 0 ? null : new Date((endTime).replace(/-/g, "/")); //alert(detailType) var req = { beginTime: beginTime, endTime: endTime, }; return req; }, //停车场 table 默认 createTableData: function () { $('#recordtable').bootstrapTable('destroy').bootstrapTable({ striped: true, //表格显示条纹 pagination: true, //启动分页 pageNumber: 1, //当前第几页 // showColumns: true, pageSize: 10, //每页显示的记录数 pageList: [10, 15, 20], //记录数可选列表 sidePagination: 'server', //表示服务端分页 queryParamsType: 'limit', method: 'POST', //请求方法 paginationPreText: '<', paginationNextText: '>', ajax: tableLoadRequest, //自定义ajax加载数据 uniqueId: 'id', columns: [ [ { field: 'checkDate', title: '日期', align: 'center', rowspan: 2, valign: "middle", formatter: commonObj.replacenull }, { field: '', title: '停车收入', align: 'center', colspan: 2, rowspan: 1, valign: "middle", formatter: commonObj.replacenull }, { field: '', title: '停车补缴', align: 'center', colspan: 2, rowspan: 1, valign: "middle", formatter: commonObj.replacenull }, { field: '', title: 'APP充值', align: 'center', colspan: 2, rowspan: 1, valign: "middle", formatter: commonObj.replacenull }, { field: '', title: '会员卡', align: 'center', colspan: 2, rowspan: 1, valign: "middle", formatter: commonObj.replacenull }, { field: '', title: '收费员充值', align: 'center', colspan: 2, rowspan: 1, valign: "middle", formatter: commonObj.replacenull }, { field: '', title: '合计', align: 'center', colspan: 3, rowspan: 1, valign: "middle", formatter: commonObj.replacenull }, { field: '', title: '退款', align: 'center', colspan: 2, rowspan: 1, valign: "middle", formatter: commonObj.replacenull }, ], [ { field: 'wxFee', title: '微信', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'aliFee', title: '支付宝', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'wxFee', title: '微信', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'aliFee', title: '支付宝', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'wxFee', title: '微信', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'aliFee', title: '支付宝', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'wxFee', title: '微信', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'aliFee', title: '支付宝', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'wxFee', title: '微信', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'aliFee', title: '支付宝', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'wxFee', title: '微信', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'aliFee', title: '支付宝', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'aliFee', title: '小计', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'wxFee', title: '微信', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, { field: 'aliFee', title: '支付宝', width: '10%', align: "left", formatter:commonObj.moneyFormatter }, ], ] }); }, }; fun.init(); /** * 自定义table AJAX请求 * @param {Object} params */ function tableLoadRequest(params) { var req = fun.queryParamManage(); //设置请求参数 var pageNum = (params.data.offset / params.data.limit) + 1; //条件查询 req.baseRequest = { pageNum: pageNum, pageSize: params.data.limit }; req.sysCode = sysComm.sysCode; req.checkFeeTypes=[100,103,300,301,302]; var opt = { method: 'post', url: dataUrl.util.queryDetailForAreaByTypeNew(), data: JSON.stringify(req), contentType: 'application/json; charset=utf-8', dataType: 'json', success: function (res) { console.log(res); if (res.code == '8888') { params.success(res.data); } } }; sysAjax(opt); } //导出 var InterValObj; //timer变量,控制时间 var count = 8; //间隔函数,1秒执行 var curCount;//当前剩余秒数 function sendMessage() { curCount = count; //设置button效果,开始计时 $("#billmanageReport").attr("disabled", "true"); $(".ITD-export-btn").css("width", "138px"); $("#billmanageReport").val(curCount + "秒后可再次导出"); InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次 } //timer处理函数 function SetRemainTime() { if (curCount == 0) { window.clearInterval(InterValObj);//停止计时器 $("#billmanageReport").removeAttr("disabled");//启用按钮 $(".ITD-export-btn").css("width", "72px"); $("#billmanageReport").val("导出"); } else { curCount--; $("#billmanageReport").val(curCount + "秒后可再次导出"); } } //导出excle documentBindFunc.on('click','#billmanageReport',function (){ //获取table所有行数据 var parkLot = $("#recordtable").bootstrapTable('getData'); //获取table总条数 var numTotal = $("#recordtable").bootstrapTable('getOptions').totalRows; //提示 无数据不导出 if(parkLot.length<1){ $('.ITD-alertmodel-contentmsg').text('无数据可导出!'); $('#ITD-tipsmodel').modal('show'); setTimeout(function () { $('.ITD-alertmodel-contentmsg').text(''); $('#ITD-tipsmodel').modal('hide'); },3000); return false; } //超1万条 缩短查询范围 if(numTotal>10000){ $('.ITD-alertmodel-contentmsg').text('数据量过大,请缩小查询范围!'); $('#ITD-tipsmodel').modal('show'); setTimeout(function () { $('.ITD-alertmodel-contentmsg').text(''); $('#ITD-tipsmodel').modal('hide'); },3000); return false; } //执行倒计时函数 sendMessage(); var req = fun.queryParamForBillManage(); var beginTime = DateUtils.long2String(req.beginTime, 7); var endTime = DateUtils.long2String(req.endTime, 7); var url = dataUrl.util.exportBillExcleforAllNew(); var forms = exportIncomeDetailFormforbill(url, beginTime, endTime, req.plNos, req.timeType ); forms.submit(); });