hookehuyr

fix

......@@ -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({
......