hookehuyr

fix

...@@ -760,6 +760,38 @@ export default { ...@@ -760,6 +760,38 @@ export default {
760 } 760 }
761 const onConfirmUserView = (data: any) => { 761 const onConfirmUserView = (data: any) => {
762 state.userTags = data; 762 state.userTags = data;
763 + // 自动保存流程
764 + let { nodes, edges } = editor.editorState.graph.save();
765 + // 检查路径有效性
766 + const paths = [];
767 + findPathsToEndNode(edges, 'start-node', [], paths);
768 + if (paths.length) {
769 + axios.post('/admin/?a=save_flow', qs.stringify({
770 + form_id: +form_id,
771 + flow_id: +flow_id,
772 + data: JSON.stringify({ nodes, edges })
773 + }))
774 + .then(res => {
775 + if (res.data.code) {
776 + ElMessage({
777 + type: 'success',
778 + message: '保存流程图成功',
779 + });
780 + flow_id = res.data.data; // 更新flow_id
781 + console.log(paths); // 输出满足条件的路径结果数组
782 + } else {
783 + ElMessage({
784 + type: 'error',
785 + message: res.data.msg,
786 + });
787 + }
788 + })
789 + .catch(err => {
790 + console.log(err);
791 + });
792 + } else {
793 + ElNotification.error('缺少一条从开始节点到结束节点的完整流程!');
794 + }
763 } 795 }
764 /******************* END *******************/ 796 /******************* END *******************/
765 797
...@@ -1270,7 +1302,7 @@ export default { ...@@ -1270,7 +1302,7 @@ export default {
1270 * 1302 *
1271 * @return {void} No return value. 1303 * @return {void} No return value.
1272 */ 1304 */
1273 - function saveData(): void { 1305 + function saveData(type): void {
1274 let { nodes, edges } = editor.editorState.graph.save(); 1306 let { nodes, edges } = editor.editorState.graph.save();
1275 1307
1276 // 使用时需要把自定义节点的类型带过去 activity/control 1308 // 使用时需要把自定义节点的类型带过去 activity/control
...@@ -1326,7 +1358,7 @@ export default { ...@@ -1326,7 +1358,7 @@ export default {
1326 type: 'success', 1358 type: 'success',
1327 message: '保存流程图成功', 1359 message: '保存流程图成功',
1328 }); 1360 });
1329 - flow_id = res.data.data.flow_id; // 更新flow_id 1361 + flow_id = res.data.data; // 更新flow_id
1330 console.log(paths); // 输出满足条件的路径结果数组 1362 console.log(paths); // 输出满足条件的路径结果数组
1331 } else { 1363 } else {
1332 ElMessage({ 1364 ElMessage({
......