@@ -342,7 +342,7 @@ watch(
() => {
if (props.data.type === "start") {
formData.inputParams = props.data.properties?.inputParams || [];
- } else if (props.data.type === "serviceNode") {
+ } else if (['currentLoop', 'serviceNode'].includes(props.data.type)) {
formData.nodeParams = props.data.properties.nodeParams;
formData.outputParams = props.data.properties.outputParams;
console.log('formData', formData)
diff --git a/src/views/flow/config.js b/src/views/flow/config.js
index 3c5ccc8..e52acdd 100644
--- a/src/views/flow/config.js
+++ b/src/views/flow/config.js
@@ -306,7 +306,7 @@ export const collapseList = [
{ name: "input", type: "input", input: "", required: true }
],
outputType: 'json',
- outputParams: [{ name: 'result', type: 'Object', children: [], desc: 'js节点返回'}]
+ outputParams: [{ name: 'result', type: 'object', children: [], desc: 'js节点返回'}]
},
{
icon: microphoneSvg,
@@ -316,12 +316,14 @@ export const collapseList = [
action: 'GET_CURRENT_OBJECT',
nodeType: 'getCurrentObject',
nodeParams: [
- { name: "array", type: "input", input: "", disabled: true }
+ { name: "array", type: "input", input: "" }
],
outputType: 'json',
outputParams: [
- { name: 'index', type: 'number', desc: '索引', disabled: true},
- { name: 'object', type: 'Object', children: [], desc: '当前循环对象', }
+ { name: 'index', type: 'number', desc: '索引'},
+ { name: 'object', type: 'object', children: [
+ { name: 'test', type: 'string', desc: '占位属性' }
+ ], desc: '当前循环对象', }
]
},
],
diff --git a/src/views/flow/index.vue b/src/views/flow/index.vue
index 187dbaa..1688fd2 100644
--- a/src/views/flow/index.vue
+++ b/src/views/flow/index.vue
@@ -282,15 +282,15 @@ const testRun = async () => {
}
let allValid = true;
- for (const node of nodes) {
- const nodeModel = lf.getNodeModelById(node.id);
- if (nodeModel && nodeModel.validateForm) {
- const result = await nodeModel.validateForm();
- if (!result.valid) {
- allValid = false;
- }
- }
- }
+ // for (const node of nodes) {
+ // const nodeModel = lf.getNodeModelById(node.id);
+ // if (nodeModel && nodeModel.validateForm) {
+ // const result = await nodeModel.validateForm();
+ // if (!result.valid) {
+ // allValid = false;
+ // }
+ // }
+ // }
if (allValid) {
isOpen.value = true;
@@ -645,7 +645,9 @@ const initFlow = () => {
lf.on("node:mouseleave", ({ data }) => {
const node = lf.getNodeModelById(data.id);
- node.setCustomProperties && node.setCustomProperties();
+ if (node.setCustomProperties) {
+ node.setCustomProperties();
+ }
});
lf.on("node:dbclick", ({ data, e }) => {
diff --git a/src/views/flow/nodes/common/serviceNode.js b/src/views/flow/nodes/common/serviceNode.js
index faa5eca..b351ef7 100644
--- a/src/views/flow/nodes/common/serviceNode.js
+++ b/src/views/flow/nodes/common/serviceNode.js
@@ -150,9 +150,9 @@ class ServiceNodeHtmlModel extends HtmlNodeModel {
return result
}
- setCustomProperties() {
- this.componentInstance.setNodeProperties()
- }
+ // setCustomProperties() {
+ // this.componentInstance.setNodeProperties()
+ // }
/**
* 设置节点属性
diff --git a/src/views/flow/nodes/function/currentLoop.vue b/src/views/flow/nodes/function/currentLoop.vue
index 1470b2f..43acc2f 100644
--- a/src/views/flow/nodes/function/currentLoop.vue
+++ b/src/views/flow/nodes/function/currentLoop.vue
@@ -26,119 +26,8 @@
:nodeName="props.properties.name"
:nodeDesc="props.properties.desc"
:zoom-state="nodeZoom"
- @zoom="zoom"
@setNodeName="setNodeName"
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -146,7 +35,6 @@
import { ref, reactive, onMounted, onUnmounted, nextTick } from "vue";
import { getInput, initNodeZoom } from "@/utils/flow";
import { useFlowStore } from "@/store/modules/flow";
-import { Plus } from "@element-plus/icons-vue";
import NodeTitle from "../../components/NodeTitle.vue";
import NodeState from "../../components/NodeState.vue";
import "vue3-json-viewer/dist/index.css";
@@ -160,46 +48,11 @@ const props = defineProps({
const emits = defineEmits(["contentChange"]);
-const flowStore = useFlowStore();
const formData = reactive({
nodeParams: [],
});
-const rules = reactive({});
-
-const quoteOptions = ref([]);
-const handleTypeChange = (index) => {
- if (formData.nodeParams[index].type === "input") {
- formData.nodeParams[index].quote = "";
- } else {
- formData.nodeParams[index].input = "";
- const option = getInput(props.model.id);
- if (option) {
- quoteOptions.value = option;
- }
- }
-};
-
-const dynamicForm = ref();
-
-const setNodeProperties = async () => {
- try {
- const result = await dynamicForm.value.validate();
- if (result) {
- const data = toRaw(formData);
- const properties = lf.getProperties(props.model.id);
- lf.setProperties(props.model.id, {
- ...properties,
- ...data,
- zoom: nodeZoom.value
- });
- emits("contentChange");
- }
- } catch {
- dynamicForm.value.clearValidate();
- }
-};
const setNodeName = (name) => {
const properties = lf.getProperties(props.model.id);
@@ -214,72 +67,6 @@ const nodeOperatingStatus = ref("NORMAL");
const inputJsonData = ref({});
const outputJsonData = ref({});
-const visibleChange = (value) => {
- if (value) {
- const option = getInput(props.model.id);
- if (option) {
- quoteOptions.value = option;
- }
- }
-};
-
-const cascaderRefs = ref([]);
-const cascaderChange = (value, index) => {
- const selectedOptions = cascaderRefs.value[index].getCheckedNodes(true);
- formData.nodeParams[index].quote = value;
- formData.nodeParams[index].quoteType = selectedOptions[0].data.type;
-};
-
-const validateForm = async () => {
- try {
- const result = await dynamicForm.value.validate();
- if (result) {
- return { valid: true, message: "验证通过" };
- } else {
- return { valid: false, message: "验证失败" };
- }
- } catch {
- return { valid: false, message: "验证失败" };
- }
-};
-
-const addFormItem = () => {
- formData.nodeParams.push({
- name: "",
- type: "",
- desc: "",
- required: false,
- children: [],
- });
- emits("contentChange");
-};
-
-const nodeZoom = ref(props?.properties?.zoom ?? true)
-const zoom = (flag) => {
- nodeZoom.value = flag
- initNodeZoom(props.model.id, nodeZoom.value, '.node__box')
-}
-
-watch(
- () => props.properties,
- () => {
- if (props.properties.nodeParams && props.properties.nodeParams.length > 0) {
- formData.nodeParams = props.properties.nodeParams;
- const option = getInput(props.model.id);
- if (option) {
- quoteOptions.value = option;
- }
- nextTick(() => {
- initNodeZoom(props.model.id, props?.properties?.zoom ?? true, '.node__box', true)
- })
- }
- },
- {
- immediate: true,
- deep: true,
- }
-);
-
onMounted(() => {
emitter.on("changeNodeState", (data) => {
if (data.nodeId === props.model.id) {
@@ -314,10 +101,6 @@ onUnmounted(() => {
emitter.off("contentChange");
});
-defineExpose({
- validateForm,
- setNodeProperties,
-});
+
+
\ No newline at end of file
diff --git a/src/views/flow/config.js b/src/views/flow/config.js
index e52acdd..80d1593 100644
--- a/src/views/flow/config.js
+++ b/src/views/flow/config.js
@@ -306,7 +306,10 @@ export const collapseList = [
{ name: "input", type: "input", input: "", required: true }
],
outputType: 'json',
- outputParams: [{ name: 'result', type: 'object', children: [], desc: 'js节点返回'}]
+ outputParams: [{ name: 'result', type: 'object', children: [
+ {name: 'type', type: 'number', desc: '占位属性'},
+ {name: 'message', type: 'string', desc: '占位属性'}
+ ], desc: 'js节点返回'}]
},
{
icon: microphoneSvg,
diff --git a/src/views/flow/nodes/function/codeNode.js b/src/views/flow/nodes/function/codeNode.js
index 703ce9f..fd83fd1 100644
--- a/src/views/flow/nodes/function/codeNode.js
+++ b/src/views/flow/nodes/function/codeNode.js
@@ -144,16 +144,6 @@ class CodeNodeHtmlModel extends HtmlNodeModel {
this.componentInstance = instance;
}
- // 验证表单
- async validateForm() {
- const result = this.componentInstance.validateForm()
- return result
- }
-
- setCustomProperties() {
- this.componentInstance.setNodeProperties()
- }
-
/**
* 设置节点属性
* 包括宽度、高度、文本编辑属性等
diff --git a/src/views/flow/nodes/function/codeNode.vue b/src/views/flow/nodes/function/codeNode.vue
index 01a154a..e1eef4c 100644
--- a/src/views/flow/nodes/function/codeNode.vue
+++ b/src/views/flow/nodes/function/codeNode.vue
@@ -40,196 +40,17 @@
:nodeType="props.properties.nodeType || 'NONE'"
:nodeName="props.properties.name"
:nodeDesc="props.properties.desc"
- :zoom-state="nodeZoom"
- @zoom="zoom"
@setNodeName="setNodeName"
/>
-
-
From 75f64e8d9fc47726c781ef033c3f6e45a6b5b297 Mon Sep 17 00:00:00 2001
From: zhanghao <774378400@qq.com>
Date: Tue, 14 Apr 2026 11:35:42 +0800
Subject: [PATCH 04/14] =?UTF-8?q?feat:=20http=E3=80=81loop=E3=80=81sleep?=
=?UTF-8?q?=E8=8A=82=E7=82=B9=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/flow/components/ParamsDrawer.vue | 626 +++++++++++++++++++--
src/views/flow/config.js | 22 +-
src/views/flow/nodes/function/httpNode.js | 14 +-
src/views/flow/nodes/function/httpNode.vue | 505 +----------------
src/views/flow/nodes/function/loop.js | 38 +-
src/views/flow/nodes/function/loop.vue | 238 +-------
src/views/flow/nodes/function/sleep.vue | 356 +-----------
7 files changed, 665 insertions(+), 1134 deletions(-)
diff --git a/src/views/flow/components/ParamsDrawer.vue b/src/views/flow/components/ParamsDrawer.vue
index f482552..9fa8067 100644
--- a/src/views/flow/components/ParamsDrawer.vue
+++ b/src/views/flow/components/ParamsDrawer.vue
@@ -43,7 +43,7 @@