xueya.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. function queryList2(page,pageSize) {
  2. //显示进度条
  3. // plus.nativeUI.showWaiting();
  4. //发送请求
  5. queryListByType(2,page, pageSize, queryListSuccesss1,begindate,enddate);
  6. }
  7. /**
  8. * 血压
  9. * 健康指标图表查询成功处理方法
  10. */
  11. function queryListSuccesss1(res) {
  12. if (res.status == 200) {
  13. d.close();
  14. if (res.list.length > 0) {
  15. showList1(res.list);
  16. if(res.list.length<10){
  17. $("#view_more2").hide();
  18. }else{
  19. $("#view_more2").show();
  20. }
  21. }else{
  22. $("#view_more2").hide();
  23. }
  24. } else {
  25. //非200则为失败
  26. queryListFailed(res);
  27. }
  28. }
  29. /**
  30. *
  31. * 显示查询结果
  32. * @param {Object} list
  33. */
  34. function showList1(list) {
  35. page = page+1;
  36. for (var i = 0; i < list.length; i++) {
  37. var data = list[i];
  38. if (!data){
  39. continue;
  40. }
  41. addRow1(data.date.substr(5, 11), toIntValue(data.value1), toIntValue(data.value2));
  42. }
  43. setTimeout(function () {
  44. scroller1.myScroll.refresh();
  45. }, 1000);
  46. }
  47. /**
  48. * 血压
  49. * tbody添加一行tr
  50. * @param {Object} dateStr
  51. * @param {Object} value1
  52. * @param {Object} value2
  53. */
  54. function addRow1(dateStr, value1, value2) {
  55. if (dateStr.length > 11) {
  56. dateStr = dateStr.substr(5, 11);
  57. }
  58. if(dateStr){
  59. dateStr = dateStr.replace("-",".");
  60. }
  61. var tb = document.querySelector("#item1");
  62. var tr = document.createElement("tr");
  63. var html = '<td class="width-40 c-color">' + dateStr + '</td>';
  64. html += getTD1(value1, 139, 90);
  65. html += getTD1(value2, 89, 60);
  66. tr.innerHTML = html;
  67. tb.appendChild(tr);
  68. }
  69. function getTD1(value, max, min) {
  70. if(value == 0 || isNaN(value)){
  71. return '<td class="width-20"></td>';
  72. }
  73. if (value > max) {
  74. return '<td class="width-20 c-f00">' + value + '</td>';
  75. } else if (value < min) {
  76. return '<td class="width-20 c-007cd9">' + value + '</td>';
  77. } else {
  78. return '<td class="width-20 c-color">' + value + '</td>';
  79. }
  80. }