123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- function queryYinshiList(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_diet", params, "json", "post", queryListFailed, queryYinshiListSuccesss);
- }
- /**
- * 健康指标图表查询成功处理方法
- */
- function queryYinshiListSuccesss(res) {
- if (res.status == 200) {
- d.close();
- if (res.list.length > 0) {
- showYinshiList(res.list);
- if(res.list.length<10){
- $("#view_more_yinshi").hide();
- }else{
- $("#view_more_yinshi").show();
- }
- }else{
- $("#view_more_yinshi").hide();
- }
- } else {
- queryListFailed(res);
- }
- }
- /**
- * 显示查询结果
- * @param {Object} list
- */
- function showYinshiList(list) {
- page = page+1;
- for (var i = 0; i < list.length; i++) {
- var data = list[i];
- if (!data) {
- continue;
- }
- //data.date.substr(5, 5) --只有月-日
- addRowYinshi(data.record_date, data.content,data.images);
- }
- setTimeout(function () {
- scroller1.myScroll.refresh();
- }, 1000);
- }
- /**
- * 清空tbody
- */
- function clearHTML() {
- $("#diet_list").html("");
- }
- /**
- * tbody添加一行tr
- * @param {Object} dateStr
- * @param {Object} value1
- * @param {Object} value2
- */
- function addRowYinshi(record_date, content,images) {
- // if(dateStr.length > 5){
- // dateStr = dateStr.substr(5, 5);
- // }
- var tb = document.querySelector("#diet_list");
- var tr = document.createElement("tr");
- if(record_date.length > 5){
- record_date = record_date.substr(5, 5);
- }
- if(record_date){
- record_date = record_date.replace("-",".");
- }
- var pict= new Array(); //定义一数组
- pict=images.split(","); //字符分割
- var img_html="";
- for (i=0;i<pict.length ;i++ )
- {
- // document.write(+"<br/>"); //分割后的字符输出
- img_html+="<img src='"+getImgUrl(pict[i])+"' width='40' height='40' style='display:inline-block; vertical-align:middle; margin-right:10px;' onclick='viewImg(this)'/>"
- }
- var html ="";
-
- html+="<tr>"
- html+= "<td class='width-40 c-color'>"+record_date+"</td>"
- html+= "<td class='width-60 c-color' style='text-align:left;'>"+img_html+content+"</td>"
- html+="</tr>"
-
- tr.innerHTML = html;
- tb.appendChild(tr);
- }
- //查看图片
- function viewImg(dom) {
- var $img = $(dom);
- var thissrc = $img.attr("src");
- var mWid = $(window).width();
- var mHei = $(window).height();
- var nHtml = '<div class="delimgpop"><div class="del-img-box"><div class="del-img-con"><img class="del-pop-img" src="' + thissrc + '" style="max-width:' + mWid + 'px; max-height:' + mHei + 'px;"></div></div></div>';
- $("body").append(nHtml);
- $(".delimgpop").click(function() {
- $(this).remove()
- });
- };
|