123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- var myScroll, searchIscroll, checked= {},
- docCode, teamCode, self, num = 0, curDocCode, isSearch;
- mui.plusReady(function(){
- self = plus.webview.currentWebview();
- docCode = self.docCode;
- teamCode = self.teamCode;
- curDocCode = getUid();
-
- myScroll = $('#lscroller .doc-list').lscroll({style: "top: 105px;bottom: 48px",
- pullUpAction: function(g){
- getDfpPatiLs(g.options.page);
- }
- });
-
- searchIscroll = $('#search_scroller').lscroll(
- {style: "top: 105px;bottom: 48px"});
-
- if(!teamCode){
- sendGet("/doctor/admin-teams/team/"+ curDocCode +"/team", {}, null, function(res){
- console.log(JSON.stringify(res))
- if(res.status == 200){
- teamCode = res.data.id;
- getDfpPatiLs(1);
- } else {
- mui.toast("获取团队长团队出错!");
- }
- })
- } else
- getDfpPatiLs(1);
-
- })
-
- template.helper("isChecked", function(code){
- if(checked[code])
- return "checked";
- })
-
- function getDfpPatiLs(page){
- plus.nativeUI.showWaiting();
- sendGet("/doctor/family_contract/findNoHealthSignFamilyHealth",
- {doctor: curDocCode, page: page, pageSize: 50}, null, function(res){
- if(res.status == 200){
- console.log(JSON.stringify(res))
- if(page==1 && (!res.data.list || res.data.list.length==0)){
- $('.checked-num').addClass('disabled');
- $('#wushuju').show();
- $('.lin-footer').hide();
- $('#lscroller').hide();
- } else {
- $('.checked-num').removeClass('disabled');
- $('#allSel').removeClass("checked").next().html("全选");
- var allPage = res.data.count;
- res.data = res.data.list;
- $('#lscroller .doc-list').append(template('pati_tmpl', res));
- myScroll.refresh(page >= allPage);
- }
- plus.nativeUI.closeWaiting();
- } else
- mui.toast(res.msg)
- })
- }
-
- function searchPatiLs(val){
- var url = "/doctor/family_contract/findNoHealthSignFamilyHealth";
- getReqPromises(
- [{url: url,data: {doctor: curDocCode, page: 1, pageSize: 3, patientName: val}},
- {url: url,data: {doctor: curDocCode, page: 1, pageSize: 3, patientAddr: val}}]
- ).then(function(data){
- if(data[0].status==200 && data[1].status==200){
- var rs = data[0].data;
- var hasRs = false;
- searchVal = val;
- var html = "";
- if(rs.list && rs.list.length>0){
- html = template("pati_tmpl", {data: rs.list, type: "sx"});
- $('#s-xm .doc-list').html(html_encode(html));
- $('#s-xm .jm-more').toggle(rs.count>1);
- $('#s-xm').show();
- hasRs = true;
- } else{
- $('#s-xm').hide();
- }
-
- rs = data[1].data;
- if(rs.list && rs.list.length>0){
- html = template("pati_tmpl", {data: rs.list, type: "sa"});
- $('#s-addr .doc-list').html(html_encode(html));
- $('#s-addr .jm-more').toggle(rs.count>1);
- $('#s-addr').show();
- hasRs = true;
- } else{
- $('#s-addr').hide();
- }
-
- $('.loading').hide();
- if(hasRs){
- $('#search_scroller').show();
- $('#wushuju1').hide();
- } else {
- $('#search_scroller').hide();
- $('#wushuju1').show();
- }
- searchIscroll.refresh();
- } else {
- mui.toast("查询数据失败!");
- }
- }).catch(function(e){
- mui.toast("查询数据失败!");
- console && console.error(e);
- })
- }
-
- function resetSearch(){
- isSearch = false;
- $delBtn.hide();
- $('#searchDiv').hide();
- $('#listDiv').show();
- $('.lin-footer').show();
- // $('#allSel').show().next().show();
- }
-
- var $delBtn = $('.u-icon-delete');
- var $searchIpt = $('.search-box input');
- $delBtn.on('tap', function(){
- $(this).hide();
- $searchIpt.val("");
- resetSearch()
- })
-
- $searchIpt.on('input', function(){
- var val = $.trim($(this).val()).replace(/\'/g,"");
- if(val.length==0){
- resetSearch();
- } else {
- isSearch = true;
- $delBtn.show();
- $('.lin-footer').hide();
- // $('#allSel').hide().next().hide();
- $('#wushuju1').hide();
- $('#listDiv').hide();
- $('#search_scroller').hide();
- $('.loading').show();
- $('#searchDiv').show();
- searchPatiLs(val);
- }
- })
-
- $('.jm-more').on('tap', function(){
- var type1 = $(this).attr('data-type');
- mui.openWindow({
- id: "fp-search-more.html",
- url: "fp-search-more.html",
- extras: {
- docCode: docCode,
- teamCode: teamCode,
- type: type1,
- num: num,
- checked: checked,
- val: $.trim($('.search-box input').val())
- }
- });
- })
- window.addEventListener("updateCheck", function(e){
- checked = e.detail.checked;
- num = e.detail.num;
- refreshTotal();
-
- $('.doc-item.checked').removeClass('checked')
- for(var k in checked){
- $('.doc-item[data-code="'+ k +'"]').addClass('checked');
- }
- })
|