123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- var myScroll, jgs, docCode, self,teamId,typeId,group,sendCount,patients,type;
- var timeOut,timeOut1;
- mui.plusReady(function(){
- loaded();
- self = plus.webview.currentWebview();
- teamId = self.teamCode;
- typeId = self.typeId;//类型
- group = self.group;//分组
- sendCount = self.sendCount;//发送数
- patients = self.patients;//居民code集合
- type = self.type;//分配或转移
- docCode = self.docCode;//医生code
- $('.demo-comtop h1').html(type == "转移" ? "选择接收医生" : "分配居民-选择健管师");
- getJgs();
- })
- function getJgs(){
- plus.nativeUI.showWaiting();
- getReqPromises(
- [
- {url: "/doctor/admin-teams/"+ teamId +"/members", reqType: "GET"},
- {url: "/doctor/admin-teams/teams/"+ teamId +"/signing/count", reqType: "GET"}
- ]
- ).then(function(datas) {
- if(datas[0].status==200 && datas[1].status==200){
- jgs= [];
- $.each(datas[0].data, function(i, v) {
- v.qyzs = datas[1].data[v.code];
- if(self.level==2){
- if(v.level == 2){
- jgs.push(v);
- }
- } else {
- if(v.level == 3 || v.level == 2)
- jgs.push(v);
- }
- })
- initDocList();
- }else{
- mui.toast("获取成员数据失败!");
- }
- plus.nativeUI.closeWaiting();
- }).catch(function(e){
- mui.toast(e.msg);
- })
- }
- template.helper('isNotZyDoc', function(c){
- return c!=docCode;
- })
- function initDocList(){
- $('.doc-list').html(template('docs_tmpl', {data: jgs, code: docCode}));
- myScroll.refresh();
- }
- function loaded () {
- document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
- myScroll = new IScroll('#wrapper', { mouseWheel: true });
- }
- $('.doc-list').on('tap', '.doc-item', function(){
- if($(this).hasClass('checked'))
- return;
- $('.doc-item.checked').removeClass('checked');
- $(this).addClass('checked');
- $('.link').removeClass('c-ccc');
- })
- function submit(){
- var $dom = $('.doc-item.checked');
- if($dom.length<=0)
- return;
- var url = self.level==2? '/doctor/updateTeamDoctors' : '/doctor/allotOrMoveHealth';//2为全科
- var docName = $dom.attr('data-name');
- var tip = "是否确认将"+sendCount+"个居民"+type+"给"+ docName +"医生管理?";
- mui.confirm(tip, "提示", ["确定"+type, "不了,谢谢"], function(e){
- if(e.index == 0){
- plus.nativeUI.showWaiting();
- //搜索居民,分组选择居民方式
- if(patients){
- var p = {
- teamId: teamId,
- oldDoctorCode: docCode || "",
- newDoctorCode: $dom.attr('data-code'),
- patients: patients
- }
- sendMsg(url,p);
- }else{
- //分组选择居民方式(废弃)
- var p = {
- teamId: teamId,
- typeId:typeId,
- group:group,
- sendCount:sendCount*1,
- oldDoctorCode: docCode || "",
- newDoctorCode: $dom.attr('data-code'),
- }
- sendMsg(url,p);
- }
- }
- })
- }
- function backIndex(){
- refreshHz();
- var last = plus.webview.getWebviewById("zhuanyijumin_search"); //删掉搜索页面
- if(last){
- last.close('none');
- }
- var last1 = plus.webview.getWebviewById("zhuanyijumin");
- if(last1){
- last1.close('none');
- }
- var lay = plus.webview.getWebviewById("zyjm-layer.html");
- if(lay){
- lay.close('none');
- }
- var last2 = plus.webview.getWebviewById("qianyuejumin");
- if(last2){
- last2.close('none');
- }
- var last3 = plus.webview.getWebviewById("zuyuanziliao");
- if(last3){
- last3.close('none');
- }
- mui.back();
- }
- function sendMsg(url,p){
- sendPost(url, p, function(res){
- plus.nativeUI.closeWaiting();
- window.clearTimeout(timeOut);
- window.clearTimeout(timeOut1);
- mui.toast(res.msg);
- }, function(res){
- plus.nativeUI.closeWaiting();
- window.clearTimeout(timeOut);
- window.clearTimeout(timeOut1);
- if(res.status==200){
- mui.toast("成功"+type+"居民");
- backIndex();
- }else{
- mui.toast(res.msg);
- }
- }, "POST", 600000)
-
- //如果是观察者模式,则不开始计时器的计算
- var userAgent = JSON.parse(plus.storage.getItem("userAgent"));
- if(!userAgent.observer){
- timeOut = setTimeout(function(){
- plus.nativeUI.closeWaiting();
- dialog({
- content: '<div class="c-f16 c-323232">后台正在处理您的请求,结束后将自动跳转,您可先处理其他事宜</div>',
- okValue: '继续等待',
- cancelValue: '返回首页',
- cancel: function () {
- backIndex();
- },
- ok: function() {
- plus.nativeUI.showWaiting();
- againLoad();
- }
- }).showModal();
- },30000)
- }
-
- }
- function againLoad(){
- timeOut1 = setTimeout(function(){
- plus.nativeUI.closeWaiting();
- dialog({
- content: '<div class="c-f16 c-323232">后台正在处理</div>',
- okValue: '继续等待',
- cancelValue: '返回首页',
- cancel: function () {
- backIndex();
- },
- ok: function() {
- plus.nativeUI.showWaiting();
- againLoad()
- }
- }).showModal();
- },30000)
- }
- function refreshHz(){
- var page1 = plus.webview.getWebviewById("huanzhe.html");
- if(page1){
- mui.fire(page1, "refreshWfp");
- }
- }
|