Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
vue-flow-editor
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2023-11-24 16:57:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1218c9d06fa5ad1345c02716a1ce374c35d69af1
1218c9d0
1 parent
bc0072a7
fix
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
doc/App.vue
doc/App.vue
View file @
1218c9d
...
...
@@ -760,6 +760,38 @@ export default {
}
const onConfirmUserView = (data: any) => {
state.userTags = data;
// 自动保存流程
let { nodes, edges } = editor.editorState.graph.save();
// 检查路径有效性
const paths = [];
findPathsToEndNode(edges, 'start-node', [], paths);
if (paths.length) {
axios.post('/admin/?a=save_flow', qs.stringify({
form_id: +form_id,
flow_id: +flow_id,
data: JSON.stringify({ nodes, edges })
}))
.then(res => {
if (res.data.code) {
ElMessage({
type: 'success',
message: '保存流程图成功',
});
flow_id = res.data.data; // 更新flow_id
console.log(paths); // 输出满足条件的路径结果数组
} else {
ElMessage({
type: 'error',
message: res.data.msg,
});
}
})
.catch(err => {
console.log(err);
});
} else {
ElNotification.error('缺少一条从开始节点到结束节点的完整流程!');
}
}
/******************* END *******************/
...
...
@@ -1270,7 +1302,7 @@ export default {
*
* @return {void} No return value.
*/
function saveData(): void {
function saveData(
type
): void {
let { nodes, edges } = editor.editorState.graph.save();
// 使用时需要把自定义节点的类型带过去 activity/control
...
...
@@ -1326,7 +1358,7 @@ export default {
type: 'success',
message: '保存流程图成功',
});
flow_id = res.data.data
.flow_id
; // 更新flow_id
flow_id = res.data.data; // 更新flow_id
console.log(paths); // 输出满足条件的路径结果数组
} else {
ElMessage({
...
...
Please
register
or
login
to post a comment