export.js 1.5 KB

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