var baseInfo = null,// 基本信息(包括userAgent) baseEnv = null, // 基础环境信息(包括当前webview) self, $searchbarInput = $('.icon-sousuo-btn'),// 搜索输入框 $sendCount = $("#sendCount");//发送数量 var lastTeamId, typeId = 1, //记录排列的值 sendCount = 0, //记录发送的数量 groupId = 0,//记录分组的值 groupName = '',//记录分组的名字 groupData = '',//记录分组的所有数据 type,//转移或分配 docCode,//医生code level,//2全科 3健管 allCount,//所有人数 allGroupData=[],//所有组的数据信息 allGroupCode=[];//所有组的数据code // 获取登录相关信息 var getBaseInfo = function() { var userAgent = JSON.parse(plus.storage.getItem("userAgent")); self = plus.webview.currentWebview(); docCode = self.docCode; level = self.level; type = self.type; return { userAgent: userAgent, teamInfo: JSON.parse(plus.storage.getItem("teamInfo")) } }, // 获取基础环境信息 getBaseEnvPromise = function () { var env = { webview: plus&&plus.webview.currentWebview() }; return Promise.resolve().then(function(res) { return env; }); }, // 初始化选择团队 initTeams = function (){ // lastTeamId = self.teamCode; //从消息列表过来的处理是没有团队code,能够分配健管师的只能是团队长 20171110 rl update if(self.teamCode){ lastTeamId = self.teamCode; }else{ var teams = baseInfo.teamInfo.data, len = teams.length; for(i=0; i5){ $('#sheet3_area').css('height','276px'); }else{ $('#sheet3_area').css('height',46*(num+1)); } }, changeGroupNum = function(obj){ var groupNum; groupId = obj.data('id');//储存组的位置 $('#groupName').text(obj.find('a').text()); //groupId=0为全部分组 if(groupId>0){ groupNum = groupData[groupId-1].number; groupName = groupData[groupId-1].label; }else{ groupNum = allCount; groupName = ''; } var html = template("num_tmpl",{data:groupNum}); $('#numList').empty().append(html); changePeopleNum($('#numList').find('li').eq(0));//取人数初始值 }, changePeopleNum = function(obj){ $('#peopleNum').text(obj.find('a').text()); sendCount = obj.data('num'); $sendCount.text(sendCount);//发送人数 if(sendCount>0){ $('#sendBtn').addClass('active');//变色 }else{ $('#sendBtn').removeClass('active'); } }, // 绑定页面事件 bindEvents = function () { $('#sortList').on('click','.j-choose-name',function(){ var $this = $(this); $('#sortName').text($this.find('a').text()); typeId = $this.data('type'); mui('#sheet2').popover('toggle'); initPatientGroupsList(); $sendCount.text(0); sendCount=0; groupId = 0; allGroupData=[];//所有组的数据信息 allGroupCode=[]; }) $('#groupList').on('click','.j-choose-name',function(){ var $this = $(this); changeGroupNum($this); mui('#sheet3').popover('toggle'); }) $('#numList').on('click','.j-choose-name',function(){ var $this = $(this); changePeopleNum($this); mui('#sheet4').popover('toggle'); }) $searchbarInput.on('click',function() { mui.openWindow({ id: "zhuanyijumin_search", url: "zhuanyijumin_search.html", extras: { type:type, docCode:docCode, level:level, lastTeamId:lastTeamId, } }); }) $("#sendBtn").on('click',function(){ if(sendCount<=0){ mui.toast('请至少选一个居民!'); return; } plus.nativeUI.showWaiting(); //取居民code var pCode=[], patientArr=[]; if(groupId>0){//不是全部分组 for(var i=0;i