123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- 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 = "<li id='tishi_add' class='c-list-text c-list-link' >"
- _htm+= "<div class='c-list-key'style='margin:0 auto;'>您还没有设备,赶快添加吧</div>"
- _htm+="</li>"
- $("#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+="<li class='c-list-text c-list-link' attr_code="+data.code+" attr_name="+data.name+" attr_sn="+data.sn+">"
- _html+="<div class='c-list-key'>"+data.name+"</div>"
- _html+="<div class='c-list-info c-t-right'>"+data.sn+"</div>"
- _html+="<span class='list-icon arrow-right'></span>"
- _html+="</li>";
-
- }
- $("#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<reso.list.length;i++){
- if(reso.list[i].code==category){
- type_name=reso.list[i].name;
- var befor_url="equipment-detail.html";
- //拼接url参数
- var _url=""+befor_url+"?code="+attr_code+"&category="+category+"&type_name="+type_name+"&name="+attr_name+"&sn="+attr_sn+"";
- //字符串转码(中文)
- var e_url = encodeURI(encodeURI(_url));
- window.location.href=e_url;
- }
- }
- }
- }
- })
- }
-
|