yundong.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. function querySportList(page,pagesize,begindate,enddate) {
  2. //拼请求内容
  3. d.show();
  4. var params = {};
  5. params.page = page;
  6. params.pagesize = pagesize;
  7. params.start = begindate+" 00:00:00";
  8. params.end = enddate+" 23:59:59";
  9. //发送ajax请求
  10. sendPost("patient/health_record/list_sports", params, "json", "post", queryListFailed, querySportListSuccesss);
  11. }
  12. /**
  13. * 健康指标图表查询成功处理方法
  14. */
  15. function querySportListSuccesss(res) {
  16. if (res.status == 200) {
  17. d.close();
  18. if (res.list.length > 0) {
  19. //成功
  20. showList(res.list);
  21. if(res.list.length<10){
  22. $("#view_more_sport").hide();
  23. }else{
  24. $("#view_more_sport").show();
  25. }
  26. }else{
  27. //无更多数据
  28. $("#view_more_sport").hide();
  29. }
  30. } else {
  31. queryListFailed(res);
  32. }
  33. }
  34. /**
  35. * 显示查询结果
  36. * @param {Object} list
  37. */
  38. function showList(list) {
  39. page = page+1;
  40. for (var i = 0; i < list.length; i++) {
  41. var data = list[i];
  42. if (!data) {
  43. continue;
  44. }
  45. addRowSport(data.record_date, data.sports_time,data.sports_type,data.sports);
  46. }
  47. setTimeout(function () {
  48. scroller1.myScroll.refresh();
  49. }, 1000);
  50. }
  51. /**
  52. * tbody添加一行tr
  53. * @param {Object} dateStr
  54. * @param {Object} value1
  55. * @param {Object} value2
  56. */
  57. function addRowSport(dateStr, sports_time,sports_type,sports) {
  58. var tb = document.querySelector("#sport_list");
  59. var tr = document.createElement("tr");
  60. var html ="";
  61. if(dateStr.length > 5){
  62. dateStr = dateStr.substr(5, 5);
  63. }
  64. if(dateStr){
  65. dateStr = dateStr.replace("-",".");
  66. }
  67. html+= "<td class='width-25 c-color'>"+dateStr+"</td>";
  68. html+= "<td class='width-20 c-color'>"+sports_time+"</td>";
  69. html+= "<td class='width-30 c-color'>"+sports_type+"</td>";
  70. html+= "<td class='width-25 c-color'>"+sports+"</td>";
  71. tr.innerHTML = html;
  72. tb.appendChild(tr);
  73. }