zhouna 4 rokov pred
rodič
commit
c8cf2469ad
1 zmenil súbory, kde vykonal 22 pridanie a 16 odobranie
  1. 22 16
      src/js/staticInfoOut.js

+ 22 - 16
src/js/staticInfoOut.js

@@ -16,8 +16,14 @@ const {
   openNewWin
 } = require('./promise.js');
 const $ = require("jquery");
-let showName,noticeName,clinicalPathwayName,showLis=[]
+let showName,noticeName,clinicalPathwayName,showLis=[],selectedDrop=0,selectedTab=0
 
+//如果是子窗口,隐藏网页查看按钮
+if(window.opener){
+    selectedDrop=getUrlArgObject("d")||0;
+    selectedTab=getUrlArgObject("t")||0;
+    $("#openWin").hide();
+}
 let icond = require('./../images/d.png').replace(/^undefined/g, '')
 function getInfomation() {
   // var param = {
@@ -55,12 +61,12 @@ function getInfomation() {
         str+=`<li data-idx="${i}" title="${tmp.name}">${tmp.name}(${tmp.hisName})</li>`
       }
       $(".showWhich ul").html(str);
-        sName=showLis[0].name+"("+showLis[0].hisName+")";
+        sName=showLis[selectedDrop].name+"("+showLis[selectedDrop].hisName+")";
       $(".showWhichSelect").html(sName).attr("title",sName)
-      showName = data[0].name
-      renderTitleShow();
+      showName = data[selectedDrop].name
       showInfoSelect()
-      showInfo(data[0])
+      showInfo(data[selectedDrop])
+        renderTitleShow();
       $('.content img').bind('contextmenu', function(){
         return false
       })
@@ -96,9 +102,11 @@ function showInfoSelect(){
   $('.showWhich li').click(function(){
     let idx = $(this).attr('data-idx')
     let name = $(this).html(),str=''
+    selectedDrop=idx;
+    selectedTab=0;
     showName = showLis[idx].name;
-    renderTitleShow();
     showInfo(showLis[idx])
+    renderTitleShow();
     $('.content .infos').scrollTop(0)
     $(".showWhich ul").css("display","none")
     $(".showWhichSelect").html(name).attr("title",name)
@@ -113,7 +121,7 @@ function showInfoSelect(){
 }
 function renderTitleShow(){
     document.title = showName;
-    $(".titleCont .title").html(showName);
+    $(".titleCont .title").html($(".tabList .tab:eq("+selectedTab+")").attr("data-title"));
 }
 function renderContent(list, contentWrapClassName){
   $(`.${contentWrapClassName} .infos`).html('');
@@ -185,15 +193,17 @@ function renderTab(detailList){
     $(".tabList").append(`<span class="tab" data-module="notice" data-title="`+noticeName+`">注意事项</span>`)
     //$(".titleCont .title").html(noticeName);
   }
-  $(".tabList .tab").eq(0).addClass("activeTab")
-  let defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
+
+  $(".tabList .tab").eq(selectedTab).addClass("activeTab")
+  let defaultModuleName = $(".tabList .tab").eq(selectedTab).attr("data-module")
   $(`.${defaultModuleName}`).css("display","block")
   bindTabClick()
 }
 function bindTabClick(){
   $(".tabList .tab").on("click", function(){
     const moduleName = $(this).attr("data-module")
-    const display = $(`.${moduleName}`).css("display")
+    //const display = $(`.${moduleName}`).css("display")
+      selectedTab=$('.tabList .tab').index(this);
       $(".titleCont .title").html($(this).attr('data-title'));
     //if(display == "none"){
       $(".activeTab").removeClass("activeTab")
@@ -207,8 +217,8 @@ function bindTabClick(){
     const type= getUrlArgObject('type');
     const hospitalId= getUrlArgObject('hospitalId');
     const hisName= getUrlArgObject('hisName');
-    const hisDetailName= getUrlArgObject('hisDetailName');
-    openNewWin("staticInfoOut.html?hospitalId="+encodeURIComponent(hospitalId)+"&hisName="+encodeURIComponent(hisName)+"&hisDetailName="+encodeURIComponent(hisDetailName||'')+"&type="+encodeURIComponent(type));
+    const hisDetailName= getUrlArgObject('hisDetailName');console.log(selectedDrop)
+    openNewWin("staticInfoOut.html?hospitalId="+encodeURIComponent(hospitalId)+"&hisName="+encodeURIComponent(hisName)+"&hisDetailName="+encodeURIComponent(hisDetailName||'')+"&type="+encodeURIComponent(type)+"&d="+selectedDrop+"&t="+selectedTab);
   })
 }
 function adjustHeight() {
@@ -225,8 +235,4 @@ $(window).on('resize', function(){
   adjustHeight()
   adjustWidth()
 })
-//如果是子窗口,隐藏网页查看按钮
-if(window.opener){
-  $("#openWin").hide();
-}