common.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. jQuery(function($){
  2. // 상속
  3. mplus_common.call(this);
  4. // super
  5. var self = this;
  6. /* 높이 계산 */
  7. $(window).on('load resize',function(){
  8. wh=$(window).height();
  9. $('#page').height(wh);
  10. max=(wh-85);
  11. max2=(wh-40);
  12. $('.main-content').height(max2); //탭바꾸면 요 태그로 써야합니다.
  13. $('.main-content .tab-content .tab-pane').height(max2-20);
  14. $('.detail-main-content').height(max2);
  15. $('.detail-main-content2').height(wh-80);
  16. $('.detail-main-content2 .tab-content .tab-pane').height(wh-85);
  17. $('#sidebarMenu').height(wh);
  18. $('.sidebar-menu-inner>ul').height($('#sidebarMenu').height()-60);
  19. if ($('#openToggle').is('.on')){
  20. $('#openToggle').stop().animate({bottom: wh-140 },500);
  21. $('#nursingPopup').height(max2-105);
  22. $('#nursingPopup .tab-content .tab-pane').height(max2-177);
  23. }
  24. /*$('.tab-content').height(wh-140)
  25. $('.card-box').height($('.tab-content').height()-30)*/
  26. });
  27. $('#menuToggle').on('click',function(){
  28. $('#sidebarMenu').stop().animate({right:0},500);
  29. $(this).removeClass('cl');
  30. });
  31. $('#closeBtn').on('click',function(){
  32. $('#sidebarMenu').stop().animate({right:-5000},500);
  33. $('#sidebarMenu li a').removeClass('active');
  34. });
  35. $(".popFootContent .btn-group > .btn").click(function(){
  36. $(".popFootContent .btn-group > .btn").removeClass("active");
  37. });
  38. $('.sidebar-menu-inner>ul> li>a').on('click',function(){
  39. if ($(this).is('.active')) {
  40. $('.sidebar-menu-inner>ul> li>ul').stop().slideUp();
  41. $('.sidebar-menu-inner>ul> li>a').removeClass('active');
  42. $('.sidebar-menu-inner>ul> li>a .fa').removeClass('fa-minus-circle');
  43. $('.sidebar-menu-inner>ul> li>a .fa').addClass('fa-plus-circle');
  44. }else{
  45. $('.sidebar-menu-inner>ul> li>ul').hide();
  46. $(this).next().stop().slideDown();
  47. $('.sidebar-menu-inner>ul> li>a').removeClass('active');
  48. $(this).addClass('active');
  49. $(this).find('.fa').removeClass('fa-plus-circle');
  50. $(this).find('.fa').addClass('fa-minus-circle');
  51. }
  52. });
  53. $('#sidebarMenu').click(function(e){
  54. if(e.target.parentElement.className=='top-header'){
  55. $('#sidebarMenu').stop().animate({right:-5000},500);
  56. $('#sidebarMenu li a').removeClass('active');
  57. }
  58. });
  59. $('#openToggle').on('click',function(){
  60. if ($(this).is('.on')) {
  61. $(this).stop().animate({bottom:10},500);
  62. $('#overlay').stop().animate({bottom:-290},500);
  63. $('#nursingPopup').stop().animate({bottom:-max},500);
  64. $('#patientList, #outPatientList, #emerPatientList, #searchPatientList').css('margin-bottom', '0');
  65. $(this).removeClass('on');
  66. $(this).find('.fa').removeClass('fa-chevron-down');
  67. $(this).find('.fa').addClass('fa-chevron-up');
  68. }else{
  69. if(window.location.search.split('=')[1]=='clinic'){ //진료화면
  70. if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabIn'
  71. ||$("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabOut'
  72. ||$("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabEmer'){ //진료/외래/응급 탭
  73. if($('#nursingPopupId').text()=='' && $('#nursingPopupNameNum').text()==''){
  74. self.alert('환자를 선택해주세요.');
  75. return;
  76. } else{
  77. var patientId = JSON.parse(localStorage.patientInfo).patientId;
  78. $('.list-group-item[patientId='+patientId+']').addClass('active');
  79. $('#nursingPopup [id*=popContent]').removeClass('in');
  80. $('#nursingPopup #popContentNursingRecode').addClass('in');
  81. if(!$('#openToggle').is('.on')){
  82. $('#nursingRecodeTab.nav-tabs a[href="#tabInfo"]').tab('show');
  83. }else{
  84. mplusNursing.reInit($("ul#nursingRecodeTab.nav-tabs li.active a").attr('aria-controls'));
  85. }
  86. $('#newPopupFooter').css('display', 'block');
  87. // 선택한 환자의 스크롤 위치 구하기
  88. if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabIn'){
  89. var pos = $('#tabIn').scrollTop() + $('#inUlPatientList li a.list-group-item[patientId='+patientId+']').offset().top;
  90. $('#patientList').css('margin-bottom', '100vh');
  91. }else if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabOut'){
  92. var pos = $('#tabOut').scrollTop() + $('#outUlPatientList li a.list-group-item[patientId='+patientId+']').offset().top;
  93. $('#outpatientList').css('margin-bottom', '100vh');
  94. }else{
  95. var pos = $('#tabEmer').scrollTop() + $('#emerUlPatientList li a.list-group-item[patientId='+patientId+']').offset().top;
  96. $('#emerpatientList').css('margin-bottom', '100vh');
  97. }
  98. if( self.isTablet() ) {
  99. // 적절한 위치로 이동
  100. if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabIn'){
  101. $('#tabIn').animate({scrollTop: pos - 150}, 500);
  102. }else if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabOut'){
  103. $('#tabOut').animate({scrollTop: pos - 150}, 500);
  104. }else{
  105. $('#tabEmer').animate({scrollTop: pos - 150}, 500);
  106. }
  107. $('#nursingPopup').height(max2-245);
  108. $('#nursingPopup .tab-content .tab-pane').height(max2-317);
  109. $('#openToggle').stop().animate({bottom: wh-280 },500);
  110. }else{
  111. // 적절한 위치로 이동
  112. if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabIn'){
  113. $('#tabIn').animate({scrollTop: pos - 77}, 500);
  114. }else if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabOut'){
  115. $('#tabOut').animate({scrollTop: pos - 77}, 500);
  116. }else{
  117. $('#tabEmer').animate({scrollTop: pos - 77}, 500);
  118. };
  119. $('#nursingPopup').height(max2-105);
  120. $('#nursingPopup .tab-content .tab-pane').height(max2-177);
  121. $('#openToggle').stop().animate({bottom: wh-140 },500);
  122. }
  123. $('#openToggle').addClass('on');
  124. $('#openToggle').find('.fa').removeClass('fa-chevron-up');
  125. $('#openToggle').find('.fa').addClass('fa-chevron-down');
  126. $('#nursingPopup').stop().animate({bottom:0},500);
  127. $('#nursingPopup').css({'display': 'block'});
  128. }
  129. }else { //검색 탭
  130. var patientInfo = JSON.parse(localStorage.patientInfo);
  131. var patientId = patientInfo.patientId;
  132. $('.list-group-item[patientId='+patientId+']').addClass('active');
  133. if($('input[type="radio"][name="plist-search"]:checked').val()=='treat'){
  134. if($('input[type="radio"][name="treatment"]:checked').val()=='in'){
  135. patientInfo.treatTyp='I';
  136. }
  137. }else{
  138. patientInfo.treatTyp='I';
  139. }
  140. if(patientInfo.treatTyp=='I'){
  141. $('#nursingPopup [id*=popContent]').removeClass('in');
  142. $('#nursingPopup #popContentNursingRecode').addClass('in');
  143. if(!$('#openToggle').is('.on')){
  144. $('#nursingRecodeTab.nav-tabs a[href="#tabInfo"]').tab('show');
  145. }else{
  146. mplusNursing.reInit($("ul#nursingRecodeTab.nav-tabs li.active a").attr('aria-controls'));
  147. }
  148. $('#newPopupFooter').css('display', 'block');
  149. /*$('#nursingPopup').css('display', 'block');*/
  150. // 선택한 환자의 스크롤 위치 구하기
  151. var pos = $('#tabSearch').scrollTop() + $('#searchPatientList li a.list-group-item[patientId='+patientId+']').offset().top;
  152. $('#searchPatientList').css('margin-bottom', '100vh');
  153. if( self.isTablet() ) {
  154. // 적절한 위치로 이동
  155. $('#tabSearch').animate({scrollTop: pos - 150}, 500);
  156. $('#nursingPopup').height(max2-245);
  157. $('#nursingPopup .tab-content .tab-pane').height(max2-317);
  158. $('#openToggle').stop().animate({bottom: wh-280 },500);
  159. }else{
  160. // 적절한 위치로 이동
  161. $('#tabSearch').animate({scrollTop: pos - 77}, 500);
  162. $('#nursingPopup').height(max2-105);
  163. $('#nursingPopup .tab-content .tab-pane').height(max2-177);
  164. $('#openToggle').stop().animate({bottom: wh-140 },500);
  165. }
  166. $('#openToggle').addClass('on');
  167. $('#openToggle').find('.fa').removeClass('fa-chevron-up');
  168. $('#openToggle').find('.fa').addClass('fa-chevron-down');
  169. $('#nursingPopup').stop().animate({bottom:0},500);
  170. $('#nursingPopup').css({'display': 'block'});
  171. }else{
  172. $('#openToggle').stop().animate({bottom:240},500);
  173. $('#overlay').stop().animate({bottom:-49},500);
  174. $('#footer').css('overflow','visible');
  175. $('#openToggle').addClass('on');
  176. $('#openToggle').find('.fa').removeClass('fa-chevron-up');
  177. $('#openToggle').find('.fa').addClass('fa-chevron-down');
  178. }
  179. }
  180. }else if(window.location.search.split('=')[1]=='operation') { //수술스케줄화면
  181. if( $('#divId').text()=='' && $('#divOpPatientName').text()==''){
  182. self.alert('환자를 선택해주세요.');
  183. return;
  184. } else {
  185. $('#openToggle').stop().animate({bottom:240},500);
  186. $('#overlay').stop().animate({bottom:-49},500);
  187. $('#footer').css('overflow','visible');
  188. $('#openToggle').addClass('on');
  189. $('#openToggle').find('.fa').removeClass('fa-chevron-up');
  190. $('#openToggle').find('.fa').addClass('fa-chevron-down');
  191. $('.pop-content ul').scrollTop(0);
  192. }
  193. }
  194. }
  195. });//end
  196. $('#page').not('#overlay').on('click', function(){ //list, overlay 팝업 이외의 곳을 클릭하면 팝업 사라지도록
  197. if(event.target.className.indexOf('list-group-item')>-1 ||
  198. (event.target.offsetParent!=null && event.target.offsetParent.className.indexOf('list-group-item')>-1)) return;
  199. if($('#overlay').css('bottom')=='-49px' || $('#nursingPopup').css('bottom')=='0px'){
  200. $('#openToggle').stop().animate({bottom:10},500);
  201. $('#overlay').stop().animate({bottom:-290},500);
  202. $('#nursingPopup').stop().animate({bottom:-max},500);
  203. $('#newPopupFooter').css('display', 'none');
  204. $('#patientList').css('margin-bottom', '0');
  205. $('#searchPatientList').css('margin-bottom', '0');
  206. $('#openToggle').removeClass('on');
  207. $('#openToggle').find('.fa').removeClass('fa-chevron-down');
  208. $('#openToggle').find('.fa').addClass('fa-chevron-up');
  209. }
  210. });
  211. $(".switch").click(function(){
  212. var chk = $('#cb').is(":checked");
  213. if(chk) {
  214. $('.sel1').removeClass('select');
  215. $('.sel2').addClass('select');
  216. } else {
  217. $('.sel2').removeClass('select');
  218. $('.sel1').addClass('select');
  219. }
  220. });
  221. });