export.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. function excelExport(checkAllSign,checkData,url,sum,token,reservation = null) {
  2. if (checkAllSign) {
  3. if (sum > 10000){
  4. if (!confirm('导出条数超过一万条,耗时可能过长,您确定继续吗?'))return;
  5. }
  6. let thisUrl=document.URL;
  7. let parameter=thisUrl.split('?',2);
  8. url += "?checkAllSign=true";
  9. if (reservation) {
  10. for (let key in reservation){
  11. url += "&"+key+"="+reservation[key];
  12. }
  13. }
  14. if (parameter[1])url+="&"+parameter[1];
  15. location.href=url;
  16. }else {
  17. if (checkData && checkData.length <= 0) {
  18. tempTip.setDuration(3000);
  19. tempTip.showSuccess('没有勾选任何记录');
  20. } else {
  21. let html = '<form hidden method="post" target="_blank" action="'+url+'">' +
  22. '<input name="_token" value="'+token+'">' +
  23. "<input name='data' value='"+checkData+"' >" ;
  24. if (reservation){
  25. for (let key in reservation){
  26. html += '<input name="'+key+'" value="'+reservation[key]+'">';
  27. }
  28. }
  29. html += '</form>';
  30. let form=$(html);
  31. $('body').append(form);
  32. form.submit();
  33. }
  34. }
  35. }