|
@@ -5,7 +5,7 @@
|
|
<!-- 缩略图 -->
|
|
<!-- 缩略图 -->
|
|
<div class="minimap" id="frameMinimap"></div>
|
|
<div class="minimap" id="frameMinimap"></div>
|
|
<!-- 右键菜单 -->
|
|
<!-- 右键菜单 -->
|
|
- <div id="context-menu-wrapper">
|
|
|
|
|
|
+ <div id="context-menu-wrapper" @mouseleave="hideContextMenu">
|
|
<el-dropdown-menu size="medium">
|
|
<el-dropdown-menu size="medium">
|
|
<el-dropdown-item v-for="menu in contextMenu" :key="menu.key" @click.native="handleContext(menu.key)">
|
|
<el-dropdown-item v-for="menu in contextMenu" :key="menu.key" @click.native="handleContext(menu.key)">
|
|
<i :class="menu.icon" v-if="menu.icon"/>
|
|
<i :class="menu.icon" v-if="menu.icon"/>
|
|
@@ -39,7 +39,16 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
init(){
|
|
init(){
|
|
this.graph = new myGraph('frameContainer');
|
|
this.graph = new myGraph('frameContainer');
|
|
|
|
+ const tempThis = this
|
|
|
|
+ //需要调用vue实例的事件添加在这里
|
|
|
|
+ this.graph.on('node:click',({node,e})=>{
|
|
|
|
+ if(window.location.pathname.startsWith('/editframe')) return
|
|
|
|
+ if(node.data&&node.data.myETAId){
|
|
|
|
+ tempThis.$emit('showDialog',node.data.myETAId)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
const rect = this.graph.addNode({
|
|
const rect = this.graph.addNode({
|
|
|
|
+ shape:'rect',
|
|
x: 40,
|
|
x: 40,
|
|
y: 40,
|
|
y: 40,
|
|
width: 120,
|
|
width: 120,
|
|
@@ -85,8 +94,15 @@ export default {
|
|
nodeName:node.label,
|
|
nodeName:node.label,
|
|
nodeLink:node.data.myETAId
|
|
nodeLink:node.data.myETAId
|
|
})
|
|
})
|
|
|
|
+ //清除选区
|
|
|
|
+ this.graph.cleanSelection()
|
|
},
|
|
},
|
|
deleteNode(){},
|
|
deleteNode(){},
|
|
|
|
+ hideContextMenu(){
|
|
|
|
+ const dom = $('#context-menu-wrapper')[0];
|
|
|
|
+ dom.style.left = '-9999px';
|
|
|
|
+ dom.style.top = '-9999px';
|
|
|
|
+ }
|
|
},
|
|
},
|
|
mounted(){
|
|
mounted(){
|
|
this.init()
|
|
this.init()
|