yundong.js 1.8 KB

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