页面公用方法模板
$(function(){ var page={ init:function(){ bkeruyun.setDefaultDate($("#date-start"), $("#date-end")); bkeruyun.bindStartDateChange($("#date-start"), $("#date-end")); $('#ouySalerQuery').on('click', page.loadData); $('#saleTable').delegate('.salerAccount','click',page.loadOrderList); page.loadData(); }, loadData:function(){ bkeruyun.showLoading(); var date=page.getDate(); var condition = { startDate: date.start, endDate: date.end, commercialId: $("#indicatorsSelect").val() }; $.post("${ctxPath}/report/outSaler/loadChartAndTable?random=" + Math.random(), condition, function (data) { if(!data.list || data.list.length<1){ $('.table-content').hide(); $('.notSearchContent').show(); }else{ $('.notSearchContent').hide(); $('.table-content').show(); } var trs = template('tmpSaleTable', {list: data.list}); $('#saleTable>tbody').html(trs); bkeruyun.hideLoading(); }); }, getDate:function(){ var today = new Date().Format("yyyy-MM-dd"); var $start = $("#date-start"); var $end = $("#date-end"); if (!$start.val()) { $start.val(today); } if (!$end.val()) { $end.val($start.val()); } return { start:$start.val(), end:$end.val() } } }; //初始化 page.init(); });