diff --git a/src/views/createapp/components/workFlow.vue b/src/views/createapp/components/workFlow.vue
index 261fc59a83b497490b17227b1b2eeadc7a63c4e2..304fbb3e48cec574df34db13647ce2cf30d0b065 100644
--- a/src/views/createapp/components/workFlow.vue
+++ b/src/views/createapp/components/workFlow.vue
@@ -34,7 +34,8 @@ const isAddWorkFlow = ref(false);
const editData = ref();
const dialogType = ref('');
const isEditYaml = ref(false);
-const nodeName = ref();
+const nodeName = ref('');
+const nodeDesc = ref('');
const flowZoom = ref(1);
const debugDialogVisible = ref(false);
const isNodeAndLineConnect = ref(false);
@@ -180,9 +181,10 @@ const delNode = id => {
}
};
// 编辑yaml
-const editYamlDrawer = (name, yamlCode, nodeId) => {
+const editYamlDrawer = (name, desc, yamlCode, nodeId) => {
yamlContent.value = yamlCode;
nodeName.value = name;
+ nodeDesc.value = desc;
isEditYaml.value = true;
nodeYamlId.value = nodeId;
};
@@ -482,9 +484,15 @@ $bus.on('getNodesStatue', lines => {
totalTime.value += newLines.data?.metadata?.timeCost;
constTime = `${newLines.data?.metadata?.timeCost?.toFixed(3)}s`
// 此处获取output的数据,并将此数据传给节点显示
- updateNodeFunc(newLines.data.flow.stepId, newLines.data.flow?.stepStatus, constTime, newLines.data?.content);
+ updateNodeFunc(newLines.data.flow.stepId, newLines.data.flow?.stepStatus, constTime, {
+ params: newLines.data?.content,
+ type: 'output'
+ });
} else {
- updateNodeFunc(newLines.data.flow.stepId, newLines.data.flow?.stepStatus, constTime);
+ updateNodeFunc(newLines.data.flow.stepId, newLines.data.flow?.stepStatus, constTime, {
+ params: newLines.data?.content,
+ type: 'input'
+ });
}
} else if (newLines?.data?.event === 'flow.stop') {
emits('updateFlowsDebug')
@@ -580,6 +588,8 @@ const saveFlow = (updateNodeParameter?) => {
} else {
item.parameters.input_parameters = updateNodeParameter.inputStream;
}
+ item.name = updateNodeParameter.name;
+ item.description = updateNodeParameter.description;
}
});
}
@@ -607,15 +617,19 @@ const saveFlow = (updateNodeParameter?) => {
if (res[1]?.result) {
ElMessage.success('工作流更新成功');
queryFlow('update');
+ const updatedCurFlow = res[1].result.flow;
+ redrageFlow(updatedCurFlow?.nodes, updatedCurFlow?.edges);
}
});
};
-const saveNode = (yamlCode, nodeId) => {
+const saveNode = (yamlCode, nodeId, name, description) => {
// 调用更新接口更新当前节点数据
const updateNodeParameter = {
id: nodeId,
inputStream: yamlCode,
+ name,
+ description,
};
saveFlow(updateNodeParameter);
};
@@ -809,6 +823,7 @@ defineExpose({
:flowId="flowObj?.flowId"
:yamlContent="yamlContent"
:nodeName="nodeName"
+ :nodeDesc="nodeDesc"
:nodeYamlId="nodeYamlId"
>
diff --git a/src/views/createapp/components/workFlowConfig/BranchNode.vue b/src/views/createapp/components/workFlowConfig/BranchNode.vue
index 31aaf2f24e509d7b186303967adb60a5fffe701e..77391dafdfb2ba83599596d03ea2c1d521979ac1 100644
--- a/src/views/createapp/components/workFlowConfig/BranchNode.vue
+++ b/src/views/createapp/components/workFlowConfig/BranchNode.vue
@@ -63,11 +63,13 @@ watch(
}
// 默认的输入赋值
inputAndOutput.value.input_parameters = props.data?.parameters?.input_parameters || {};
- // 判断是否有调试的输出,有调试的输出,需要将其显示/否则显示默认的输出
- if (props.data?.content) {
- // 将paramaters里的output换为接口返回的output_parameters
- inputAndOutput.value.output_parameters = props.data.content;
+ // 判断是否有调试的输入输出,有调试的输入输出,需要将其显示/否则显示默认的输出
+ if (props.data.content?.type === 'input') {
+ inputAndOutput.value.output_parameters = props.data.content.params;
+ } else if (props.data.content?.type === 'output') {
+ inputAndOutput.value.output_parameters = props.data.content.params;
} else {
+ inputAndOutput.value.input_parameters = props.data?.parameters?.input_parameters || {};
inputAndOutput.value.output_parameters = props.data?.parameters?.output_parameters || {};
}
},
@@ -79,8 +81,8 @@ const delNode = id => {
};
// 编辑yaml
-const editYaml = (nodeName, yamlCode) => {
- emits('editYamlDrawer', nodeName, yamlCode, props.id);
+const editYaml = (nodeName, nodeDesc, yamlCode) => {
+ emits('editYamlDrawer', nodeName, nodeDesc, yamlCode, props.id);
};
@@ -97,7 +99,7 @@ const editYaml = (nodeName, yamlCode) => {
···
- 编辑
+ 编辑
删除
diff --git a/src/views/createapp/components/workFlowConfig/CustomNode.vue b/src/views/createapp/components/workFlowConfig/CustomNode.vue
index 27ddcbfc4361b637dff856e4fc97f0c32816f38d..6ada6832cf683a8330a4a4ee6e51f97132f1ddc1 100644
--- a/src/views/createapp/components/workFlowConfig/CustomNode.vue
+++ b/src/views/createapp/components/workFlowConfig/CustomNode.vue
@@ -22,7 +22,7 @@ const props = defineProps({
disabled: {
type: Boolean,
required: false,
- }
+ },
});
const emits = defineEmits(['delNode', 'editYamlDrawer']);
@@ -52,13 +52,13 @@ watch(
}
// 节点调试消耗时间【目前只有调试接口返回的节点step.output才有值,其余状态为''不显示】
costTime.value = props.data?.constTime || '';
- // 默认的输入赋值
- inputAndOutput.value.input_parameters = props.data?.parameters?.input_parameters || {};
- // 判断是否有调试的输出,有调试的输出,需要将其显示/否则显示默认的输出
- if (props.data?.content) {
- // 将paramaters里的output换为接口返回的output_parameters
- inputAndOutput.value.output_parameters = props.data.content;
+ // 判断是否有调试的输入输出,有调试的输入输出,需要将其显示/否则显示默认的输出
+ if (props.data.content?.type === 'input') {
+ inputAndOutput.value.output_parameters = props.data.content.params;
+ } else if (props.data.content?.type === 'output') {
+ inputAndOutput.value.output_parameters = props.data.content.params;
} else {
+ inputAndOutput.value.input_parameters = props.data?.parameters?.input_parameters || {};
inputAndOutput.value.output_parameters = props.data?.parameters?.output_parameters || {};
}
},
@@ -71,8 +71,8 @@ const delNode = id => {
};
// 编辑yaml
-const editYaml = (nodeName, yamlCode) => {
- emits('editYamlDrawer', nodeName, yamlCode, props.id);
+const editYaml = (nodeName, nodeDesc, yamlCode) => {
+ emits('editYamlDrawer', nodeName, nodeDesc, yamlCode, props.id);
};
@@ -85,10 +85,15 @@ const editYaml = (nodeName, yamlCode) => {
{{ props.data.name }}
-
+
···
- 编辑
+ 编辑
删除
diff --git a/src/views/createapp/components/workFlowConfig/yamlEditDrawer.vue b/src/views/createapp/components/workFlowConfig/yamlEditDrawer.vue
index 2875f6c5b0d577b215233d5f9e49e791a9a5332d..4f8fa43b54cfe440357104f03fdf18b036ba2d90 100644
--- a/src/views/createapp/components/workFlowConfig/yamlEditDrawer.vue
+++ b/src/views/createapp/components/workFlowConfig/yamlEditDrawer.vue
@@ -14,21 +14,56 @@
-
+
{{ item.title }}
-
+
+
+
+
+
+
+
+
+
+
@@ -36,7 +71,7 @@
@@ -52,36 +87,63 @@ const visible = ref(true);
const yamlInputCode = ref();
const yamlOutputCode = ref();
const yamlNodeName = ref();
+const infoDisabled = ref(true);
const yamlExpress = ref([
+ {
+ title: '基本信息',
+ type: '',
+ name: '',
+ description: '',
+ },
{
title: '输入内容',
+ type: 'yamlEdit',
yamlCode: '',
disabled: false,
},
{
title: '输出内容',
+ type: 'yamlEdit',
yamlCode: '',
disabled: true,
},
]);
+const yamlBaseInfoRule = ref({
+ name: [{ required: true, message: '请输入工作流名称', trigger: 'blur' }],
+ description: [{ required: true, message: '请输入工作流描述', trigger: 'blur' }],
+});
const activeName = ref([yamlExpress.value[0].title, yamlExpress.value[1].title]);
const emits = defineEmits(['closeDrawer', 'saveNode']);
const props = defineProps<{
yamlContent: any;
nodeName: string;
+ nodeDesc: string;
appId: any;
flowId: any;
nodeYamlId: any;
}>();
watch(
- () => [props.yamlContent, props.nodeName],
+ () => [props.yamlContent, props.nodeName, props.nodeDesc],
() => {
yamlInputCode.value = yaml.dump(props.yamlContent.input_parameters);
yamlOutputCode.value = yaml.dump(props.yamlContent.output_parameters);
yamlNodeName.value = props.nodeName;
- yamlExpress.value[0].yamlCode = yaml.dump(props.yamlContent.input_parameters);
- yamlExpress.value[1].yamlCode = yaml.dump(props.yamlContent.output_parameters);
+ yamlExpress.value[0].name = props.nodeName;
+ yamlExpress.value[0].description = props.nodeDesc;
+ yamlExpress.value[1].yamlCode = yaml.dump(props.yamlContent.input_parameters);
+ yamlExpress.value[2].yamlCode = yaml.dump(props.yamlContent.output_parameters);
+ },
+ { deep: true, immediate: true },
+);
+watch(
+ () => [yamlExpress.value[0].name, yamlExpress.value[0].description],
+ () => {
+ if (yamlExpress.value[0].name && yamlExpress.value[0].description) {
+ infoDisabled.value = false;
+ } else {
+ infoDisabled.value = true;
+ }
},
{ deep: true, immediate: true },
);
@@ -92,9 +154,9 @@ const closeDrawer = () => {
const updateNodeYaml = () => {
let transResult;
try {
- transResult = yaml.load(yamlExpress.value[0].yamlCode);
- // 调用接口并更新
- emits('saveNode', transResult, props.nodeYamlId);
+ transResult = yaml.load(yamlExpress.value[1].yamlCode);
+ // 调用接口并更新--根据id包含更新后的yamlCode, name, desc
+ emits('saveNode', transResult, props.nodeYamlId, yamlExpress.value[0].name, yamlExpress.value[0].description);
closeDrawer();
} catch (error) {
ElMessage.error('请检查格式是否正确');
@@ -144,7 +206,7 @@ const updateNodeYaml = () => {
.cm-lineNumbers {
.cm-gutterElement {
min-width: 31px;
- padding-left: 0 0 0 9px;
+ padding-left: 0 0 0 9px;
text-align: center;
}
}
@@ -152,6 +214,22 @@ const updateNodeYaml = () => {
padding-left: 0;
}
}
+ .baseInfo {
+ .el-form-item {
+ display: flex;
+ gap: 24px;
+ .el-form-item__label {
+ margin-left: -8px;
+ padding-right: 0px;
+ }
+ .el-form-item__content {
+ flex: 1;
+ .el-textarea__inner {
+ height: 56px;
+ }
+ }
+ }
+ }
}
}
textarea {