12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- function querySportList(page,pagesize,begindate,enddate) {
- //拼请求内容
- d.show();
- var params = {};
- params.page = page;
- params.pagesize = pagesize;
- params.start = begindate+" 00:00:00";
- params.end = enddate+" 23:59:59";
- //发送ajax请求
- sendPost("patient/health_record/list_sports", params, "json", "post", queryListFailed, querySportListSuccesss);
- }
- /**
- * 健康指标图表查询成功处理方法
- */
- function querySportListSuccesss(res) {
- if (res.status == 200) {
- d.close();
- if (res.list.length > 0) {
- //成功
- showList(res.list);
- if(res.list.length<10){
- $("#view_more_sport").hide();
- }else{
- $("#view_more_sport").show();
- }
- }else{
- //无更多数据
- $("#view_more_sport").hide();
- }
- } else {
- queryListFailed(res);
- }
- }
- /**
- * 显示查询结果
- * @param {Object} list
- */
- function showList(list) {
- page = page+1;
- for (var i = 0; i < list.length; i++) {
- var data = list[i];
- if (!data) {
- continue;
- }
- addRowSport(data.record_date, data.sports_time,data.sports_type,data.sports);
- }
- setTimeout(function () {
- scroller1.myScroll.refresh();
- }, 1000);
- }
- /**
- * tbody添加一行tr
- * @param {Object} dateStr
- * @param {Object} value1
- * @param {Object} value2
- */
- function addRowSport(dateStr, sports_time,sports_type,sports) {
- var tb = document.querySelector("#sport_list");
- var tr = document.createElement("tr");
- var html ="";
- if(dateStr.length > 5){
- dateStr = dateStr.substr(5, 5);
- }
- if(dateStr){
- dateStr = dateStr.replace("-",".");
- }
- html+= "<td class='width-25 c-color'>"+dateStr+"</td>";
- html+= "<td class='width-20 c-color'>"+sports_time+"</td>";
- html+= "<td class='width-30 c-color'>"+sports_type+"</td>";
- html+= "<td class='width-25 c-color'>"+sports+"</td>";
- tr.innerHTML = html;
- tb.appendChild(tr);
- }
|