Browse Source

修改演示页加载逻辑

zhaoyk 2 years ago
parent
commit
1ec4154056
1 changed files with 18 additions and 4 deletions
  1. 18 4
      adm_comp/src/views/Diagram.vue

+ 18 - 4
adm_comp/src/views/Diagram.vue

@@ -5,7 +5,7 @@
 		  <el-col :span="6" >
 			<div style="height: 100vh;overflow: scroll;">
 				<el-tree :data="diagrams" :props="{children: 'children', label: nodeLabel, value: 'id'}"
-					@node-click="open"
+					@node-click="openOnClick"
 					default-expand-all
 					:expand-on-click-node="false">
 					<span class="custom-tree-node" slot-scope="{ node, data }">
@@ -278,11 +278,25 @@
 				});	
 		}
 		
-		//在编辑器中打开模板文件
-		open(data){
+		//点击左侧树时打开系统图
+		openOnClick(data){
 			if(data.objType == 'folder') //文件夹
 				return;
-				
+			
+			if(data.template == null){
+				this['$axios'].get(this['$common'].url + "diagram0/getDiagram?id=" + data.id)
+					.then(res => {
+						this.open(res.data.data);
+					})
+					.catch(err => {
+						//console.log(err);
+					});
+			} else 
+				this.open(data);
+		}
+		
+		//在编辑器中打开模板文件
+		open(data){	
 			if(this.currentDiagram != data) {
 				this.currentDiagram = data;
 				this.selectionInfo = '~';