var d = dialog({contentType:'load', skin:'bk-popup'}); var pagetype = 14; $(function() { queryList(); }); function queryList() { d.show(); //拼请求内容 var params = {}; params.id = 0; params.pagesize = 60; //发送ajax请求 sendPost("patient/device/list", params, "json", "post", queryListFailed, queryListSuccesss); } function queryListFailed(res) { d.close().remove(); if (res && res.msg) { var d1 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}); d1.show(); } else { var d2 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}); d2.show(); } } function queryListSuccesss(res) { if (res.status == 200) { if(res.data.list.length==0){ //没有一个设备 var _htm = "" $("#equ_list").html(_htm); }else{ //有设备 showList(res.data.list); } d.close().remove(); } else { //非200则为失败 queryListFailed(res); } } /** * 清空tbody */ function clearHTML() { $("#equ_list").html(""); } /** * 显示查询结果 * @param {Object} list */ function showList(list) { clearHTML(); var _html = ""; for (var i = 0; i < list.length; i++) { var data = list[i]; if (!data) { continue; } _html+=""; } $("#equ_list").html(_html); $("#equ_list").on("click","li",function(){ var attr_code = $(this).attr('attr_code'); var attr_name = $(this).attr('attr_name'); var attr_sn = $(this).attr('attr_sn'); //获取现在有的设备类别以及名称 var params = {} params.code = attr_code; var dev_list={}; //发送ajax请求, 查询设备列表信息 sendPost("patient/device/info", params, "json", "post", queryListFailed,device_info_Successs); function device_info_Successs(res){ var category=res.data.category; var type_name=''; //发送ajax请求, 查询设备类型 sendPost("patient/device/category"," ", "json", "post", queryListFailed,device_type_Successs); function device_type_Successs(reso){ dev_list=reso.list; for(var i=0;i