@@ -86,15 +86,15 @@ const currentNode = useWatchNode(props)
86
86
// 节点名称
87
87
const { nodeName, showInput, clickIcon, blurEvent } = useNodeName (NodeType .ROUTER_BRANCH_NODE )
88
88
const routerGroups = ref <RouterCondition []>([])
89
- const nodeOptions = ref ( )
89
+ const nodeOptions = ref < any >([] )
90
90
const conditionRef = ref ([])
91
91
92
92
/** 保存配置 */
93
93
const saveConfig = async () => {
94
94
// 校验表单
95
95
let valid = true
96
96
for (const item of conditionRef .value ) {
97
- if (! (await item .validate ())) {
97
+ if (item && ! (await item .validate ())) {
98
98
valid = false
99
99
}
100
100
}
@@ -109,7 +109,7 @@ const saveConfig = async () => {
109
109
}
110
110
// 显示路由分支节点配置, 由父组件传过来
111
111
const showRouteNodeConfig = (node : SimpleFlowNode ) => {
112
- getRouterNode ()
112
+ getRouterNode (processNodeTree ?. value )
113
113
routerGroups .value = []
114
114
nodeName .value = node .name
115
115
if (node .routerGroups ) {
@@ -172,15 +172,14 @@ const deleteRouterGroup = (index: number) => {
172
172
routerGroups .value .splice (index , 1 )
173
173
}
174
174
175
- const getRouterNode = () => {
176
- // TODO @lesan 还需要满足以下要求
175
+ // 递归获取所有节点
176
+ const getRouterNode = (node ) => {
177
+ // TODO 最好还需要满足以下要求
177
178
// 并行分支、包容分支内部节点不能跳转到外部节点
178
179
// 条件分支节点可以向上跳转到外部节点
179
- let node = processNodeTree ?.value
180
- nodeOptions .value = []
181
180
while (true ) {
182
181
if (! node ) break
183
- if (node .type !== NodeType .ROUTER_BRANCH_NODE ) {
182
+ if (node .type !== NodeType .ROUTER_BRANCH_NODE && node . type !== NodeType . CONDITION_NODE ) {
184
183
nodeOptions .value .push ({
185
184
label: node .name ,
186
185
value: node .id
@@ -189,6 +188,11 @@ const getRouterNode = () => {
189
188
if (! node .childNode || node .type === NodeType .END_EVENT_NODE ) {
190
189
break
191
190
}
191
+ if (node .conditionNodes && node .conditionNodes .length ) {
192
+ node .conditionNodes .forEach ((item ) => {
193
+ getRouterNode (item )
194
+ })
195
+ }
192
196
node = node .childNode
193
197
}
194
198
}
0 commit comments