From 3229f6a34f4982d1a551d86e68d313482e33f701 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期三, 11 十二月 2024 14:37:43 +0800
Subject: [PATCH] 条件节点

---
 src/components/vue-flow/ui/nodes/StartNode.vue |   34 ++++++++++++++++++++++------------
 1 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/src/components/vue-flow/ui/nodes/StartNode.vue b/src/components/vue-flow/ui/nodes/StartNode.vue
index daec7bf..40fc09c 100644
--- a/src/components/vue-flow/ui/nodes/StartNode.vue
+++ b/src/components/vue-flow/ui/nodes/StartNode.vue
@@ -36,7 +36,7 @@
 
 			<div class="flex-auto gap-y-2 flex-col flex nodrag">
 				<div class="text-lg font-bold">鍙傛暟</div>
-				<el-table size="small" class="flex-auto" :data="parameterTable" border>
+				<el-table size="small" class="flex-auto" :data="varList" border>
 					<el-table-column prop="name" width="90" label="鍙傛暟鍚�" fixed>
 						<template #default="scope">
 							<el-input v-model="scope.row.name"></el-input>
@@ -91,15 +91,15 @@
 
 <script lang="ts" setup>
 import { Handle, Position, useNode, useVueFlow } from '@vue-flow/core';
-import { ref } from 'vue';
+import { ref, watchEffect } from 'vue';
 
 import type { NodeProps } from '@vue-flow/core';
 import { computed } from 'vue';
 import { VueFlowConstant } from '../../VueFlowConstant';
+import { VueFlowHelper } from '../../VueFlowHelper';
 import { parameterTypeMap } from '../../vueFlowEnum';
 import { LLMNodeData, LLMNodeEvents } from './index';
 import { deepClone } from '/@/utils/other';
-import { VueFlowHelper } from '../../VueFlowHelper';
 
 defineProps<NodeProps<LLMNodeData, LLMNodeEvents>>();
 
@@ -107,14 +107,21 @@
 const handleId = ref(VueFlowHelper.getHandleId(node.node, 'source'));
 
 const data = ref(node.node.data);
-const titleIsEdit = ref(false);
-const parameterTable = computed(() => data.value[VueFlowConstant.PARAMS_KEY]);
-function handleClickAddBtn() {
-	if (!data.value[VueFlowConstant.PARAMS_KEY]) {
-		data.value[VueFlowConstant.PARAMS_KEY] = [];
-	}
 
-	data.value[VueFlowConstant.PARAMS_KEY].push({
+const getVarList = () =>{
+	const varList = data.value[VueFlowConstant.GROUP_PARAMS_KEY][0][VueFlowConstant.PARAMS_KEY].find(
+		(item) => item.key === 'condition'
+	).value;
+	return varList;
+}
+
+const varList = ref(VueFlowHelper.getFieldValue(data.value,'var_list'));
+const titleIsEdit = ref(false);
+
+function handleClickAddBtn() {
+
+
+	varList.value.push({
 		name: '',
 		description: '',
 		type: '',
@@ -123,14 +130,14 @@
 }
 
 function handleClickDeleteBtn(index: number) {
-	data.value[VueFlowConstant.PARAMS_KEY].splice(index, 1);
+	varList.value.splice(index, 1);
 }
 const { removeNodes, nodes, addNodes } = useVueFlow();
 
 function handleClickDuplicateBtn() {
 	const { type, position, data } = node.node;
 	const newNode = {
-		id: (nodes.value.length + 1).toString(),
+		id: VueFlowHelper.genGeometryId(),
 		type,
 		position: {
 			x: position.x + 100,
@@ -143,4 +150,7 @@
 const clickDeleteBtn = () => {
 	removeNodes(node.id);
 };
+
+
+
 </script>

--
Gitblit v1.9.3