123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- mui.plusReady(function(){
- var $ul = $('.lc-list'),
- $del = $('.u-icon-delete'),
- $input = $('#search-input'),
- $head = $('.lc-select');
- var self=plus.webview.currentWebview();
- var diagnosis = self.diagnosis;
- var $noResultWrap = $('#no_result_wrap');
- if(diagnosis.length>0){
- var html='';
- $.map(diagnosis,function(item,index){
- html +='<li data-id="'+item.code+'">'+item.name+'</li>'
- })
- $head.append(html).show()
- }
-
- $input.on('input',function(){
- var $val = $(this).val().trim();
- $noResultWrap.hide()
- $del.hide()
- $ul.empty().hide()
- if($val.length>0){
- $del.show();
- searchText($val)
- }
- })
-
- function searchText(nameKey){
- var params = {
- nameKey:nameKey
- }
- sendPost("doctor/prescriptionInfo/getIcd10Info",params, function(){
- mui.toast("获取数据失败");
- }, function(res){
- if(res.status == 200){
- if(res.data.length>0){
- var html = template('result_tmp',{data:res.data});
- $ul.html(html).show();
- findKeyName();
- }else{
- $noResultWrap.show()
- $ul.empty().hide()
- }
- }else{
- mui.toast("获取数据失败");
- }
- },'get')
- }
-
- mui('.mui-scroll-wrapper').scroll({
- bounce: false
- })
- //变色 添加
- $ul.on('tap','li',function(){
- var $this = $(this);
- if($this.hasClass('active')){
- $this.removeClass('active')
- for(var i=0;i<$head.find('li').length;i++){
- var $one = $head.find('li').eq(i)
- if($one.attr('data-id')==$this.attr('data-id')){
- $one.remove();
- }
- }
- }else{
- if($head.find('li').length<3){
- $this.addClass('active')
- $head.append('<li data-id="'+$this.attr('data-id')+'">'+$this.text()+'</li>')
- }else{
- mui.toast('最多只能三个')
- }
- }
- showHead()
- })
- //删除
- $head.on('tap','li',function(){
- var $this = $(this);
- $this.remove();
- $noResultWrap.hide()
- $ul.empty().hide()
- showHead()
- })
- function showHead(){
- if($head.find('li').length == 0){
- $head.hide()
- }else{
- $head.show()
- }
- //计算高度
- $('.mui-scroll-wrapper').css('top',$head.height()+107)
- }
- //清空
- $del.click(function(){
- $input.val('')
- $del.hide()
- $noResultWrap.hide()
- $ul.empty().hide()
- })
- //循环列表
- function findKeyName(){
- for(var i=0;i<$head.find('li').length;i++){
- var $one = $head.find('li').eq(i)
- for(var j=0;j<$ul.find('li').length;j++){
- var $this = $ul.find('li').eq(j)
- if($one.attr('data-id')==$this.attr('data-id')){
- $this.addClass('active')
- }
- }
- }
- }
- //确定
- $('.header-link').click(function(){
- if($head.find('li').length == 0){
- mui.toast('临床诊断不能为空')
- return
- }
- var arr = []
- for(var i=0;i<$head.find('li').length;i++){
- var $one = $head.find('li').eq(i)
- var obj={}
- obj.name = $one.text();
- obj.code = $one.attr('data-id');
- arr.push(obj);
- }
- plus.storage.setItem("reviseDiagnosis",JSON.stringify(arr))
- //新增
- var page = plus.webview.getWebviewById("change-chufang2");
- if(page){
- mui.fire(page, "reviseDiagnosis");
- }
- mui.back();
- })
- })
|