diff --git a/web/src/views/ApplicationConfig/components/ConfigHeader.tsx b/web/src/views/ApplicationConfig/components/ConfigHeader.tsx index 3350780c..755491be 100644 --- a/web/src/views/ApplicationConfig/components/ConfigHeader.tsx +++ b/web/src/views/ApplicationConfig/components/ConfigHeader.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 16:27:52 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-13 17:12:59 + * @Last Modified time: 2026-03-16 15:58:10 */ import { type FC, useRef, useMemo, useCallback } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; @@ -97,10 +97,16 @@ const ConfigHeader: FC = ({ applicationModalRef.current?.handleOpen(application) break; case 'copy': - copyModalRef.current?.handleOpen() + appRef?.current?.handleSave(false) + .then(() => { + copyModalRef.current?.handleOpen() + }) break; case 'export': - appExport(application.id, application.name) + appRef?.current?.handleSave(false) + .then(() => { + appExport(application.id, application.name) + }) break; case 'delete': handleDelete() diff --git a/web/src/views/Workflow/components/Properties/index.tsx b/web/src/views/Workflow/components/Properties/index.tsx index bd5392cd..33e865a2 100644 --- a/web/src/views/Workflow/components/Properties/index.tsx +++ b/web/src/views/Workflow/components/Properties/index.tsx @@ -1,8 +1,8 @@ /* * @Author: ZhaoYing * @Date: 2026-02-03 15:39:59 - * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-02 17:06:41 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-03-16 16:11:28 */ import { type FC, useEffect, useState, useMemo } from "react"; import clsx from 'clsx' @@ -88,7 +88,7 @@ const Properties: FC = ({ useEffect(() => { if (selectedNode && form) { - const { type = 'default', name = '', config } = selectedNode.getData() || {} + const { type = 'default', name = '', config, id } = selectedNode.getData() || {} const initialValue: Record = {} Object.keys(config || {}).forEach(key => { if (config && config[key] && 'defaultValue' in config[key]) { @@ -98,7 +98,7 @@ const Properties: FC = ({ form.setFieldsValue({ type, - id: selectedNode.id, + id, name, ...initialValue, }) diff --git a/web/src/views/Workflow/hooks/useWorkflowGraph.ts b/web/src/views/Workflow/hooks/useWorkflowGraph.ts index db792c59..4bdf49b9 100644 --- a/web/src/views/Workflow/hooks/useWorkflowGraph.ts +++ b/web/src/views/Workflow/hooks/useWorkflowGraph.ts @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 15:17:48 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-07 15:23:39 + * @Last Modified time: 2026-03-16 16:11:01 */ import { useRef, useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; @@ -593,6 +593,13 @@ export const useWorkflowGraph = ({ if (!graphRef.current) return false; const selectedNodes = graphRef.current.getNodes().filter(node => node.getData()?.isSelected); if (selectedNodes.length) { + selectedNodes.forEach(node => { + const data = node.getData(); + node.setData({ + ...data, + id: `${(data.type as string).replace(/-/g, '_')}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, + }); + }); graphRef.current.copy(selectedNodes); } return false;