【修复】条件节点前fromNodeId传值问题

【修复】部署参数默认错误问题
【测设】部分项目代码结构
【同步】前端项目代码
This commit is contained in:
chudong
2025-05-09 18:44:33 +08:00
parent 6e2fe8cf52
commit d147bc7a82
237 changed files with 8705 additions and 8741 deletions

Binary file not shown.

View File

@@ -10,6 +10,7 @@ import DnsProviderSelect from '@/components/dnsProviderSelect'
import styles from './index.module.css'
import verifyRules from './verify'
import { isArray } from '@baota/utils/type'
type StepStatus = 'process' | 'wait' | 'finish' | 'error'
@@ -63,10 +64,7 @@ export default defineComponent({
// 表单参数
const param = ref(
Object.keys(props.node.config).length > 0
? {
...props.node.config,
inputs: Array.isArray(props.node.inputs) ? props.node.inputs[0] : { fromNodeId: '', name: '' },
}
? props.node.config
: {
provider: '',
provider_id: '',
@@ -151,18 +149,20 @@ export default defineComponent({
* @returns
*/
const nextStep = async () => {
if (!param.value.provider) return message.error($t('t_19_1745735766810'))
if (!props.node.config.provider) return message.error($t('t_19_1745735766810'))
// 加载证书来源选项
certOptions.value = findApplyUploadNodesUp(props.node.id).map((item) => {
return { label: item.name, value: item.id }
})
if (!certOptions.value.length) {
message.warning($t('t_3_1745748298161'))
} else if (!(param.value.inputs && param.value.inputs.fromNodeId)) {
param.value.inputs = {} as DeployNodeInputsConfig
param.value.inputs.name = certOptions.value[0]?.label || ''
param.value.inputs.fromNodeId = certOptions.value[0]?.value || ''
} else if (!props.node.config.inputs?.fromNodeId) {
param.value.inputs = {
name: certOptions.value[0]?.label || '',
fromNodeId: certOptions.value[0]?.value || '',
} as DeployNodeInputsConfig
}
current.value++
next.value = false
@@ -195,15 +195,7 @@ export default defineComponent({
await example.value?.validate()
const tempData = param.value
const inputs = tempData.inputs
console.log(inputs, 'inputs', props.node)
updateNode(
props.node.id,
{
inputs: [inputs],
config: {},
},
false,
)
updateNode(props.node.id, { inputs: [inputs], config: {} }, false)
delete tempData.inputs
updateNodeConfig(props.node.id, {
...tempData,
@@ -221,7 +213,7 @@ export default defineComponent({
modalOptions.value.footer = false
// 如果已经选择了部署类型,则跳转到下一步
if (param.value.provider) {
if (props.node.inputs) param.value.inputs = props.node.inputs
if (props.node.inputs) param.value.inputs = props.node.inputs[0]
nextStep()
}
})

View File

@@ -27,7 +27,7 @@
/* Add triangle in bottom-right corner for selected item */
.optionCardSelected::before {
content: '';
@apply absolute -bottom-[.1rem] -right-[.1rem] w-0 h-0 z-10 text-white text-xs flex items-center justify-center;
@apply absolute -bottom-[.1rem] -right-[.1rem] w-0 h-0 z-10 text-white text-[1.2rem] flex items-center justify-center;
border-style: solid;
border-width: 0 0 20px 20px;
border-color: transparent transparent var(--n-primary-color) transparent;

View File

@@ -304,7 +304,6 @@ export const useFlowStore = defineStore('flow-store', () => {
console.warn(`Node with id ${nodeId} not found`)
return
}
console.log(nodeId, node)
// 更新原始数据
updateNodeRecursive(flowData.value.childNode, nodeId, (node, parent) => {
@@ -312,20 +311,26 @@ export const useFlowStore = defineStore('flow-store', () => {
console.warn('Cannot remove root node')
return
}
const { type, conditionNodes } = parent as BranchNodeData | ExecuteResultBranchNodeData
// 处理条件节点(分支节点、执行结果分支节点)
// console.log(type, conditionNodes, node)
// 如果当前子节点存在条件节点,需要判断删除后是否支持条件节点,则需要更新 fromNodeId
if (node.childNode?.type === EXECUTE_RESULT_BRANCH && node.childNode?.config) {
node.childNode.config.fromNodeId = parent.id
}
// console.log(node.childNode, parent)
// 条件一:当前节点为普通节点
const nodeTypeList = [CONDITION, EXECUTE_RESULT_CONDITION, BRANCH, EXECUTE_RESULT_BRANCH]
if (!nodeTypeList.includes(node.type) && parent.childNode?.id === nodeId) {
console.log(deep)
// 处理普通节点
if (deep) {
// 深度删除,直接移除
parent.childNode = undefined
} else {
console.log(parent.childNode, node.childNode)
// 非深度删除,子节点上移
if (node.childNode) {
parent.childNode = node.childNode