|
@@ -270,6 +270,7 @@ const submitAll = () => {
|
|
submitFormData.titleTemplate = proxy.title
|
|
submitFormData.titleTemplate = proxy.title
|
|
const nodeList = graph.toJSON().cells
|
|
const nodeList = graph.toJSON().cells
|
|
submitFormData.nodeObject = JSON.stringify(nodeList)
|
|
submitFormData.nodeObject = JSON.stringify(nodeList)
|
|
|
|
+ submitFormData.lineObject = JSON.stringify(flowDefinitionNodeObj.value)
|
|
const isStart = false
|
|
const isStart = false
|
|
for (let i = 0; i < nodeList.length; i++) {
|
|
for (let i = 0; i < nodeList.length; i++) {
|
|
const element = nodeList[i]
|
|
const element = nodeList[i]
|
|
@@ -475,7 +476,7 @@ const pushRoom = (port: any) => {
|
|
}
|
|
}
|
|
//用于存储流程定义节点数据
|
|
//用于存储流程定义节点数据
|
|
|
|
|
|
-const antvInit = () => {
|
|
|
|
|
|
+const antvInit = (data) => {
|
|
graph = new Graph({
|
|
graph = new Graph({
|
|
height: 600,
|
|
height: 600,
|
|
container: document.getElementById('graph-container')!,
|
|
container: document.getElementById('graph-container')!,
|
|
@@ -618,6 +619,7 @@ const antvInit = () => {
|
|
})
|
|
})
|
|
// #endregion
|
|
// #endregion
|
|
graph.on('cell:click', ({ e, x, y, cell, view }) => {
|
|
graph.on('cell:click', ({ e, x, y, cell, view }) => {
|
|
|
|
+ console.log(cell)
|
|
if (cell.shape === 'start-btn') return
|
|
if (cell.shape === 'start-btn') return
|
|
if(cell.shape === 'end-btn' || cell.shape === 'edge') {
|
|
if(cell.shape === 'end-btn' || cell.shape === 'edge') {
|
|
ElMessageBox.confirm("是否删除", "提示", {
|
|
ElMessageBox.confirm("是否删除", "提示", {
|
|
@@ -814,34 +816,69 @@ const antvInit = () => {
|
|
// x: 500,
|
|
// x: 500,
|
|
// y: 100,
|
|
// y: 100,
|
|
// })
|
|
// })
|
|
|
|
+ if(data) {
|
|
|
|
+ graph.fromJSON(
|
|
|
|
+ data
|
|
|
|
+ )
|
|
|
|
+ console.log(graph,123123)
|
|
|
|
+ }else{
|
|
|
|
+ graph.addNode({
|
|
|
|
+ shape: 'start-btn',
|
|
|
|
+ x: 500,
|
|
|
|
+ y: 20,
|
|
|
|
+ label: '开始',
|
|
|
|
+ id:1,
|
|
|
|
+ attrs: {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
|
|
- graph.addNode({
|
|
|
|
- shape: 'start-btn',
|
|
|
|
- x: 500,
|
|
|
|
- y: 20,
|
|
|
|
- label: '开始',
|
|
|
|
- id:1,
|
|
|
|
- attrs: {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
|
|
|
|
}
|
|
}
|
|
const getFlowInfo = (()=>{
|
|
const getFlowInfo = (()=>{
|
|
proxy.post('/flowDefinition/getDetails', {id:submitFormData.id}).then((res) => {
|
|
proxy.post('/flowDefinition/getDetails', {id:submitFormData.id}).then((res) => {
|
|
|
|
+ res.nodeObject = JSON.parse(res.nodeObject)
|
|
|
|
+ antvInit(res.nodeObject)
|
|
|
|
+ // console.log(graph.toJSON().cells)
|
|
|
|
+ // console.log(JSON.parse(res.lineObject))
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // for (const key in JSON.parse(res.lineObject)) {
|
|
|
|
+ // if(JSON.parse(res.lineObject)[key].cell) {
|
|
|
|
+ // console.log(JSON.parse(res.lineObject)[key].cell.setData)
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // // JSON.parse(res.lineObject)[key].cell.setData({
|
|
|
|
+ // // title:"12312312"
|
|
|
|
+ // // })
|
|
|
|
+ // }
|
|
|
|
+ // }, 2000);
|
|
|
|
+ // for (let i = 0; i < res.flowDefinitionId.length; i++) {
|
|
|
|
+ // const element = res.flowDefinitionId[i];
|
|
|
|
+ // flowDefinitionNodeObj.value[element.id] = element
|
|
|
|
+ // formData.data.cell.setData({
|
|
|
|
+ // title: formData.data.nodeName,
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ dialogVisible.value = false
|
|
|
|
|
|
})
|
|
})
|
|
})
|
|
})
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
onActivated(() => {
|
|
onActivated(() => {
|
|
|
|
+
|
|
|
|
+
|
|
})
|
|
})
|
|
onDeactivated(() => {
|
|
onDeactivated(() => {
|
|
-
|
|
|
|
- //清空minimap子元素
|
|
|
|
- window.document.getElementById('minimap').innerHTML = ''
|
|
|
|
|
|
+ console.log(window.document.getElementById('minimap').children)
|
|
|
|
+ if(window.document.getElementById('minimap').children.length > 1) {
|
|
|
|
+ window.document.getElementById('minimap').children[0].remove()
|
|
|
|
+ }
|
|
})
|
|
})
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- antvInit()
|
|
|
|
|
|
+
|
|
//获取url router参数
|
|
//获取url router参数
|
|
submitFormData.flowInfoId = router.currentRoute.value.query.flowInfoId
|
|
submitFormData.flowInfoId = router.currentRoute.value.query.flowInfoId
|
|
submitFormData.id = router.currentRoute.value.query.id
|
|
submitFormData.id = router.currentRoute.value.query.id
|
|
@@ -849,6 +886,11 @@ onMounted(() => {
|
|
if(submitFormData.flowInfoId) {
|
|
if(submitFormData.flowInfoId) {
|
|
getFlowInfo()
|
|
getFlowInfo()
|
|
}
|
|
}
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ if(window.document.getElementById('minimap').children.length > 1) {
|
|
|
|
+ window.document.getElementById('minimap').children[0].remove()
|
|
|
|
+ }
|
|
|
|
+ }, 500);
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
<style lang="scss">
|
|
<style lang="scss">
|