123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- var pageIndex = 1 ;
- var pageSize = 100;
- var hospitalId = null;
- var patient = null;
- var xtCode = "";
- var dept_scroller = null;
- mui.init();
- mui.plusReady(function() {
- var self = plus.webview.currentWebview();
- hospitalId=self.hospitalId;
- patient =self.patient;
- xtCode = self.xtCode
- initScroller();
- initHosDept();
- bindEvents();
- });
- function initScroller(){
- dept_scroller = $("#wrapper4").initScroll(
- {
- pullDownAction: function(){
- initHosDept();
- },pullUpAction: function() {
- updatePullUpText(dept_scroller,new Array());
- }
- }
- );
- }
- var updatePullUpText= function(scroller,list) {
- var $wrap = $(scroller.wrapper),
- $pullupLabel = $wrap.find('.pullUpLabel');
- $(".pullUp").removeClass("loading");
- if(!list || !list.length) {
- $pullupLabel.text('没有更多');
- } else {
- $pullupLabel.text('上拉加载更多');
- }
- scroller.on('refresh',function() {
- if(!list || !list.length) {
- $pullupLabel.text('没有更多');
- } else {
- $pullupLabel.text('上拉加载更多');
- }
- })
- }
-
- function bindEvents(){
- $(".div-dept").on("click",".n-list",function(){
- var hid = $(this).attr("h-id");
- var deptId = $(this).attr("hdept-id");
- var params = {};
- params.hospitalId = hospitalId;
- params.deptId = deptId;
- params.patient = patient;
- params.xtCode = xtCode;
- openWebviewExtras("select-doctor.html",params);
- });
- }
-
- function initHosDept(){
- pageIndex = 1 ;
- $(".div-dept").html("");
- $('#wrapper4').hide()
- getHosDeptByHospital();
- }
-
- function getHosDeptByHospital(){
- var data={};
- data.city = "350200";
- data.filter ="";
- data.hospitalId = hospitalId;
- data.pageIndex = pageIndex;
- data.pageSize = pageSize;
- sendPost('third/guahao/GetOrgDepList', data, getListFail,successFun);
- }
-
- function successFun(res){
- if(res.status==200){
- var dataList = res.data;
- appendHopitalDept(dataList);
- updatePullUpText(dept_scroller,dataList);
- }else{
- getListFail(res);
- }
- }
-
- function getListFail(res){
- if(res && res.msg) {
- mui.toast(res.msg);
- } else {
- mui.toast("数据加载失败!");
- }
- }
-
- function appendHopitalDept(dataList){
- var deptHtml ="";
- for(var j in dataList){
- var data = dataList[j];
- deptHtml+='<div class="n-list c-border-b" h-id="'+data.hospitalId+'" hdept-id="'+data.id+'">'+
- '<div class="n-list-li n-list-link ptb12">'+
- '<div class="n-list-info">'+
- '<h4 class="c-323232 c-f16">'+data.name+'</h4>'+
- '</div>'+
- '<span class="list-icon arrow-right" style="margin-top:7px;"></span>'+
- '</div>'+
- '</div>';
- }
- $(".div-dept").append(deptHtml)
- $('#wrapper4').show()
- setTimeout(function(){
- dept_scroller.refresh();
- },200);
- }
|