Browse Source

关系图

zhangxc 5 years ago
parent
commit
b97a9e1443
2 changed files with 37 additions and 12 deletions
  1. 16 3
      src/js/graphMap.js
  2. 21 9
      src/js/index.js

+ 16 - 3
src/js/graphMap.js

@@ -16,6 +16,7 @@ function getGraph(val, type){
             // select_type = select_type_noSearch
             $('#searchInp').val(val)
             drawGraph(res.data.data)
+            window.graphTxt = val
             window.refreshTree = true
         }else{
             let nodeStr
@@ -131,6 +132,9 @@ function drawGraph(data,resultShowId) {
             }
         ]
     };
+    $(window).resize(function(){
+        myChart.resize(); 
+     })
     myChart.on('click',dataClick);
     myChart.setOption(option);
    
@@ -169,7 +173,10 @@ function dataClick(param){
                     $('.ICD10 img').attr('src','/images/radioSelect.png')
                 }else{
                     $(".radioList").hide()
-                    $(".ztree").css("height",contentHei-80-43-20+'px')
+                    $(".ztree").css("height",contentHei-80-43-20-20+'px')
+                    $(".ztree").css({
+                        margin: '20 0 0 0px'
+                    })
                 }
                 select_type_noSearch = data.type
                 select_type = data.type
@@ -351,7 +358,10 @@ function getNode(val, type){
                         $('.ICD10 img').attr('src','/images/radioSelect.png')
                     }else{
                         $(".radioList").hide()
-                        $(".ztree").css("height",contentHei-80-43-20+'px')
+                        $(".ztree").css("height",contentHei-80-43-20-20+'px')
+                        $(".ztree").css({
+                            margin: '20 0 0 0px'
+                        })
                     }
                 }else{
                     updateTree(txt)
@@ -505,7 +515,10 @@ function bindTabClick(){
         if(id != select_type){
             if(id != "疾病"){
                 $(".radioList").hide()
-                $(".ztree").css("height",contentHei-80-43-20+'px')
+                $(".ztree").css("height",contentHei-80-43-20-20+'px')
+                $(".ztree").css({
+                    margin: '20 0 0 0px'
+                })
             }else{
                 $(".ztree").css("height",contentHei-80-43-60-20+'px')
                 $(".radioList").show()

+ 21 - 9
src/js/index.js

@@ -28,13 +28,23 @@ const { drawGraph,updateTree,getGraph,getTree,getNode,getTab,renderTab} = requir
 window.select_type="疾病";
 window.select_type_noSearch="疾病";
 window.refreshTree = true
- const clientHei = $(window).height()
- const contentHei = clientHei - 80
- $(".left").css("height",contentHei+'px')
- $(".right").css("height",contentHei+'px')
- $(".tabBottom").css("height",contentHei-80-43-10+'px')
- $(".ztree").css("height",contentHei-80-43-60-20+'px')
- $("#main").css("height",contentHei-20-20+'px')
+
+ setHei()
+ function setHei(){
+    const clientHei = $(window).height()
+    const contentHei = clientHei - 80
+    $(".left").css("height",contentHei+'px')
+    $(".right").css("height",contentHei+'px')
+    $(".tabBottom").css("height",contentHei-80-43-10+'px')
+    $(".ztree").css("height",contentHei-80-43-60-20+'px')
+    $("#main").css("height",contentHei-20-20+'px')
+ }
+ $(window).resize(function(){
+    setHei()
+    console.log('graphTxt',graphTxt)
+    getGraph(graphTxt,select_type);
+ })
+
 //关系图
 getGraph("高血压3级",select_type);
 getTree(1,1,"高血压3级");
@@ -64,7 +74,6 @@ $('.selectList .selectItem').click(function(){
    
     $(".selectedName").attr('title',txt)
     $("#searchInp").attr("placeholder",`请输入${txt}名称`)
-     $("#searchInp").attr
     if(txt != oldTxt){
         $('#searchInp').val("")
     }
@@ -130,7 +139,10 @@ $('#searchBtn').click(function(e){
                     $(".ztree").css("height",contentHei-80-43-60-20+'px')
                 }else{
                     $(".radioList").hide()
-                    $(".ztree").css("height",contentHei-80-43-20+'px')
+                    $(".ztree").css("height",contentHei-80-43-20-20+'px')
+                    $(".ztree").css({
+                        margin: '20 0 0 0px'
+                    })
                 }
                 let renderTabInfo = getTab("疾病") 
                 renderTab(renderTabInfo)