|
@@ -51,26 +51,11 @@ export default {
|
|
|
name: '发起人',
|
|
|
id: '1',
|
|
|
type: 1,
|
|
|
+ sortNum: 1,
|
|
|
y: 100,
|
|
|
x: 500,
|
|
|
children: [],
|
|
|
},
|
|
|
- // {
|
|
|
- // y: 350,
|
|
|
- // x: 500,
|
|
|
- // id: '2',
|
|
|
- // type: 2,
|
|
|
- // name: 'node2',
|
|
|
- // children: ['3'],
|
|
|
- // },
|
|
|
- // {
|
|
|
- // y: 600,
|
|
|
- // x: 500,
|
|
|
- // id: '3',
|
|
|
- // type: 3,
|
|
|
- // name: 'node3',
|
|
|
- // children: [],
|
|
|
- // },
|
|
|
],
|
|
|
}
|
|
|
},
|
|
@@ -102,8 +87,9 @@ export default {
|
|
|
},
|
|
|
})
|
|
|
this.instance.importDefaults({
|
|
|
- anchor: 'Continuous',
|
|
|
+ anchors: ['Bottom', 'Top'],
|
|
|
connectionsDetachable: false,
|
|
|
+ reattachConnections: true,
|
|
|
// 连接器类型,这里设置为Flowchart
|
|
|
connector: {
|
|
|
type: 'Flowchart',
|
|
@@ -142,6 +128,7 @@ export default {
|
|
|
})
|
|
|
this.instance.addSourceSelector('.bottom')
|
|
|
this.instance.addTargetSelector('.top')
|
|
|
+ console.log(this.details)
|
|
|
this.details.forEach((item) => {
|
|
|
if (item.children.length) {
|
|
|
item.children.forEach((children) => {
|
|
@@ -151,7 +138,6 @@ export default {
|
|
|
target: this.$refs[children][0].$el,
|
|
|
// 连接方式,这里设置为连续
|
|
|
// paintStyle: { stroke: children.label == '同意' ? '#345' : 'red', strokeWidth: 3 },
|
|
|
- anchor: 'AutoDefault',
|
|
|
// 连接器类型,这里设置为Flowchart
|
|
|
connector: 'Flowchart',
|
|
|
// 添加两个标签和箭头
|
|
@@ -192,20 +178,24 @@ export default {
|
|
|
// })
|
|
|
//拖拽
|
|
|
this.instance.bind(EVENT_DRAG_STOP, (val) => {
|
|
|
- console.log(val.el.__vue__)
|
|
|
- console.log(3)
|
|
|
val.el.__vue__.setPosition(val.elements[0].pos)
|
|
|
})
|
|
|
// 建立链接
|
|
|
this.instance.bind(EVENT_CONNECTION, (val) => {
|
|
|
- console.log(val)
|
|
|
- console.log(2)
|
|
|
+ if (val.source.__vue__.detail.children.includes(val.target.__vue__.detail.id)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ val.source.__vue__.detail.children.push(val.target.__vue__.detail.id)
|
|
|
})
|
|
|
// 删除连接
|
|
|
this.instance.bind(EVENT_CONNECTION_DBL_CLICK, (conn) => {
|
|
|
this.$confirm({
|
|
|
title: '确定删除所点击的链接吗?',
|
|
|
onOk() {
|
|
|
+ conn.source.__vue__.detail.children.splice(
|
|
|
+ conn.source.__vue__.detail.children.indexOf(conn.target.__vue__.detail.id),
|
|
|
+ 1
|
|
|
+ )
|
|
|
that.instance.deleteConnection(conn)
|
|
|
},
|
|
|
})
|
|
@@ -229,10 +219,12 @@ export default {
|
|
|
name: type === 2 ? '条件分支' : '审核人',
|
|
|
id: +new Date(),
|
|
|
verifier: '',
|
|
|
+ userName: '',
|
|
|
reflect: '',
|
|
|
titleCode: '',
|
|
|
titleColumnCode: '',
|
|
|
handleNameId: '',
|
|
|
+ sortNum: record.sortNum++,
|
|
|
}
|
|
|
if (record.children.length > 0) {
|
|
|
const children = this.details
|
|
@@ -270,7 +262,6 @@ export default {
|
|
|
target: this.$refs[newVal.id][0].$el,
|
|
|
// 连接方式,这里设置为连续
|
|
|
// paintStyle: { stroke: children.label == '同意' ? '#345' : 'red', strokeWidth: 3 },
|
|
|
- anchor: 'AutoDefault',
|
|
|
// 连接器类型,这里设置为Flowchart
|
|
|
connector: 'Flowchart',
|
|
|
// 添加两个标签和箭头
|
|
@@ -312,6 +303,19 @@ export default {
|
|
|
},
|
|
|
handleBack() {
|
|
|
this.visible = false
|
|
|
+ this.record = {}
|
|
|
+ this.name = ''
|
|
|
+ this.details = [
|
|
|
+ {
|
|
|
+ name: '发起人',
|
|
|
+ id: '1',
|
|
|
+ type: 1,
|
|
|
+ sortNum: 1,
|
|
|
+ y: 100,
|
|
|
+ x: 500,
|
|
|
+ children: [],
|
|
|
+ },
|
|
|
+ ]
|
|
|
this.$emit('ok')
|
|
|
},
|
|
|
},
|
|
@@ -365,6 +369,9 @@ export default {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
min-height: calc(100vh - 100px);
|
|
|
+ max-height: calc(100vh - 100px);
|
|
|
+ overflow-y: auto;
|
|
|
+
|
|
|
width: 100%;
|
|
|
}
|
|
|
.scale {
|