yangyin
2024-12-13 c6cf46f3e11e60f692e0b8d12188458ad1b6120e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
    <NodeBasicLayout v-model:title="data.title"  :type="NodeType.Func" :description="VueFlowHelper.getConfigValue(data, 'description', '')">
        <Handle :id="targetHandleId" type="target" :position="Position.Left" />
        <FieldLayout :title="VueFlowHelper.getConfigValue(VueFlowHelper.getGroupParam(data), 'name', '函数名称')">
            <el-select
                class="w-[340px]"
                filterable
                :placeholder="funcNameParams.placeholder"
                v-model="funcNameParams.value"
                @change="agentParamsValueChange"
            >
                <el-option v-for="item in funcNames" :key="item.id" :value="item.id" :label="item.title"></el-option>
            </el-select>
        </FieldLayout>
        <Handle :id="sourceHandleId" type="source" :position="Position.Right" />
    </NodeBasicLayout>
</template>
 
<script lang="ts" setup>
import { Handle, Position, useNode, useVueFlow } from '@vue-flow/core';
import { ref } from 'vue';
import FieldLayout from './components/FieldLayout.vue';
import NodeBasicLayout from './components/NodeBasicLayout.vue';
import { NodeType } from '../../vueFlowEnum';
 
import { VueFlowHelper } from '../../VueFlowHelper';
 
const props = defineProps(['funcNames']);
const agentParamsValueChange = () => {};
const node = useNode();
const sourceHandleId = ref(VueFlowHelper.getHandleId(node.node, 'source'));
const targetHandleId = ref(VueFlowHelper.getHandleId(node.node, 'target'));
 
const data = ref(node.node.data);
 
const funcNameParams = ref(VueFlowHelper.getParams(VueFlowHelper.getGroupParam(data.value), 'func_name'));
 
 
VueFlowHelper.getConfigValue(funcNameParams.value, 'label', '')
</script>