common.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. function isEmpty(obj){
  2. if(typeof obj == "undefined" || obj == null || obj == ""){
  3. return true;
  4. }else{
  5. return false;
  6. }
  7. }
  8. // 导出Excel
  9. function dc() {
  10. var title = $("#title").text();
  11. var year = $("#year").val() ;
  12. var myDate = new Date();
  13. alert(countdown()+year+"_"+title);
  14. $("#add").tableExport({fileName: countdown()+year+"_"+title,type:"xlsx",escape:"false"});
  15. }
  16. function countdown() {
  17. var myDate = new Date();
  18. //获取当前年
  19. var year=myDate.getFullYear();
  20. //获取当前月
  21. var month=myDate.getMonth()+1;
  22. //获取当前日
  23. var date=myDate.getDate();
  24. var h=myDate.getHours(); //获取当前小时数(0-23)
  25. var m=myDate.getMinutes(); //获取当前分钟数(0-59)
  26. var s=myDate.getSeconds();
  27. var now=year+getNow(month)+getNow(date)+getNow(h)+getNow(m)+getNow(s);
  28. // 赋值给展示时间
  29. // $('#Times').html('系统时钟:'+now);
  30. return now;
  31. }
  32. // 获取当前时间
  33. function getNow(s) {
  34. return s < 10 ? '0' + s: s;
  35. }