feat(workflow): 节点配置支持 keyValue 与 schemaJson 字段类型

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-31 11:40:28 +08:00
co-authored by Claude
parent 7de6f00cff
commit a8106f6c4c
2 changed files with 127 additions and 0 deletions
@@ -76,6 +76,16 @@
>
<el-option v-for="opt in field.options" :key="opt.value" :label="opt.label" :value="opt.value" />
</el-select>
<KeyValueEditor
v-else-if="field.type === 'keyValue'"
:model-value="getFieldValue(field.field)"
@update:model-value="(v: any) => updateFieldValue(field.field, v)"
/>
<el-button
v-else-if="field.type === 'schemaJson'"
@click="openSchemaEditor(field.field)"
style="width: 100%"
>配置</el-button>
<el-input
v-else
:model-value="getFieldValue(field.field)"
@@ -98,12 +108,26 @@
/>
</div>
<el-empty v-else description="请选择一个节点" :image-size="100" />
<!-- Schema 编辑器弹窗 -->
<el-dialog v-model="schemaEditorVisible" title="编辑 Schema" width="640px" append-to-body destroy-on-close>
<div style="height: 400px; overflow-y: auto">
<JsonEditor v-model="schemaEditorData" />
</div>
<template #footer>
<el-button @click="schemaEditorVisible = false">取消</el-button>
<el-button type="primary" @click="confirmSchemaEditor">确 定</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import type { Node } from '@vue-flow/core';
import InputSourceManager from './InputSourceManager.vue';
import KeyValueEditor from './KeyValueEditor.vue';
import { JsonEditor } from '/@/components/json-schema-editor';
interface NodeData {
label?: string;
@@ -148,6 +172,23 @@ const emit = defineEmits<{
(e: 'update:patchLayout', value: boolean): void;
}>();
// Schema 编辑器弹窗
const schemaEditorVisible = ref(false);
const schemaEditorField = ref('');
const schemaEditorData = ref<any>({});
function openSchemaEditor(fieldName: string) {
schemaEditorField.value = fieldName;
const val = getFieldValue(fieldName);
schemaEditorData.value = val && typeof val === 'object' ? { ...val } : {};
schemaEditorVisible.value = true;
}
function confirmSchemaEditor() {
updateFieldValue(schemaEditorField.value, schemaEditorData.value);
schemaEditorVisible.value = false;
}
const updateNodeLabel = (newLabel: string) => {
if (!props.selectedNode?.data) return;
const updatedNode = {