Compare commits
No commits in common. "80824c03816c20514a5e9bf82cfadf822582dfc2" and "5c7134f6918f336d628ab1f000a92fa08c36e71b" have entirely different histories.
80824c0381
...
5c7134f691
@ -344,27 +344,3 @@ export const transformHttpNodeData = (source) => {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const transformSdAgentNodeData = (source) => {
|
|
||||||
// 初始化结果对象
|
|
||||||
const result = {};
|
|
||||||
|
|
||||||
// 遍历每一个顶级节点
|
|
||||||
source.forEach(item => {
|
|
||||||
const { name, children } = item;
|
|
||||||
if (!name) return; // 过滤无name的无效节点
|
|
||||||
|
|
||||||
// 处理普通节点(config/headers/params):直接取 children 数组
|
|
||||||
if (name !== 'invokeTts') {
|
|
||||||
result[name] = children || [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 专门处理 tts 节点(特殊结构)
|
|
||||||
if (name === 'invokeTts') {
|
|
||||||
result.invokeTts = item.input;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@ -5,17 +5,11 @@
|
|||||||
<img :src="imageUrl()" alt="" />
|
<img :src="imageUrl()" alt="" />
|
||||||
<div class="text__container">
|
<div class="text__container">
|
||||||
<div class="text__title" v-if="showTextTitle">
|
<div class="text__title" v-if="showTextTitle">
|
||||||
<span class="text">{{ localName }}</span>
|
<span class="text">{{ nodeName }}</span>
|
||||||
<el-icon class="editIcon" @click="startEditing"><EditPen/></el-icon>
|
<el-icon class="editIcon" @click="showTextTitle = false"><EditPen/></el-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="input_name_container" v-else >
|
<div class="input_name_container" v-else>
|
||||||
<el-input
|
<el-input v-model="nodeName" @keydown="handleInputKeydown" />
|
||||||
v-model="localName"
|
|
||||||
@focus="handleInputFocus"
|
|
||||||
@keydown="handleInputKeydown"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
/>
|
|
||||||
<el-button
|
<el-button
|
||||||
class="input_name_select"
|
class="input_name_select"
|
||||||
circle
|
circle
|
||||||
@ -48,6 +42,19 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
<!-- <el-tooltip
|
||||||
|
class="box-item"
|
||||||
|
effect="dark"
|
||||||
|
:content="zoomState ? '缩小' : '放大'"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<el-button v-if="showZoom" circle @click="zoom">
|
||||||
|
<el-icon>
|
||||||
|
<ZoomOut v-if="zoomState" />
|
||||||
|
<ZoomIn v-else />
|
||||||
|
</el-icon>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip> -->
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
class="box-item"
|
class="box-item"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
@ -64,11 +71,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="js">
|
<script setup lang="js">
|
||||||
import { onUnmounted, ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { EditPen, Select, CloseBold, Delete, VideoPlay } from '@element-plus/icons-vue'
|
import { EditPen, Select, CloseBold, Delete, ZoomOut, ZoomIn, VideoPlay } from '@element-plus/icons-vue'
|
||||||
import { ElMessageBox } from 'element-plus'
|
import { ElMessageBox } from 'element-plus'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { emitter } from "@/utils/eventBus";
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
icon: {
|
icon: {
|
||||||
@ -95,25 +101,28 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
|
showZoom: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
zoomState: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emits = defineEmits(['setNodeName'])
|
const emits = defineEmits(['zoom', 'setNodeName'])
|
||||||
|
|
||||||
const showTextTitle = ref(true)
|
const showTextTitle = ref(true)
|
||||||
const localName = ref('')
|
const nodeName = ref(props.nodeProperties.name || props.nodeName)
|
||||||
|
|
||||||
// 开始编辑
|
|
||||||
const startEditing = () => {
|
|
||||||
showTextTitle.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirmNodeName = () => {
|
const confirmNodeName = () => {
|
||||||
emits('setNodeName', localName.value)
|
emits('setNodeName', nodeName.value)
|
||||||
showTextTitle.value = true
|
showTextTitle.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const cancelNodeName = () => {
|
const cancelNodeName = () => {
|
||||||
localName.value = props.nodeProperties?.name || props.nodeName
|
nodeName.value = props.nodeProperties?.name || props.nodeName
|
||||||
showTextTitle.value = true
|
showTextTitle.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,10 +145,13 @@ const deleteNode = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
lf.deleteNode(props.nodeId);
|
lf.deleteNode(props.nodeId);
|
||||||
emitter.emit('deleteNode', props.nodeId);
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const zoom = () => {
|
||||||
|
emits('zoom', !props.zoomState)
|
||||||
|
}
|
||||||
|
|
||||||
const execute = () => {
|
const execute = () => {
|
||||||
const myEvent = new CustomEvent('singleNodeExecution', {
|
const myEvent = new CustomEvent('singleNodeExecution', {
|
||||||
bubbles: false, // 是否冒泡(默认 false)
|
bubbles: false, // 是否冒泡(默认 false)
|
||||||
@ -149,13 +161,6 @@ const execute = () => {
|
|||||||
document.dispatchEvent(myEvent);
|
document.dispatchEvent(myEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleInputFocus = (e) => {
|
|
||||||
// 阻止事件冒泡到 LogicFlow
|
|
||||||
e.stopPropagation()
|
|
||||||
e.preventDefault()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleInputKeydown = (e) => {
|
const handleInputKeydown = (e) => {
|
||||||
// 阻止事件冒泡到 Logic Flow 节点,避免被其事件拦截
|
// 阻止事件冒泡到 Logic Flow 节点,避免被其事件拦截
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -168,15 +173,6 @@ const handleInputKeydown = (e) => {
|
|||||||
const imageUrl = () => {
|
const imageUrl = () => {
|
||||||
return new URL(props.icon, import.meta.url).href;
|
return new URL(props.icon, import.meta.url).href;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
localName.value = props.nodeProperties?.name || props.nodeName
|
|
||||||
})
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
console.log(34566)
|
|
||||||
emitter.off("deleteNode");
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.title__container {
|
.title__container {
|
||||||
@ -187,7 +183,6 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.left {
|
.left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center; // 添加垂直居中
|
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 24px;
|
width: 24px;
|
||||||
@ -217,18 +212,6 @@ onUnmounted(() => {
|
|||||||
.el-input {
|
.el-input {
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
width: 120px;
|
width: 120px;
|
||||||
// 确保输入框有更高的 z-index
|
|
||||||
position: relative;
|
|
||||||
z-index: 1000;
|
|
||||||
|
|
||||||
// 覆盖 Element Plus 的默认样式,确保焦点状态明显
|
|
||||||
:deep(.el-input__wrapper) {
|
|
||||||
box-shadow: 0 0 0 1px #409eff !important;
|
|
||||||
|
|
||||||
&:focus-within {
|
|
||||||
box-shadow: 0 0 0 2px #409eff !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input_name_select {
|
.input_name_select {
|
||||||
@ -262,11 +245,4 @@ onUnmounted(() => {
|
|||||||
margin: 8px 0;
|
margin: 8px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加全局样式,确保输入框焦点不被其他元素干扰
|
|
||||||
:global(.lf-node) {
|
|
||||||
.el-input__inner {
|
|
||||||
user-select: text !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -2,11 +2,31 @@
|
|||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="props.drawer"
|
v-model="props.drawer"
|
||||||
custom-class="custom-drawer-header"
|
custom-class="custom-drawer-header"
|
||||||
:title="props.data.properties?.name || '参数配置'"
|
|
||||||
class="no-header-margin"
|
class="no-header-margin"
|
||||||
|
:close-on-click-modal="false"
|
||||||
:before-close="confirm"
|
:close-on-press-escape="false"
|
||||||
|
:show-close="false"
|
||||||
>
|
>
|
||||||
|
<template #header>
|
||||||
|
<div class="drawer-header">
|
||||||
|
<div>{{ props.data.properties?.name || '参数配置' }}</div>
|
||||||
|
<div>
|
||||||
|
<el-popconfirm
|
||||||
|
width="220"
|
||||||
|
confirm-button-text="确认删除"
|
||||||
|
cancel-button-text="误点击,不删除"
|
||||||
|
:icon="InfoFilled"
|
||||||
|
icon-color="#626AEF"
|
||||||
|
title="是否删除此节点?"
|
||||||
|
@confirm="deleteNode"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<el-button type="primary" size="small">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<div class="input__container" v-if="props.data.type === 'start'">
|
<div class="input__container" v-if="props.data.type === 'start'">
|
||||||
<el-collapse v-model="activeNames">
|
<el-collapse v-model="activeNames">
|
||||||
<el-collapse-item name="1" icon-position="left">
|
<el-collapse-item name="1" icon-position="left">
|
||||||
@ -371,14 +391,6 @@
|
|||||||
<info-filled />
|
<info-filled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-button
|
|
||||||
:circle="true"
|
|
||||||
size="small"
|
|
||||||
@click="(e) => addFormItem(e, 'outputParams')"
|
|
||||||
class="addFormItem"
|
|
||||||
>
|
|
||||||
<el-icon :size="14"><Plus /></el-icon>
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
<div class="form__container">
|
<div class="form__container">
|
||||||
<el-form
|
<el-form
|
||||||
@ -915,288 +927,17 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="props.data.type === 'sdAgent'">
|
<template #footer>
|
||||||
<el-form
|
|
||||||
:inline="true"
|
|
||||||
:model="sdAgentNodeData"
|
|
||||||
:rules="rules"
|
|
||||||
ref="dynamicForm"
|
|
||||||
class="http-form"
|
|
||||||
label-position="top"
|
|
||||||
label-width="auto"
|
|
||||||
>
|
|
||||||
<el-collapse v-model="activeNames">
|
|
||||||
<el-collapse-item name="1" title="请求配置" icon-position="left">
|
|
||||||
<div class="form__container">
|
|
||||||
<div v-for="(property, index) in sdAgentNodeData.config" :key="index">
|
|
||||||
<el-row>
|
|
||||||
<el-form-item
|
|
||||||
:label="index === 0 ? '参数名' : ''"
|
|
||||||
:prop="`config.${index}.name`"
|
|
||||||
:rules="[
|
|
||||||
{ required: true, message: '请输入参数名', trigger: 'blur' },
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
:disabled="true"
|
|
||||||
class="param-name"
|
|
||||||
v-model="property.name"
|
|
||||||
placeholder="请输入"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
:label="index === 0 ? '参数值' : ''"
|
|
||||||
:prop="`config.${index}.input`"
|
|
||||||
>
|
|
||||||
<el-select
|
|
||||||
v-model="property.type"
|
|
||||||
class="param-type"
|
|
||||||
@change="handleTypeChange(index)"
|
|
||||||
>
|
|
||||||
<el-option label="引用" value="quote" />
|
|
||||||
<el-option label="输入" value="input" />
|
|
||||||
</el-select>
|
|
||||||
<el-form-item
|
|
||||||
v-if="property.type === 'input'"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: property?.required ?? true,
|
|
||||||
message: '请输入参数值',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
:prop="`config.${index}.input`"
|
|
||||||
>
|
|
||||||
<el-input-number
|
|
||||||
class="param-value"
|
|
||||||
v-if="property.componentType === 'number'"
|
|
||||||
v-model="property.input"
|
|
||||||
:min="0"
|
|
||||||
:max="property.max || Infinity"
|
|
||||||
:controls="false"
|
|
||||||
:step-strictly="true"
|
|
||||||
placeholder="请输入"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
<el-select
|
|
||||||
v-model="property.input"
|
|
||||||
class="param-value"
|
|
||||||
v-else-if="property.componentType === 'select'"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in property.selectOptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
<el-input
|
|
||||||
class="param-value"
|
|
||||||
v-else
|
|
||||||
v-model="property.input"
|
|
||||||
placeholder="请输入"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
v-if="property.type === 'quote'"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择参数值',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
:prop="`config.${index}.quote`"
|
|
||||||
>
|
|
||||||
<el-cascader
|
|
||||||
:ref="
|
|
||||||
(el) => {
|
|
||||||
if (el) cascaderRefs[index] = el;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
v-model="property.quote"
|
|
||||||
:checkStrictly="true"
|
|
||||||
:options="quoteOptions"
|
|
||||||
placeholder="请选择"
|
|
||||||
@visible-change="
|
|
||||||
(visible) => visibleChange(visible, index, property.quote)
|
|
||||||
"
|
|
||||||
@change="(value) => cascaderChange(value, index, 'sdAgentConfig')"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form-item>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
<el-row>
|
|
||||||
<span style="margin-right: 24px">是否调用TTS接口</span>
|
|
||||||
<el-switch size="small" v-model="sdAgentNodeData.invokeTts" @change="handleTtsChange" />
|
|
||||||
</el-row>
|
|
||||||
<div v-if="sdAgentNodeData.invokeTts" >
|
|
||||||
<div style="margin: 10px 0">TTS参数设置</div>
|
|
||||||
<div v-for="(property, index) in sdAgentNodeData.tts" :key="index">
|
|
||||||
<el-row>
|
|
||||||
<el-form-item
|
|
||||||
:label="index === 0 ? '参数名' : ''"
|
|
||||||
:prop="`tts.${index}.name`"
|
|
||||||
:rules="[
|
|
||||||
{ required: true, message: '请输入参数名', trigger: 'blur' },
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
:disabled="true"
|
|
||||||
class="param-name"
|
|
||||||
v-model="property.name"
|
|
||||||
placeholder="请输入"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
:label="index === 0 ? '参数值' : ''"
|
|
||||||
:prop="`tts.${index}.input`"
|
|
||||||
>
|
|
||||||
<el-select
|
|
||||||
v-model="property.type"
|
|
||||||
class="param-type"
|
|
||||||
@change="handleTypeChange(index)"
|
|
||||||
>
|
|
||||||
<el-option label="引用" value="quote" />
|
|
||||||
<el-option label="输入" value="input" />
|
|
||||||
</el-select>
|
|
||||||
<el-form-item
|
|
||||||
v-if="property.type === 'input'"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: property?.required ?? true,
|
|
||||||
message: '请输入参数值',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
:prop="`tts.${index}.input`"
|
|
||||||
>
|
|
||||||
<el-input-number
|
|
||||||
class="param-value"
|
|
||||||
v-if="property.componentType === 'number'"
|
|
||||||
v-model="property.input"
|
|
||||||
:min="0"
|
|
||||||
:max="property.max || Infinity"
|
|
||||||
:controls="false"
|
|
||||||
:step-strictly="true"
|
|
||||||
placeholder="请输入"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
<el-select
|
|
||||||
v-model="property.input"
|
|
||||||
class="param-value"
|
|
||||||
v-else-if="property.componentType === 'select'"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in property.selectOptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
<el-input
|
|
||||||
class="param-value"
|
|
||||||
v-else
|
|
||||||
v-model="property.input"
|
|
||||||
placeholder="请输入"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
v-if="property.type === 'quote'"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择参数值',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
:prop="`tts.${index}.quote`"
|
|
||||||
>
|
|
||||||
<el-cascader
|
|
||||||
:ref="
|
|
||||||
(el) => {
|
|
||||||
if (el) cascaderRefs[index] = el;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
v-model="property.quote"
|
|
||||||
:checkStrictly="true"
|
|
||||||
:options="quoteOptions"
|
|
||||||
placeholder="请选择"
|
|
||||||
@visible-change="
|
|
||||||
(visible) => visibleChange(visible, index, property.quote)
|
|
||||||
"
|
|
||||||
@change="(value) => cascaderChange(value, index, 'sdAgentTts')"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form-item>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-collapse-item>
|
|
||||||
<el-collapse-item name="3" icon-position="left">
|
|
||||||
<template #title>
|
|
||||||
输出参数
|
|
||||||
<el-tooltip
|
|
||||||
class="box-item"
|
|
||||||
effect="dark"
|
|
||||||
content="这里定义的输出变量可以被后续节点引用。"
|
|
||||||
placement="top"
|
|
||||||
>
|
|
||||||
<el-icon class="header-icon" style="margin-left: 6px">
|
|
||||||
<info-filled />
|
|
||||||
</el-icon>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-button
|
|
||||||
:circle="true"
|
|
||||||
size="small"
|
|
||||||
@click="(e) => addSdAgentItem(e)"
|
|
||||||
class="addFormItem"
|
|
||||||
>
|
|
||||||
<el-icon :size="14"><Plus /></el-icon>
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
<div class="form__container">
|
|
||||||
<el-form
|
|
||||||
:inline="true"
|
|
||||||
:model="sdAgentNodeData"
|
|
||||||
label-position="top"
|
|
||||||
label-width="auto"
|
|
||||||
:rules="outputRules"
|
|
||||||
ref="outputFormRef"
|
|
||||||
>
|
|
||||||
<FormItemRecursive
|
|
||||||
formType="output"
|
|
||||||
:current-list="sdAgentNodeData.outputParams"
|
|
||||||
prop-path="outputParams"
|
|
||||||
:depth="0"
|
|
||||||
:is-first-level="true"
|
|
||||||
:endDepth="2"
|
|
||||||
:parent-path="[]"
|
|
||||||
@delete-item="(path) => deleteSdAgentItem(path, 'outputParams')"
|
|
||||||
/>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
</el-collapse-item>
|
|
||||||
</el-collapse>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
<!-- <template #footer>
|
|
||||||
<el-button @click="cancel">取消</el-button>
|
|
||||||
<el-button type="primary" @click="confirm">保存</el-button>
|
<el-button type="primary" @click="confirm">保存</el-button>
|
||||||
</template> -->
|
</template>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import FormItemRecursive from "./FormItemRecursive.vue";
|
import FormItemRecursive from "./FormItemRecursive.vue";
|
||||||
import { Plus, Minus } from "@element-plus/icons-vue";
|
import { Plus, Minus } from "@element-plus/icons-vue";
|
||||||
import { getInput, transformHttpNodeData, transformSdAgentNodeData } from "@/utils/flow";
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { getInput, filterEmptyName, transformHttpNodeData } from "@/utils/flow";
|
||||||
import { emitter } from "@/utils/eventBus";
|
import { emitter } from "@/utils/eventBus";
|
||||||
import * as monaco from 'monaco-editor';
|
import * as monaco from 'monaco-editor';
|
||||||
import { nextTick, onUnmounted, watch } from "vue";
|
import { nextTick, onUnmounted, watch } from "vue";
|
||||||
@ -1208,6 +949,11 @@ const props = defineProps({
|
|||||||
|
|
||||||
const emits = defineEmits(['close'])
|
const emits = defineEmits(['close'])
|
||||||
|
|
||||||
|
const deleteNode = () => {
|
||||||
|
lf.deleteNode(props.data.id);
|
||||||
|
emits('close')
|
||||||
|
}
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
inputParams: [],
|
inputParams: [],
|
||||||
nodeParams: [],
|
nodeParams: [],
|
||||||
@ -1222,23 +968,17 @@ let editorInstance
|
|||||||
const dynamicForm = ref()
|
const dynamicForm = ref()
|
||||||
const outputFormRef = ref()
|
const outputFormRef = ref()
|
||||||
|
|
||||||
const throwAnError = (flag) => {
|
|
||||||
if (dynamicForm.value) {
|
|
||||||
dynamicForm.value.clearValidate()
|
|
||||||
}
|
|
||||||
if (outputFormRef.value) {
|
|
||||||
outputFormRef.value.clearValidate()
|
|
||||||
}
|
|
||||||
emitter.emit("throwAnError", { id: props.data.id, hasError: flag });
|
|
||||||
emits('close')
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirm = async () => {
|
const confirm = async () => {
|
||||||
if (props.data.type === 'http') {
|
if (props.data.type === 'http') {
|
||||||
if (dynamicForm.value) {
|
if (dynamicForm.value) {
|
||||||
await dynamicForm.value.validate((valid, fields) => {
|
await dynamicForm.value.validate((valid, fields) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
if (httpNodeData.value.body.type === 'json') {
|
||||||
|
if (hasErrors()) {
|
||||||
|
ElMessage.error('JSON中存在错误,请修正后再保存!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
const nodeParams = []
|
const nodeParams = []
|
||||||
nodeParams.push({ name: "config", type: "input", input: "", children: httpNodeData.value.config, disabled: true, required: true })
|
nodeParams.push({ name: "config", type: "input", input: "", children: httpNodeData.value.config, disabled: true, required: true })
|
||||||
if (httpNodeData.value?.headers?.length > 0) {
|
if (httpNodeData.value?.headers?.length > 0) {
|
||||||
@ -1256,64 +996,26 @@ const confirm = async () => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
nodeParams.push(bodyObj)
|
nodeParams.push(bodyObj)
|
||||||
|
|
||||||
lf.setProperties(props.data.id, {
|
lf.setProperties(props.data.id, {
|
||||||
...props.data.properties,
|
...props.data.properties,
|
||||||
nodeParams
|
nodeParams
|
||||||
});
|
});
|
||||||
|
|
||||||
emitter.emit("setProperties", { id: props.data.id});
|
emitter.emit("setProperties", { id: props.data.id});
|
||||||
if (httpNodeData.value.body.type === 'json') {
|
emits('close')
|
||||||
if (hasErrors()) {
|
|
||||||
throwAnError(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throwAnError(false)
|
|
||||||
} else {
|
} else {
|
||||||
throwAnError(true)
|
console.log('error submit!', fields)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (props.data.type === 'sdAgent') {
|
|
||||||
// 处理 sdAgent 节点的保存逻辑
|
|
||||||
let inputValidate = true
|
|
||||||
let outputValidate = true
|
|
||||||
if (dynamicForm.value) {
|
|
||||||
await dynamicForm.value.validate((valid) => {
|
|
||||||
if (!valid) {
|
|
||||||
inputValidate = false
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (outputFormRef.value) {
|
|
||||||
await outputFormRef.value.validate((valid) => {
|
|
||||||
if (!valid) {
|
|
||||||
outputValidate = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const nodeParams = []
|
|
||||||
nodeParams.push({ name: "config", type: "input", input: "", children: sdAgentNodeData.value.config, required: true })
|
|
||||||
nodeParams.push({ name: "invokeTts", type: "input", input: sdAgentNodeData.value.invokeTts })
|
|
||||||
if (sdAgentNodeData.value.invokeTts) {
|
|
||||||
nodeParams.push({ name: "tts", type: "input", input: "", children: sdAgentNodeData.value.tts })
|
|
||||||
}
|
|
||||||
lf.setProperties(props.data.id, {
|
|
||||||
...props.data.properties,
|
|
||||||
nodeParams,
|
|
||||||
outputParams: sdAgentNodeData.value.outputParams
|
|
||||||
});
|
|
||||||
|
|
||||||
emitter.emit("setProperties", { id: props.data.id});
|
|
||||||
|
|
||||||
// 验证通过
|
|
||||||
if (inputValidate && outputValidate) {
|
|
||||||
throwAnError(false)
|
|
||||||
} else {
|
|
||||||
throwAnError(true)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (props.data.type === 'code') {
|
if (props.data.type === 'code') {
|
||||||
|
if (hasErrors()) {
|
||||||
|
ElMessage.error('代码中存在错误,请修正后再保存!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const targetObj = formData.nodeParams.find(item => item.name === 'code');
|
const targetObj = formData.nodeParams.find(item => item.name === 'code');
|
||||||
if (targetObj) {
|
if (targetObj) {
|
||||||
// 存在:修改该对象的 input 属性
|
// 存在:修改该对象的 input 属性
|
||||||
@ -1342,30 +1044,22 @@ const confirm = async () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
lf.setProperties(props.data.id, {
|
|
||||||
...props.data.properties,
|
|
||||||
...formData
|
|
||||||
});
|
|
||||||
emitter.emit("setProperties", { id: props.data.id});
|
|
||||||
|
|
||||||
// 验证通过
|
// 验证通过
|
||||||
if (inputValidate && outputValidate) {
|
if (inputValidate && outputValidate) {
|
||||||
if (props.data.type === 'code') {
|
lf.setProperties(props.data.id, {
|
||||||
if (hasErrors()) {
|
...props.data.properties,
|
||||||
throwAnError(true)
|
...formData
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
throwAnError(false)
|
emitter.emit("setProperties", { id: props.data.id});
|
||||||
} else {
|
emits('close')
|
||||||
throwAnError(true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除顶层表单项
|
// 删除顶层表单项
|
||||||
const deleteTopLevelItem = (fullPath, propPath) => {
|
const deleteTopLevelItem = (fullPath, propPath) => {
|
||||||
// 从顶层数据开始查找
|
// 从顶层数据开始查找
|
||||||
let currentLevel = formData[propPath];
|
let currentLevel = formData[propPath];
|
||||||
|
|
||||||
// 遍历路径(除最后一个索引,因为最后一个是要删除的项)
|
// 遍历路径(除最后一个索引,因为最后一个是要删除的项)
|
||||||
@ -1440,12 +1134,6 @@ const cascaderChange = (value, index, type = 'default') => {
|
|||||||
if (type === 'default') {
|
if (type === 'default') {
|
||||||
formData.nodeParams[index].quote = value;
|
formData.nodeParams[index].quote = value;
|
||||||
formData.nodeParams[index].quoteType = selectedOptions[0].data.type;
|
formData.nodeParams[index].quoteType = selectedOptions[0].data.type;
|
||||||
}else if (type === 'sdAgentConfig') {
|
|
||||||
sdAgentNodeData.value.config[index].quote = value;
|
|
||||||
sdAgentNodeData.value.config[index].quoteType = selectedOptions[0].data.type;
|
|
||||||
} else if (type === 'sdAgentTts') {
|
|
||||||
sdAgentNodeData.value.tts[index].quote = value;
|
|
||||||
sdAgentNodeData.value.tts[index].quoteType = selectedOptions[0].data.type;
|
|
||||||
} else {
|
} else {
|
||||||
httpNodeData.value.body.formData[index].quote = value;
|
httpNodeData.value.body.formData[index].quote = value;
|
||||||
httpNodeData.value.body.formData[index].quoteType = selectedOptions[0].data.type;
|
httpNodeData.value.body.formData[index].quoteType = selectedOptions[0].data.type;
|
||||||
@ -1563,7 +1251,6 @@ watch(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// HTTP 节点数据
|
|
||||||
const httpNodeData = ref({});
|
const httpNodeData = ref({});
|
||||||
|
|
||||||
const addHttpNodeFormItem = (e, type) => {
|
const addHttpNodeFormItem = (e, type) => {
|
||||||
@ -1589,52 +1276,6 @@ const handleHttpNodeDelete = (type, index) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 商道智能体
|
|
||||||
const sdAgentNodeData = ref({})
|
|
||||||
|
|
||||||
const voiceOptions = () => {
|
|
||||||
return [{
|
|
||||||
value: 'x4_xiaoyan',
|
|
||||||
label: 'x4_xiaoyan'
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleTtsChange = (val) => {
|
|
||||||
if (val) {
|
|
||||||
sdAgentNodeData.value.tts = []
|
|
||||||
if (!sdAgentNodeData.value.tts || sdAgentNodeData.value.tts.length === 0) {
|
|
||||||
sdAgentNodeData.value.tts = [
|
|
||||||
{ name: 'url', type: "input", input: "", disabled: true },
|
|
||||||
{ name: 'text', type: "input", input: "", disabled: true },
|
|
||||||
{ name: 'speed', type: "input", input: "", max: 100, disabled: true },
|
|
||||||
{ name: 'voice', type: "input", input: "", componentType: 'select', selectOptions: voiceOptions(), disabled: true },
|
|
||||||
{ name: 'volume', type: "input", input: "", componentType: 'number', max: 100, disabled: true }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const addSdAgentItem = (e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
sdAgentNodeData.value.outputParams.push({ name: "", type: "string", input: "" });
|
|
||||||
}
|
|
||||||
|
|
||||||
const deleteSdAgentItem = (fullPath, propPath) => {
|
|
||||||
// 从顶层数据开始查找
|
|
||||||
let currentLevel = sdAgentNodeData.value[propPath];
|
|
||||||
|
|
||||||
// 遍历路径(除最后一个索引,因为最后一个是要删除的项)
|
|
||||||
for (let i = 0; i < fullPath.length - 1; i++) {
|
|
||||||
const index = fullPath[i];
|
|
||||||
// 进入下一层级
|
|
||||||
currentLevel = currentLevel[index].children;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 最后一个索引是当前层级要删除的项
|
|
||||||
const lastIndex = fullPath[fullPath.length - 1];
|
|
||||||
currentLevel.splice(lastIndex, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.data,
|
() => props.data,
|
||||||
() => {
|
() => {
|
||||||
@ -1663,6 +1304,7 @@ watch(
|
|||||||
const nodeParams = JSON.parse(JSON.stringify(props.data.properties.nodeParams || []))
|
const nodeParams = JSON.parse(JSON.stringify(props.data.properties.nodeParams || []))
|
||||||
const transformedData = transformHttpNodeData(nodeParams);
|
const transformedData = transformHttpNodeData(nodeParams);
|
||||||
httpNodeData.value = transformedData;
|
httpNodeData.value = transformedData;
|
||||||
|
console.log('httpNodeData', httpNodeData.value);
|
||||||
if (httpNodeData.value.body.type === 'json') {
|
if (httpNodeData.value.body.type === 'json') {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (editorInstance) {
|
if (editorInstance) {
|
||||||
@ -1670,15 +1312,6 @@ watch(
|
|||||||
}
|
}
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
} else if (props.data.type === 'sdAgent') {
|
|
||||||
const nodeParams = JSON.parse(JSON.stringify(props.data.properties.nodeParams || []))
|
|
||||||
const outputParams = JSON.parse(JSON.stringify(props.data.properties.outputParams || []))
|
|
||||||
const transformedData = transformSdAgentNodeData(nodeParams);
|
|
||||||
sdAgentNodeData.value = {
|
|
||||||
...transformedData,
|
|
||||||
outputParams
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1688,8 +1321,6 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
emitter.off('throwAnError');
|
|
||||||
emitter.off('setProperties');
|
|
||||||
disposeEditor()
|
disposeEditor()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -292,7 +292,6 @@ export const collapseList = [
|
|||||||
type: "http",
|
type: "http",
|
||||||
desc: "HTTP请求",
|
desc: "HTTP请求",
|
||||||
action: 'HTTP',
|
action: 'HTTP',
|
||||||
nodeType: 'HTTP',
|
|
||||||
nodeParams: [
|
nodeParams: [
|
||||||
{ name: "config", type: "input", input: "", children: [
|
{ name: "config", type: "input", input: "", children: [
|
||||||
{ name: "url", type: "input", input: "", disabled: true, required: true },
|
{ name: "url", type: "input", input: "", disabled: true, required: true },
|
||||||
@ -324,15 +323,15 @@ export const collapseList = [
|
|||||||
nodeParams: [
|
nodeParams: [
|
||||||
{ name: "input", type: "input", input: "", required: true },
|
{ name: "input", type: "input", input: "", required: true },
|
||||||
{ name: "code", type: "input", input: `
|
{ name: "code", type: "input", input: `
|
||||||
// 方法定义不能修改
|
// 方法定义不能修改
|
||||||
function handler(params) {
|
function handler(params) {
|
||||||
// 返回值是一个可序列化成 json 的 dict 或 object
|
// 返回值是一个可序列化成 json 的 dict 或 object
|
||||||
const result ={
|
const result ={
|
||||||
type: 2,
|
type: 2,
|
||||||
message: params.input
|
message: params.input
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
`, required: true }
|
`, required: true }
|
||||||
],
|
],
|
||||||
outputType: 'json',
|
outputType: 'json',
|
||||||
@ -347,6 +346,7 @@ function handler(params) {
|
|||||||
type: "currentLoop",
|
type: "currentLoop",
|
||||||
desc: "获取当前循环对象",
|
desc: "获取当前循环对象",
|
||||||
action: 'GET_CURRENT_OBJECT',
|
action: 'GET_CURRENT_OBJECT',
|
||||||
|
nodeType: 'getCurrentObject',
|
||||||
nodeParams: [
|
nodeParams: [
|
||||||
{ name: "array", type: "input", input: "" }
|
{ name: "array", type: "input", input: "" }
|
||||||
],
|
],
|
||||||
@ -459,24 +459,14 @@ function handler(params) {
|
|||||||
}, {
|
}, {
|
||||||
icon: dialogueSvg,
|
icon: dialogueSvg,
|
||||||
name: "商道智能体",
|
name: "商道智能体",
|
||||||
type: "sdAgent",
|
type: "serviceNode",
|
||||||
desc: "通过apiKey调用商道大模型",
|
desc: "通过apiKey调用商道大模型",
|
||||||
action: 'AI_AGENT_PLATFORM',
|
action: 'AI_AGENT_PLATFORM',
|
||||||
nodeType: "LLM",
|
nodeType: "LLM",
|
||||||
outputType: 'json',
|
outputType: 'json',
|
||||||
nodeParams: [
|
nodeParams: [
|
||||||
{ name: "config", type: "input", input: "", children: [
|
{ name: 'apiKey', type: "input", input: "", disabled: true },
|
||||||
{ name: 'apiKey', type: "input", input: "", disabled: true },
|
{ name: 'text', type: "input", input: "", disabled: true }
|
||||||
{ name: 'text', type: "input", input: "", disabled: true },
|
|
||||||
]},
|
|
||||||
{ name: 'invokeTts', type: "input", input: false },
|
|
||||||
{ name: 'tts', type: "input", input: "", children: [
|
|
||||||
{ name: 'url', type: "input", input: "", disabled: true },
|
|
||||||
{ name: 'text', type: "input", input: "", disabled: true },
|
|
||||||
{ name: 'speed', type: "input", input: "", max: 100, disabled: true },
|
|
||||||
{ name: 'voice', type: "input", input: "", componentType: 'select', selectOptions: voiceOptions(), disabled: true },
|
|
||||||
{ name: 'volume', type: "input", input: "", componentType: 'number', max: 100, disabled: true }
|
|
||||||
], disabled: true }
|
|
||||||
],
|
],
|
||||||
outputParams: [{ name: 'result', type: 'string', desc: '商道大模型的返回文案', disabled: true}]
|
outputParams: [{ name: 'result', type: 'string', desc: '商道大模型的返回文案', disabled: true}]
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@ -8,9 +8,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btn__container">
|
<div class="btn__container">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<el-tag style="margin-right: 12px;" v-if="['testRunError', 'testRunFinish'].includes(flowState)" :type="flowState === 'testRunFinish' ? 'success' : 'danger'">
|
|
||||||
{{ totalRunningTime }}ms
|
|
||||||
</el-tag>
|
|
||||||
<el-button v-if="['testRunError', 'testRunFinish', 'stop'].includes(flowState)" @click="clearRun">清除上一次运行结果</el-button>
|
<el-button v-if="['testRunError', 'testRunFinish', 'stop'].includes(flowState)" @click="clearRun">清除上一次运行结果</el-button>
|
||||||
<el-button @click="group">分组</el-button>
|
<el-button @click="group">分组</el-button>
|
||||||
<el-button v-if="flowState !== 'testRunning'" @click="testRun">试运行</el-button>
|
<el-button v-if="flowState !== 'testRunning'" @click="testRun">试运行</el-button>
|
||||||
@ -274,11 +271,6 @@ const testRun = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodeErrorList.value.length > 0) {
|
|
||||||
ElMessage.warning("存在参数错误的节点,请检查!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
isOpen.value = true;
|
isOpen.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -291,8 +283,6 @@ const flowPauseFn = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const totalRunningTime = ref(0);
|
|
||||||
|
|
||||||
const flowResumeFn = async () => {
|
const flowResumeFn = async () => {
|
||||||
const res = await flowResume(instId.value);
|
const res = await flowResume(instId.value);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
@ -419,7 +409,6 @@ const loopFlowView = async (instId, taskId = null) => {
|
|||||||
if (!flowInfoData.value.isLog) {
|
if (!flowInfoData.value.isLog) {
|
||||||
flowStore.updateDisableForm(false);
|
flowStore.updateDisableForm(false);
|
||||||
flowState.value = "testRunFinish";
|
flowState.value = "testRunFinish";
|
||||||
totalRunningTime.value = arr[arr.length - 1].endTime - arr[0].startTime
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!flowInfoData.value.isLog) {
|
if (!flowInfoData.value.isLog) {
|
||||||
@ -427,7 +416,6 @@ const loopFlowView = async (instId, taskId = null) => {
|
|||||||
flowState.value = arr[arr.length - 1]?.status === "PAUSED" ? "pause" : "stop";
|
flowState.value = arr[arr.length - 1]?.status === "PAUSED" ? "pause" : "stop";
|
||||||
} else {
|
} else {
|
||||||
flowState.value = "testRunError";
|
flowState.value = "testRunError";
|
||||||
totalRunningTime.value = arr[arr.length - 1].endTime - arr[0].startTime
|
|
||||||
flowStore.updateDisableForm(false);
|
flowStore.updateDisableForm(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -619,6 +607,8 @@ const initFlow = () => {
|
|||||||
lf.on("node:mousemove", ({ data, e }) => {
|
lf.on("node:mousemove", ({ data, e }) => {
|
||||||
const { nodes } = lf.getGraphData();
|
const { nodes } = lf.getGraphData();
|
||||||
const arr = recursiveFilter(nodes, data.id, "loop");
|
const arr = recursiveFilter(nodes, data.id, "loop");
|
||||||
|
// const arr = findRelationNodesById(nodes, data.id);
|
||||||
|
console.log('arr', arr)
|
||||||
arr.forEach((item) => {
|
arr.forEach((item) => {
|
||||||
const node = lf.getNodeModelById(item.id);
|
const node = lf.getNodeModelById(item.id);
|
||||||
node.updateSize();
|
node.updateSize();
|
||||||
@ -639,6 +629,7 @@ const initFlow = () => {
|
|||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log("data", data);
|
||||||
showParamsDrawer.value = true;
|
showParamsDrawer.value = true;
|
||||||
paramsDrawerData.value = data;
|
paramsDrawerData.value = data;
|
||||||
});
|
});
|
||||||
@ -669,8 +660,6 @@ const group = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (children.length === 0) {
|
if (children.length === 0) {
|
||||||
lf.clearSelectElements();
|
|
||||||
lf.extension.selectionSelect.closeSelectionSelect();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let width = maxX - minX + PADDING;
|
let width = maxX - minX + PADDING;
|
||||||
@ -774,8 +763,6 @@ const clearRun = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const nodeErrorList = ref([]);
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
justLoadFlow();
|
justLoadFlow();
|
||||||
initFlow();
|
initFlow();
|
||||||
@ -787,27 +774,6 @@ onMounted(() => {
|
|||||||
paramsDrawerData.value = node;
|
paramsDrawerData.value = node;
|
||||||
});
|
});
|
||||||
|
|
||||||
emitter.on("throwAnError", (data) => {
|
|
||||||
// 处理错误抛出逻辑
|
|
||||||
const { id, hasError } = data;
|
|
||||||
const element = document.getElementsByClassName(`node__container ${id}`)[0].parentElement;
|
|
||||||
if (hasError) {
|
|
||||||
if (!nodeErrorList.value.includes(id)) {
|
|
||||||
nodeErrorList.value.push(id);
|
|
||||||
element.style.background = "#ff00001a";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
nodeErrorList.value = nodeErrorList.value.filter((item) => item !== id);
|
|
||||||
element.style.background = "#fff";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
emitter.on("deleteNode", (nodeId) => {
|
|
||||||
const index = nodeErrorList.value.findIndex((item) => item === nodeId);
|
|
||||||
if (index !== -1) {
|
|
||||||
nodeErrorList.value.splice(index, 1);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const operationEdge = (arr) => {
|
const operationEdge = (arr) => {
|
||||||
@ -819,8 +785,6 @@ const operationEdge = (arr) => {
|
|||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
emitter.off("changeNodeState");
|
emitter.off("changeNodeState");
|
||||||
emitter.off("openParamsDrawer");
|
emitter.off("openParamsDrawer");
|
||||||
emitter.off("throwAnError");
|
|
||||||
emitter.off("deleteNode");
|
|
||||||
|
|
||||||
window.removeEventListener("beforeunload", handleBeforeUnload);
|
window.removeEventListener("beforeunload", handleBeforeUnload);
|
||||||
document.removeEventListener("singleNodeExecution", singleNodeExecution);
|
document.removeEventListener("singleNodeExecution", singleNodeExecution);
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import { registerSleepNode } from './sleep'
|
|||||||
import { registerHttpNode } from './httpNode'
|
import { registerHttpNode } from './httpNode'
|
||||||
import { registerCodeNode } from './codeNode'
|
import { registerCodeNode } from './codeNode'
|
||||||
import { registerCurrentLoopNode } from './currentLoopNode'
|
import { registerCurrentLoopNode } from './currentLoopNode'
|
||||||
import { registerSdAgentNode } from './sdAgent'
|
|
||||||
|
|
||||||
export const registerFunction = (lf) => {
|
export const registerFunction = (lf) => {
|
||||||
registerLoopBodyNode(lf)
|
registerLoopBodyNode(lf)
|
||||||
@ -19,5 +18,4 @@ export const registerFunction = (lf) => {
|
|||||||
registerHttpNode(lf)
|
registerHttpNode(lf)
|
||||||
registerCodeNode(lf)
|
registerCodeNode(lf)
|
||||||
registerCurrentLoopNode(lf)
|
registerCurrentLoopNode(lf)
|
||||||
registerSdAgentNode(lf)
|
|
||||||
}
|
}
|
||||||
@ -1,213 +0,0 @@
|
|||||||
// 导入 HtmlNode 及其模型,为后续继承做准备
|
|
||||||
import { HtmlNode, HtmlNodeModel } from "@logicflow/core";
|
|
||||||
// 导入 Vue 相关方法,用于渲染组件
|
|
||||||
import { createApp, h, nextTick } from "vue";
|
|
||||||
import ElementPlus from "element-plus";
|
|
||||||
// 导入 Vue 组件
|
|
||||||
// @ts-ignore
|
|
||||||
import SdAgent from "./sdAgent.vue";
|
|
||||||
import OuterNode from "../../components/OuterNode.vue";
|
|
||||||
import JsonViewer from 'vue3-json-viewer'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定义一个 元素的 HTML 节点类,继承自 HtmlNode
|
|
||||||
* 该类负责在 HTML 中渲染 元素,并处理其交互逻辑
|
|
||||||
*/
|
|
||||||
class SdAgentNodeHtmlNode extends HtmlNode {
|
|
||||||
resizeObserver = null;
|
|
||||||
isMounted; // 标记组件是否已挂载
|
|
||||||
r; // 渲染函数
|
|
||||||
app; // Vue 应用实例
|
|
||||||
container = null;
|
|
||||||
|
|
||||||
static reusePool = new Map(); // 节点复用池
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造函数
|
|
||||||
* @param props 传递给节点的属性,包括模型、图模型等
|
|
||||||
*/
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.initVueApp(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
initVueApp(props) {
|
|
||||||
this.isMounted = false;
|
|
||||||
|
|
||||||
this.hideAnchor = false;
|
|
||||||
this.autoExpand = true; // 防止锚点被折叠
|
|
||||||
this.anchorsPreset = "default"; // 重置锚点预设
|
|
||||||
// 创建 元素的渲染函数
|
|
||||||
this.r = h(OuterNode, {
|
|
||||||
model: props.model,
|
|
||||||
component: SdAgent,
|
|
||||||
properties: {
|
|
||||||
...props.model.getProperties(),
|
|
||||||
},
|
|
||||||
onContentChange: this.handleContentChange.bind(this),
|
|
||||||
onBindRef: this.handleComponentInstance.bind(this)
|
|
||||||
});
|
|
||||||
|
|
||||||
// 创建 Vue 应用实例,并指定渲染函数
|
|
||||||
this.app = createApp({
|
|
||||||
render: () => this.r,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将 HTML 内容设置到指定的根元素上
|
|
||||||
* @param rootEl 根元素
|
|
||||||
*/
|
|
||||||
async setHtml(rootEl) {
|
|
||||||
const nodeId = this.props.model.id;
|
|
||||||
if (SdAgentNodeHtmlNode.reusePool.has(nodeId)) {
|
|
||||||
rootEl.appendChild(SdAgentNodeHtmlNode.reusePool.get(nodeId));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.isMounted) {
|
|
||||||
this.isMounted = true;
|
|
||||||
this.container = document.createElement("div");
|
|
||||||
this.container.style.display = "inline-block"; // 关键:确保容器自适应内容
|
|
||||||
|
|
||||||
rootEl.appendChild(this.container);
|
|
||||||
this.app.use(ElementPlus);
|
|
||||||
this.app.use(JsonViewer);
|
|
||||||
|
|
||||||
this.app.mount(this.container);
|
|
||||||
await nextTick();
|
|
||||||
this.setupSizeObserver();
|
|
||||||
SdAgentNodeHtmlNode.reusePool.set(nodeId, this.container);
|
|
||||||
} else {
|
|
||||||
this.r.component.props.properties = this.props.model.getProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取节点文本内容
|
|
||||||
* 对于元素,返回 null,因为其内容由特定组件渲染
|
|
||||||
* @returns {null}
|
|
||||||
*/
|
|
||||||
getText() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleComponentInstance(data) {
|
|
||||||
// 将组件实例保存到节点模型
|
|
||||||
this.props.model.setComponentInstance(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
handleContentChange() {
|
|
||||||
// 内容变化时强制更新尺寸
|
|
||||||
this.updateNodeSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 渲染完成后获取实际尺寸
|
|
||||||
updateNodeSize() {
|
|
||||||
if (this.container) {
|
|
||||||
const { SCALE_X, SCALE_Y } = this.props.graphModel.transformModel;
|
|
||||||
const node = this.container.querySelector(".node__container");
|
|
||||||
const rect = node.getBoundingClientRect();
|
|
||||||
this.props.model.updateSize(rect.width / SCALE_X, rect.height / SCALE_Y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setupSizeObserver() {
|
|
||||||
// 首次渲染立即检测
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
this.updateNodeSize();
|
|
||||||
// 持续监听变化
|
|
||||||
this.resizeObserver = new ResizeObserver(() => {
|
|
||||||
this.updateNodeSize();
|
|
||||||
});
|
|
||||||
this.resizeObserver.observe(this.container);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 组件卸载时移除监听
|
|
||||||
onDestroy() {
|
|
||||||
this.resizeObserver?.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定义一个元素的 HTML 模型类,继承自 HtmlNodeModel
|
|
||||||
* 该类主要设置节点的属性和样式
|
|
||||||
*/
|
|
||||||
class SdAgentNodeHtmlModel extends HtmlNodeModel {
|
|
||||||
initNodeData(data) {
|
|
||||||
super.initNodeData(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存组件实例引用
|
|
||||||
setComponentInstance(instance) {
|
|
||||||
this.componentInstance = instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
closePopover() {
|
|
||||||
this.componentInstance.closePopover()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置节点属性
|
|
||||||
* 包括宽度、高度、文本编辑属性等
|
|
||||||
*/
|
|
||||||
setAttributes() {
|
|
||||||
// 初始设置为0,后续动态更新
|
|
||||||
this.width = 0;
|
|
||||||
this.height = 0;
|
|
||||||
this.text.editable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSize(width, height) {
|
|
||||||
this.width = width + 24;
|
|
||||||
this.height = height + 50;
|
|
||||||
this.initNodeData(this); // 触发节点重绘
|
|
||||||
}
|
|
||||||
|
|
||||||
// 定义节点只有左右两个锚点. 锚点位置通过中心点和宽度算出来。
|
|
||||||
getDefaultAnchor() {
|
|
||||||
let _a = this,
|
|
||||||
x = _a.x,
|
|
||||||
y = _a.y,
|
|
||||||
width = _a.width,
|
|
||||||
height = _a.height;
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
x: x + width / 2 + 4,
|
|
||||||
y: y,
|
|
||||||
name: "right",
|
|
||||||
id: "".concat(this.id, "_1"),
|
|
||||||
properties: { connectionType: "source" },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: x - width / 2,
|
|
||||||
y: y,
|
|
||||||
name: "left",
|
|
||||||
id: "".concat(this.id, "_3"),
|
|
||||||
properties: { connectionType: "target" },
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取节点轮廓样式
|
|
||||||
* 覆盖父类方法,设置 stroke 属性为 none,以适应特定的视觉效果
|
|
||||||
* @returns {object} 节点轮廓样式
|
|
||||||
*/
|
|
||||||
getOutlineStyle() {
|
|
||||||
const style = super.getOutlineStyle();
|
|
||||||
style.stroke = "none";
|
|
||||||
style.hover.stroke = "none";
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 导出方法注册
|
|
||||||
export function registerSdAgentNode(lf) {
|
|
||||||
lf.register({
|
|
||||||
type: "sdAgent",
|
|
||||||
view: SdAgentNodeHtmlNode,
|
|
||||||
model: SdAgentNodeHtmlModel
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,124 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="node__container" :class="props.model.id">
|
|
||||||
<NodeState :state="nodeOperatingStatus" :runtimes="runtimes" ref="nodeStateRef">
|
|
||||||
<template #input>
|
|
||||||
<JsonViewer :value="inputJsonData" copyable boxed sort theme="light" />
|
|
||||||
</template>
|
|
||||||
<template #output>
|
|
||||||
<JsonViewer v-if="props.properties.outputType === 'json'" :value="outputJsonData" copyable boxed sort theme="light" />
|
|
||||||
<el-image
|
|
||||||
v-if="props.properties.outputType === 'img'"
|
|
||||||
v-for="item in outputJsonData.imageUrl"
|
|
||||||
style="width: 60px; height: 60px"
|
|
||||||
:src="item"
|
|
||||||
:preview-src-list="outputJsonData.imageUrl"
|
|
||||||
:preview-teleported="true"
|
|
||||||
show-progress
|
|
||||||
fit="fill"
|
|
||||||
/>
|
|
||||||
<IPlayer v-if="props.properties.outputType === 'video'" v-for="item in outputJsonData.videoUrl" :videoUrl="item" />
|
|
||||||
</template>
|
|
||||||
</NodeState>
|
|
||||||
<NodeTitle
|
|
||||||
:icon="props.properties.icon"
|
|
||||||
:nodeId="props.model.id"
|
|
||||||
:nodeProperties="props.properties"
|
|
||||||
:nodeName="props.properties.name"
|
|
||||||
:nodeType="props.properties.nodeType || 'NONE'"
|
|
||||||
:nodeDesc="props.properties.desc"
|
|
||||||
@setNodeName="setNodeName"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
|
||||||
import NodeTitle from "../../components/NodeTitle.vue";
|
|
||||||
import NodeState from "../../components/NodeState.vue";
|
|
||||||
import "vue3-json-viewer/dist/index.css";
|
|
||||||
import { emitter } from "@/utils/eventBus";
|
|
||||||
import IPlayer from "@/views/device/register/components/LogicFlow/IPlayer/index.vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
model: Object,
|
|
||||||
properties: Object,
|
|
||||||
});
|
|
||||||
|
|
||||||
const emits = defineEmits(["contentChange"]);
|
|
||||||
|
|
||||||
const setNodeName = (name) => {
|
|
||||||
const properties = lf.getProperties(props.model.id);
|
|
||||||
lf.setProperties(props.model.id, {
|
|
||||||
...properties,
|
|
||||||
name
|
|
||||||
});
|
|
||||||
emits("contentChange");
|
|
||||||
}
|
|
||||||
|
|
||||||
const nodeOperatingStatus = ref("NORMAL");
|
|
||||||
const runtimes = ref(0);
|
|
||||||
const inputJsonData = ref({});
|
|
||||||
const outputJsonData = ref({});
|
|
||||||
|
|
||||||
const nodeStateRef = ref(null);
|
|
||||||
|
|
||||||
const closePopover = () => {
|
|
||||||
if (nodeStateRef.value) {
|
|
||||||
nodeStateRef.value.closePopover();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
emitter.on("changeNodeState", (data) => {
|
|
||||||
if (data.nodeId === props.model.id) {
|
|
||||||
nodeOperatingStatus.value = data.status;
|
|
||||||
if (data.endTime && data.startTime) {
|
|
||||||
runtimes.value = data.endTime - data.startTime;
|
|
||||||
}
|
|
||||||
let inputData = {};
|
|
||||||
let output = {};
|
|
||||||
try {
|
|
||||||
inputData = JSON.parse(data.paramsIn) || {};
|
|
||||||
output = JSON.parse(data.paramsOut) || {};
|
|
||||||
} catch (error) {
|
|
||||||
inputData = data.paramsIn || {};
|
|
||||||
output = data.paramsOut || {};
|
|
||||||
}
|
|
||||||
inputJsonData.value = inputData;
|
|
||||||
outputJsonData.value = output;
|
|
||||||
emits("contentChange");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
emitter.on("contentChange", (data) => {
|
|
||||||
if (data.id === props.model.id) {
|
|
||||||
nodeOperatingStatus.value = "NORMAL";
|
|
||||||
inputJsonData.value = {};
|
|
||||||
outputJsonData.value = {};
|
|
||||||
emits("contentChange");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
emitter.on("setProperties", (data) => {
|
|
||||||
if (data.id === props.model.id) {
|
|
||||||
emits("contentChange");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
emitter.off("changeNodeState");
|
|
||||||
emitter.off("contentChange");
|
|
||||||
emitter.off("setProperties");
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
defineExpose({ closePopover })
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.node__container {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -72,9 +72,6 @@
|
|||||||
v-model="params.withOr"
|
v-model="params.withOr"
|
||||||
placeholder="Select"
|
placeholder="Select"
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
@focus="handleInputFocus"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
>
|
>
|
||||||
<el-option key="and" label="AND" value="and" />
|
<el-option key="and" label="AND" value="and" />
|
||||||
<el-option key="or" label="OR" value="or" />
|
<el-option key="or" label="OR" value="or" />
|
||||||
@ -83,16 +80,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form__container">
|
<div class="form__container">
|
||||||
<el-row v-for="(property, pIndex) in params.list">
|
<el-row v-for="(property, pIndex) in params.list">
|
||||||
|
<!-- :prop="`nodeParams.${index}.list.${pIndex}.name`" :rules="[{ required: true, message: '请输入变量名', trigger: 'blur' }]" -->
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="pIndex === 0 ? '引用变量' : ''"
|
:label="pIndex === 0 ? '引用变量' : ''"
|
||||||
:prop="`nodeParams.${index}.list.${pIndex}.nameType`"
|
:prop="`nodeParams.${index}.list.${pIndex}.nameType`"
|
||||||
>
|
>
|
||||||
|
<!-- <el-input v-model="property.name" placeholder="请输入" clearable /> -->
|
||||||
<el-select
|
<el-select
|
||||||
v-model="property.nameType"
|
v-model="property.nameType"
|
||||||
@focus="handleInputFocus"
|
|
||||||
@keydown="handleInputKeydown"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
@change="handleTypeChange(index, pIndex)"
|
@change="handleTypeChange(index, pIndex)"
|
||||||
>
|
>
|
||||||
<el-option label="引用" value="quote" />
|
<el-option label="引用" value="quote" />
|
||||||
@ -113,10 +108,6 @@
|
|||||||
v-model="property.name"
|
v-model="property.name"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
@focus="handleInputFocus"
|
|
||||||
@keydown="handleInputKeydown"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -134,12 +125,7 @@
|
|||||||
v-model="property.nameQuote"
|
v-model="property.nameQuote"
|
||||||
:options="quoteOptions"
|
:options="quoteOptions"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
:key="nameQuoteKey"
|
@visible-change="visibleChange"
|
||||||
@visible-change="(val) => visibleChange(val, 'nameQuote', index, pIndex)"
|
|
||||||
@focus="handleInputFocus"
|
|
||||||
@keydown="handleInputKeydown"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -150,13 +136,7 @@
|
|||||||
{ required: true, message: '请输入变量名', trigger: 'blur' },
|
{ required: true, message: '请输入变量名', trigger: 'blur' },
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<el-select
|
<el-select v-model="property.condition">
|
||||||
v-model="property.condition"
|
|
||||||
@focus="handleInputFocus"
|
|
||||||
@keydown="handleInputKeydown"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
>
|
|
||||||
<el-option label="等于" value="equal" />
|
<el-option label="等于" value="equal" />
|
||||||
<el-option label="不等于" value="notEqualTo" />
|
<el-option label="不等于" value="notEqualTo" />
|
||||||
<el-option label="为空" value="null" />
|
<el-option label="为空" value="null" />
|
||||||
@ -176,10 +156,6 @@
|
|||||||
<el-select
|
<el-select
|
||||||
v-model="property.type"
|
v-model="property.type"
|
||||||
@change="handleTypeChange(index, pIndex)"
|
@change="handleTypeChange(index, pIndex)"
|
||||||
@focus="handleInputFocus"
|
|
||||||
@keydown="handleInputKeydown"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
>
|
>
|
||||||
<el-option label="引用" value="quote" />
|
<el-option label="引用" value="quote" />
|
||||||
<el-option label="输入" value="input" />
|
<el-option label="输入" value="input" />
|
||||||
@ -199,10 +175,6 @@
|
|||||||
v-model="property.input"
|
v-model="property.input"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
clearable
|
clearable
|
||||||
@focus="handleInputFocus"
|
|
||||||
@keydown="handleInputKeydown"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -220,11 +192,7 @@
|
|||||||
v-model="property.quote"
|
v-model="property.quote"
|
||||||
:options="quoteOptions"
|
:options="quoteOptions"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
@visible-change="(val) => visibleChange(val, 'quote', index, pIndex)"
|
@visible-change="visibleChange"
|
||||||
@focus="handleInputFocus"
|
|
||||||
@keydown="handleInputKeydown"
|
|
||||||
@click.stop
|
|
||||||
@mousedown.stop
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -407,17 +375,11 @@ const setNodeName = (name) => {
|
|||||||
emits("contentChange");
|
emits("contentChange");
|
||||||
}
|
}
|
||||||
|
|
||||||
const visibleChange = async (value, type, index, pIndex) => {
|
const visibleChange = (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
const option = getInput(props.model.id);
|
const option = getInput(props.model.id);
|
||||||
if (option) {
|
if (option) {
|
||||||
quoteOptions.value = option;
|
quoteOptions.value = option;
|
||||||
const currentValue = formData.nodeParams[index].list[pIndex][type]
|
|
||||||
if (currentValue) {
|
|
||||||
formData.nodeParams[index].list[pIndex][type] = null
|
|
||||||
await nextTick();
|
|
||||||
formData.nodeParams[index].list[pIndex][type] = currentValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -453,23 +415,6 @@ const closePopover = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isEditing = ref(false)
|
|
||||||
const handleInputFocus = (e) => {
|
|
||||||
// 阻止事件冒泡到 LogicFlow
|
|
||||||
e.stopPropagation()
|
|
||||||
e.preventDefault()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const handleInputKeydown = (e) => {
|
|
||||||
// 阻止事件冒泡到 Logic Flow 节点,避免被其事件拦截
|
|
||||||
e.stopPropagation();
|
|
||||||
// 可选:明确放行 Ctrl+V(增强兼容性)
|
|
||||||
if ((e.ctrlKey || e.metaKey) && e.key === "v") {
|
|
||||||
e.returnValue = true; // 允许默认粘贴行为
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
emits("addAnchor", 280, "".concat(props.model.id, "_else"));
|
emits("addAnchor", 280, "".concat(props.model.id, "_else"));
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user