Showing
5 changed files
with
12 additions
and
8 deletions
| @@ -128,7 +128,7 @@ export function useBasicDataTransform() { | @@ -128,7 +128,7 @@ export function useBasicDataTransform() { | ||
| 128 | description, | 128 | description, |
| 129 | name, | 129 | name, |
| 130 | }, | 130 | }, |
| 131 | - created: !!id?.id, | 131 | + created: !id?.id, |
| 132 | }, | 132 | }, |
| 133 | { | 133 | { |
| 134 | id: id?.id || buildUUID(), | 134 | id: id?.id || buildUUID(), |
| @@ -220,7 +220,7 @@ export function useBasicDataTransform() { | @@ -220,7 +220,7 @@ export function useBasicDataTransform() { | ||
| 220 | 220 | ||
| 221 | const resultNode = Object.assign( | 221 | const resultNode = Object.assign( |
| 222 | mergeData(data, nodeData, node), | 222 | mergeData(data, nodeData, node), |
| 223 | - nodeData.created && !removeId | 223 | + !nodeData.created || !removeId |
| 224 | ? ({ | 224 | ? ({ |
| 225 | id: { id: node.id, entityType: RuleChainEntityType.RULE_NODE }, | 225 | id: { id: node.id, entityType: RuleChainEntityType.RULE_NODE }, |
| 226 | } as BasicNodeBindData) | 226 | } as BasicNodeBindData) |
| @@ -36,7 +36,7 @@ export function useDragCreate(options: UseDragCreateOptionsType) { | @@ -36,7 +36,7 @@ export function useDragCreate(options: UseDragCreateOptionsType) { | ||
| 36 | y: event.clientY - flowBounds.top - offsetY, | 36 | y: event.clientY - flowBounds.top - offsetY, |
| 37 | }); | 37 | }); |
| 38 | 38 | ||
| 39 | - const newNode = getAddNodesParams(position, { ...toRaw(unref(nodeData)), data }); | 39 | + const newNode = getAddNodesParams(position, { ...toRaw(unref(nodeData)), data, created: true }); |
| 40 | addNodes(newNode); | 40 | addNodes(newNode); |
| 41 | 41 | ||
| 42 | triggerChange(); | 42 | triggerChange(); |
| @@ -50,10 +50,11 @@ export function useSaveAndRedo() { | @@ -50,10 +50,11 @@ export function useSaveAndRedo() { | ||
| 50 | 50 | ||
| 51 | const { connections, nodes, firstNodeIndex } = combineData( | 51 | const { connections, nodes, firstNodeIndex } = combineData( |
| 52 | flowActionType.getNodes, | 52 | flowActionType.getNodes, |
| 53 | - flowActionType.getEdges | 53 | + flowActionType.getEdges, |
| 54 | + true | ||
| 54 | ); | 55 | ); |
| 55 | 56 | ||
| 56 | - handleSaveRuleChain(connections, nodes, firstNodeIndex); | 57 | + handleSaveRuleChain(connections, nodes, firstNodeIndex, flowActionType); |
| 57 | }; | 58 | }; |
| 58 | 59 | ||
| 59 | const handleRedoChange = (flowActionType: VueFlowStore) => { | 60 | const handleRedoChange = (flowActionType: VueFlowStore) => { |
| @@ -71,7 +72,8 @@ export function useSaveAndRedo() { | @@ -71,7 +72,8 @@ export function useSaveAndRedo() { | ||
| 71 | async function handleSaveRuleChain( | 72 | async function handleSaveRuleChain( |
| 72 | connections: ConnectionItemType[], | 73 | connections: ConnectionItemType[], |
| 73 | nodes: BasicNodeBindData[], | 74 | nodes: BasicNodeBindData[], |
| 74 | - firstNodeIndex?: number | 75 | + firstNodeIndex: number | undefined = undefined, |
| 76 | + flowActionType: VueFlowStore | ||
| 75 | ) { | 77 | ) { |
| 76 | try { | 78 | try { |
| 77 | loading.value = true; | 79 | loading.value = true; |
| @@ -93,7 +95,8 @@ export function useSaveAndRedo() { | @@ -93,7 +95,8 @@ export function useSaveAndRedo() { | ||
| 93 | }, | 95 | }, |
| 94 | }); | 96 | }); |
| 95 | 97 | ||
| 96 | - parseRuleChain(data); | 98 | + const elements = parseRuleChain(data); |
| 99 | + flowActionType.setElements(elements); | ||
| 97 | 100 | ||
| 98 | resetChange(); | 101 | resetChange(); |
| 99 | 102 |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | import { Spin } from 'ant-design-vue'; | 3 | import { Spin } from 'ant-design-vue'; |
| 4 | import { NodeItemConfigType } from '../../../types/node'; | 4 | import { NodeItemConfigType } from '../../../types/node'; |
| 5 | import { fetchNodeExtraContent } from '../../../packages'; | 5 | import { fetchNodeExtraContent } from '../../../packages'; |
| 6 | + import { NodeProps } from '@vue-flow/core'; | ||
| 6 | 7 | ||
| 7 | const props = defineProps<{ | 8 | const props = defineProps<{ |
| 8 | config?: NodeItemConfigType; | 9 | config?: NodeItemConfigType; |
| @@ -114,7 +114,7 @@ | @@ -114,7 +114,7 @@ | ||
| 114 | </Spin> | 114 | </Spin> |
| 115 | </Tabs.TabPane> | 115 | </Tabs.TabPane> |
| 116 | <Tabs.TabPane | 116 | <Tabs.TabPane |
| 117 | - v-if="nodeData?.created" | 117 | + v-if="!nodeData?.created" |
| 118 | :tab="TabsPanelNameEnum[TabsPanelEnum.EVENT]" | 118 | :tab="TabsPanelNameEnum[TabsPanelEnum.EVENT]" |
| 119 | :key="TabsPanelEnum.EVENT" | 119 | :key="TabsPanelEnum.EVENT" |
| 120 | > | 120 | > |