123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- var searchVal = "";
-
- function html_encode(str){
- var s = "";
- if (str.length == 0) return "";
- s = str.replace(/<label class=c-17b3ec>/g, '<label class="c-17b3ec">');
- s = s.replace(/<\/label>/g, "</label>");
- return s;
- }
-
- template.helper("setName", function filters(n, t){
- if(searchVal && t=="sx"){
- var arr = n.split(searchVal);
- return arr.join('<label class=c-17b3ec>'+searchVal+'</label>');
- }
- return n;
- })
-
- /*template.helper("setName", function filters(n, t, i){
- if(t=='sx' && !i && searchVal){
- var arr = n.split(searchVal);
- return arr.join('<label style="color:#17b3ec">'+searchVal+'</label>');
- } else if(i && t!='sx')
- return n;
- return "";
- })*/
-
- template.helper("setAddress", function filters(n){
- var arr = n.split(searchVal);
- return arr.join('<label class=c-17b3ec>'+searchVal+'</label>');
- })
-
- /**
- * 下一步操作
- */
- function submit(isAll){
- if(isAll == 1){
- if(!$('.checked-num').hasClass('disabled'))
- to_next("", 1);
- return;
- }
-
- if(num<=0)
- return;
- plus.nativeUI.showWaiting();
- var patients = [];
- for(var k in checked){
- patients.push(checked[k]);
- }
- to_next(patients);
- plus.nativeUI.closeWaiting();
- }
-
- function to_next(patients, isAll){
- mui.openWindow({
- id: "xuanzejieshouyisheng.html",
- url: "xuanzejieshouyisheng.html",
- extras: {
- jgs: self.jgs,
- patients: patients,
- docCode: docCode,
- teamCode: teamCode,
- type: "分配",
- isAll: isAll || ""
- }
- });
- }
-
-
- function remove(ls, isDom){
- var patient, delNum = 0;
- if(isDom){
- $.each(ls, function(i, v) {
- patient = JSON.parse($(v).attr('data-info'));
- if(checked[patient.code]){
- delNum++;
- delete checked[patient.code];
- }
- });
- } else {
- $.each(ls, function(i, v) {
- if(checked[v.code]){
- delNum++;
- delete checked[v.code];
- }
- });
- }
- num = num - delNum;
- }
-
- function add(ls, isDom){
- var patient, addNum = 0;
- if(isDom){
- $.each(ls, function(i, v) {
- patient = JSON.parse($(v).attr('data-info'));
- if(!checked[patient.code]){
- addNum++;
- checked[patient.code] = patient;
- }
- });
- } else {
-
- $.each(ls, function(i, v) {
- if(!checked[v.code]){
- addNum++;
- checked[v.code] = v;
- }
- });
- }
-
- num = num + addNum;
- }
-
- function refreshTotal(){
- $('.link label').html(num);
- $('.link').toggleClass('c-ccc', num<=0);
- }
-
- $('.doc-list').on('tap', '.doc-item', function(){
- $('.search-box input').blur();
- $(this).toggleClass('checked');
- var info = JSON.parse($(this).attr('data-info'));
- var isAdd = false;
- if($(this).hasClass('checked')){
- add([info]);
- isAdd = true;
- } else {
- remove([info]);
- }
- refreshTotal();
-
- var type = $(this).attr('data-type');
- if(type == "sx"){
- $('#lscroller .doc-list').find('.doc-item[data-code="'+ info.code +'"]').toggleClass("checked", isAdd);
- $('#s-addr .doc-list').find('.doc-item[data-code="'+ info.code +'"]').toggleClass("checked", isAdd);
- } else if(type == "sa"){
- $('#s-xm .doc-list').find('.doc-item[data-code="'+ info.code +'"]').toggleClass("checked", isAdd);
- $('#lscroller .doc-list').find('.doc-item[data-code="'+ info.code +'"]').toggleClass("checked", isAdd);
- }
- })
-
- $('#allSel').on('tap', function(){
- $(this).toggleClass('checked');
- if($(this).hasClass('checked')){
- $(this).next().html("取消全选");
- $('#listDiv .doc-list').find('.doc-item').addClass('checked');
- add($('#listDiv .doc-list').find('.doc-item'), true);
- } else {
- $(this).next().html("全选");
- $('#listDiv .doc-list').find('.doc-item').removeClass('checked');
- remove($('#listDiv .doc-list').find('.doc-item'), true);
- }
-
- refreshTotal();
- })
|