|
|
@@ -1,13 +1,12 @@
|
|
|
<template>
|
|
|
<div class="fullBox white pa-3">
|
|
|
<div ref="graphRef" v-loading="loading" class="fullBox"></div>
|
|
|
- <!-- <RelationGraph ref="graphRef" :options="graphOptions" :on-node-expand="onNodeExpand" :on-node-collapse="onNodeCollapse" v-loading="loading"></RelationGraph> -->
|
|
|
+ <OrganizationEdit ref="organizationEditRefs" @success="onRefresh"></OrganizationEdit>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// import RelationGraph from 'relation-graph'
|
|
|
-
|
|
|
+import OrganizationEdit from './organizationEdit.vue'
|
|
|
import {
|
|
|
CollapseExpandTree,
|
|
|
MindMapNode
|
|
|
@@ -31,7 +30,7 @@ const NODE_TYPE = {
|
|
|
labelFontSize: 24,
|
|
|
labelLineHeight: 48,
|
|
|
labelPlacement: 'right',
|
|
|
- labelPadding: [0, 20],
|
|
|
+ labelPadding: [0, 20, 36, 20],
|
|
|
labelText: d.name,
|
|
|
labelOffsetX: d.depth === 3 ? 40 : 80,
|
|
|
labelBackground: true,
|
|
|
@@ -39,18 +38,19 @@ const NODE_TYPE = {
|
|
|
labelBackgroundRadius: 8,
|
|
|
port: true,
|
|
|
ports: [{ placement: 'right' }, { placement: 'left' }]
|
|
|
- // badges: [
|
|
|
- // { text: d.tag || '', placement: 'right-bottom', fontSize: 16 }
|
|
|
- // ]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
name: 'organization-structure',
|
|
|
+ components: {
|
|
|
+ OrganizationEdit
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ graph: null
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -113,7 +113,7 @@ export default {
|
|
|
enable: false,
|
|
|
plugins: [
|
|
|
'minimap',
|
|
|
- 'contextmenu',
|
|
|
+ // 'contextmenu',
|
|
|
{
|
|
|
className: 'toolbar',
|
|
|
position: 'right-top',
|
|
|
@@ -128,7 +128,6 @@ export default {
|
|
|
],
|
|
|
onClick: (value) => {
|
|
|
const zoom = graph.getZoom()
|
|
|
- console.log(zoom)
|
|
|
// 处理按钮点击事件
|
|
|
if (value === 'zoom-in') {
|
|
|
if (zoom > 2) {
|
|
|
@@ -164,7 +163,7 @@ export default {
|
|
|
return 32
|
|
|
},
|
|
|
getVGap: function getVGap () {
|
|
|
- return 10
|
|
|
+ return 30
|
|
|
},
|
|
|
getHGap: function getHGap () {
|
|
|
return 200
|
|
|
@@ -192,9 +191,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
- console.log(graph)
|
|
|
graph.render()
|
|
|
+ this.graph = graph
|
|
|
+ },
|
|
|
+ editTag (nodes) {
|
|
|
+ this.$refs.organizationEditRefs.open(nodes)
|
|
|
},
|
|
|
async onInit () {
|
|
|
try {
|
|
|
@@ -204,7 +205,8 @@ export default {
|
|
|
nodes: nodes.map(e => {
|
|
|
return {
|
|
|
...e,
|
|
|
- getChildren: this.getChildren
|
|
|
+ getChildren: this.getChildren,
|
|
|
+ editTag: this.editTag
|
|
|
}
|
|
|
}),
|
|
|
edges
|
|
|
@@ -212,6 +214,9 @@ export default {
|
|
|
} catch (error) {
|
|
|
this.$message.error(error)
|
|
|
}
|
|
|
+ },
|
|
|
+ onRefresh () {
|
|
|
+ this.graph.render()
|
|
|
}
|
|
|
}
|
|
|
}
|