From 548335c081bbce64aacf3789f752e677cbd2dcb3 Mon Sep 17 00:00:00 2001 From: yms Date: Wed, 19 Mar 2025 09:44:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Setting/Flow/index.module.css | 10 +++++++ src/pages/Setting/Flow/index.tsx | 38 +++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/pages/Setting/Flow/index.module.css b/src/pages/Setting/Flow/index.module.css index f59931a..a8f76d9 100644 --- a/src/pages/Setting/Flow/index.module.css +++ b/src/pages/Setting/Flow/index.module.css @@ -25,6 +25,16 @@ font-size: 20px; } +.tools { + position: absolute; + padding: 6px 10px; + z-index: 100; + background-color: #fff; + left: 16px; + top: 16px; + border-radius: 10px; +} + .lineNode { height: 120px; position: relative; diff --git a/src/pages/Setting/Flow/index.tsx b/src/pages/Setting/Flow/index.tsx index 0cf088a..0a282bf 100644 --- a/src/pages/Setting/Flow/index.tsx +++ b/src/pages/Setting/Flow/index.tsx @@ -1,4 +1,4 @@ -import { Button, Empty, message, notification } from "antd"; +import { Button, Empty, message, notification, Tooltip } from "antd"; import styles from "./index.module.css"; import { useEffect, useLayoutEffect, useRef, useState } from "react"; import { useFormContext } from ".."; @@ -34,6 +34,7 @@ import useGlobalData from "@/store/useGlobalData"; import X6ActionContext from "./X6ActionContext"; import BaseConditionNodeSetting from "./setting/baseConditionNodeSetting"; +import { ClearOutlined, RestFilled, RestOutlined } from "@ant-design/icons"; const X6ReactPortalProvider = Portal.getProvider(); @@ -123,7 +124,6 @@ const Flow = () => { setActionNode(startEvent?.data); renderGraph(); /** 居中内容 */ - graphRef.current?.centerPoint(0, 300); } }, [flowData]); @@ -132,7 +132,6 @@ const Flow = () => { const renderGraph = () => { const newX6Data = buildLineX6data(originalXNodesData.current); - console.log(newX6Data); setX6Data(newX6Data); }; @@ -674,9 +673,42 @@ const Flow = () => { originalXNodesData.current = cloneX6Data; renderGraph(); }; + const onReset = () => { + originalXNodesData.current = [ + { + id: "startEvent", + shape: "custom-activity-node", + y: 0, + data: { + ...getDefaultNodeByType(1), + pid: undefined, + }, + }, + { + id: "endEvent", + shape: "custom-end-node", + y: 300, + data: { + ...getDefaultNodeByType(), + pid: "startEvent", + }, + }, + ]; + setActionNode(undefined); + renderGraph(); + }; return (
+
+ + + +