feat: 获取分支中的节点

pull/659/head
Lesan 2025-01-16 14:55:32 +08:00
parent 69ccd83af3
commit 38578c3e50
1 changed files with 12 additions and 8 deletions

View File

@ -86,7 +86,7 @@ const currentNode = useWatchNode(props)
//
const { nodeName, showInput, clickIcon, blurEvent } = useNodeName(NodeType.ROUTER_BRANCH_NODE)
const routerGroups = ref<RouterCondition[]>([])
const nodeOptions = ref()
const nodeOptions = ref<any>([])
const conditionRef = ref([])
/** 保存配置 */
@ -94,7 +94,7 @@ const saveConfig = async () => {
//
let valid = true
for (const item of conditionRef.value) {
if (!(await item.validate())) {
if (item && !(await item.validate())) {
valid = false
}
}
@ -109,7 +109,7 @@ const saveConfig = async () => {
}
//
const showRouteNodeConfig = (node: SimpleFlowNode) => {
getRouterNode()
getRouterNode(processNodeTree?.value)
routerGroups.value = []
nodeName.value = node.name
if (node.routerGroups) {
@ -172,15 +172,14 @@ const deleteRouterGroup = (index: number) => {
routerGroups.value.splice(index, 1)
}
const getRouterNode = () => {
// TODO @lesan
//
const getRouterNode = (node) => {
// TODO
//
//
let node = processNodeTree?.value
nodeOptions.value = []
while (true) {
if (!node) break
if (node.type !== NodeType.ROUTER_BRANCH_NODE) {
if (node.type !== NodeType.ROUTER_BRANCH_NODE && node.type !== NodeType.CONDITION_NODE) {
nodeOptions.value.push({
label: node.name,
value: node.id
@ -189,6 +188,11 @@ const getRouterNode = () => {
if (!node.childNode || node.type === NodeType.END_EVENT_NODE) {
break
}
if (node.conditionNodes && node.conditionNodes.length) {
node.conditionNodes.forEach((item) => {
getRouterNode(item)
})
}
node = node.childNode
}
}