Commit be8a54a74cb7ce20da79617b239221db7a211f67

Authored by ww
1 parent 074dffe4

fix: 修复规链复制节点保存失败

... ... @@ -128,7 +128,7 @@ export function useBasicDataTransform() {
128 128 description,
129 129 name,
130 130 },
131   - created: !id?.id,
  131 + created: !!id?.id,
132 132 },
133 133 {
134 134 id: id?.id || buildUUID(),
... ... @@ -152,6 +152,7 @@ export function useBasicDataTransform() {
152 152 }
153 153
154 154 const newNode = genNewNodeByData(node, nodeConfig);
  155 + newNode.data.isSaved = true;
155 156
156 157 addNodes.push(newNode);
157 158 }
... ... @@ -217,9 +218,10 @@ export function useBasicDataTransform() {
217 218 if (ignoreNodeKeys.includes(nodeData.config?.key as string)) continue;
218 219
219 220 const data = nodeData.data;
  221 +
220 222 const resultNode = Object.assign(
221 223 mergeData(data, nodeData, node),
222   - nodeData.created
  224 + nodeData?.isSaved
223 225 ? ({
224 226 id: { id: node.id, entityType: RuleChainEntityType.RULE_NODE },
225 227 } as BasicNodeBindData)
... ...
... ... @@ -170,7 +170,7 @@ export function useContextMenuAction() {
170 170 const { getAddNodesParams } = useAddNodes();
171 171 const { x, y } = position;
172 172
173   - const value = getAddNodesParams(position, data, { id });
  173 + const value = getAddNodesParams(position, { ...data, isSaved: false }, { id });
174 174
175 175 setRuleNodeCache({
176 176 nodes: [value],
... ...
... ... @@ -50,8 +50,7 @@ export function useSaveAndRedo() {
50 50
51 51 const { connections, nodes, firstNodeIndex } = combineData(
52 52 flowActionType.getNodes,
53   - flowActionType.getEdges,
54   - true
  53 + flowActionType.getEdges
55 54 );
56 55
57 56 handleSaveRuleChain(connections, nodes, firstNodeIndex, flowActionType);
... ...
... ... @@ -138,6 +138,7 @@ export interface NodeData<T = BasicNodeFormData> {
138 138 config?: NodeItemConfigType;
139 139 data?: T;
140 140 created?: boolean;
  141 + isSaved?: boolean;
141 142 }
142 143
143 144 export interface EdgeData {
... ...