var d= dialog({contentType:'load', skin:'bk-popup'}).show(); var Requests = GetRequest(), medicalNo = Requests.medicalNo; getReqPromise('patient/archives/medical_detail',{ medicalNo: medicalNo },'JSON','POST').then(function(res){ d.close(); var data = {}; if(res.status == 200) { data = res.medical_detail; } else { mui.toast(res.msg); } var vm = avalon.define($.extend({},{"$id": "viewController"},{ data: data })); avalon.scan(); }).catch(function(e) { d.close(); console && console.error(e); }) .then(function() { function showAutoItems(el) { var $item = $(el).closest('[auto-item]'); if($item.length && $item.is(":hidden")) { $item.removeClass('elastic-columns-ignore') $item.show(); showAutoItems($item.parent()); } } _.each($('[item-value]'),function(el) { var $el = $(el); var text = $.trim($el.text()); if(text) { showAutoItems($el); } }) }) .then(function() { $('.c-panel').on('click','.c-panel-bar',function() { var $panel = $(this).closest('.c-panel'), $content = $panel.find('.c-panel-content'); $('.c-panel.expanding').not($panel[0]).removeClass('expanding').find('.c-panel-content').slideUp(); $panel.toggleClass('expanding'); if($panel.hasClass('expanding')) { var $container = $panel.find('.card-layout'); $content.slideDown(function() { if($container.length) { $container.elasticColumns( { columns: 2, // the number of colums innerMargin: 5, // the gap between two tiles outerMargin: 5 // the gap between the tiles and // the edge of the container }); } }); } else { $content.slideUp(); } }); }).catch(function(e) { d.close(); console && console.error(e); })