function queryMonthly(){ var startDate = document.getElementById("startDate").value; var endDate = document.getElementById("endDate").value; var param = { startDate:startDate, endDate:endDate }; console.log(param); // 折线图 $.ajax({ url: "../monthly/top10ByBrandAndSupplier", data: param, contentType:"application/x-www-form-urlencoded", type: 'POST', success: function(data) { document.getElementById("supplierUl").innerHTML = ""; document.getElementById("brandUl").innerHTML = ""; createLi("Brand","Units Sold","brandUl",true); createLi("Supplier","Units Sold","supplierUl",true); console.log(data.top10ByBrand); for(var i = 0 ; i < data.top10ByBrand.length; i++){ createLi(data.top10ByBrand[i].brand,data.top10ByBrand[i].sales,"brandUl",false); } for(var i = 0 ; i < data.top10BySupplier.length; i++){ createLi(data.top10BySupplier[i].supplier,data.top10BySupplier[i].sales,"supplierUl",false); } } }); } function createLi(title,sales,ulId,flag){ var ul = document.createElement("ul") if(flag){ ul.setAttribute("class","th") } var li_1=document.createElement("li"); li_1.innerHTML = title; var li_2=document.createElement("li"); li_2.innerHTML = sales; ul.appendChild(li_1); ul.appendChild(li_2); document.getElementById(ulId).appendChild(ul); } function exportMonthly(){ var startDate = document.getElementById("startDate").value; var endDate = document.getElementById("endDate").value; var params = { startDate:startDate, endDate:endDate }; console.log(params); exportFile('#rrapp', '../monthly/top10ByBrandAndSupplierExport', params); }