var d = dialog({contentType:'load', skin:'bk-popup'}); $(function(){ var pageIndex = 1 ; var pageSize = 100; var keshilist = 0; var request = GetRequest(); var hospitalId =request["hospitalId"]; var scroller1 = new IScrollPullUpDown('wrapper4',{ probeType:2, bounceTime: 250, bounceEasing: 'quadratic', mouseWheel:false, scrollbars:true, fadeScrollbars:true, click:true, interactiveScrollbars:false },null,null); initHosDept(); //下拉刷新 function pullDownAction(theScrollerTemp) { $(".pullDown").show(); initHosDept(); setTimeout(function () { $(".pullDown").hide(); }, 1000); } //上拉加载数据 function pullUpAction(theScrollerTemp) { if(keshilist%100==0){ $(".pullUp").show(); getHosDeptByHospital(); }else{ dialog({contentType:'tipsbox', skin:'bk-popup' , content:'无更多数据!',bottom:true}).show(); } setTimeout(function () { $(".pullUp").hide(); }, 1000); } $(".div-dept").on("click",".n-list",function(){ var hid = $(this).attr("h-id"); var deptId = $(this).attr("hdept-id"); location.href = "select-doctor.html?hospitalId="+hid+"&deptId="+deptId; }); function initHosDept(){ var pageIndex = 1 ; var keshilist = 0; $(".div-dept").html(""); getHosDeptByHospital(); } function getHosDeptByHospital(){ d.show(); var data={}; data.city = "350200"; data.filter =""; data.hospitalId = hospitalId; data.pageIndex = pageIndex; data.pageSize = pageSize; sendPost('third/guahao/GetOrgDepList', data, 'json', 'post', getListFail, successFun); } function successFun(res){ d.close(); if(res.status==200){ var dataList = res.data; if(dataList&&dataList.length>0){ pageIndex = pageIndex+1; appendHopitalDept(dataList); keshilist = keshilist+dataList.length; }else{ if(keshilist==0||keshilist.length==0){ $(".div-no-info").show(); } dialog({contentType:'tipsbox', skin:'bk-popup' , content:'无更多数据!',bottom:true}).show(); } }else{ getListFail(res); } } function getListFail(res){ d.close(); if (res && res.msg) { if((res.msg).indexOf("SOAP")>=0){ dialog({contentType:'tipsbox', skin:'bk-popup' , content:"医院接口访问异常,请刷新后重试!",bottom:true}).show(); return false; } dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg,bottom:true}).show(); } else { dialog({contentType:'tipsbox', skin:'bk-popup' , content:'加载失败',bottom:true}).show(); } } function appendHopitalDept(dataList){ var deptHtml =""; for(var j in dataList){ var data = dataList[j]; deptHtml+='
'+ ''+ '
'; } $(".div-dept").append(deptHtml); scroller1.myScroll.refresh(); } });