fix: variable aggregation node style

v3.2
wangdan-fit2cloud 2025-10-29 11:29:14 +08:00
parent 52316895d4
commit a1898e837a
19 changed files with 131 additions and 143 deletions

View File

@ -72,13 +72,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => { const assignment_method_option_list = computed(() => {
const option_list = [ const option_list = [
{ {
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'), label: t('common.custom'),
value: 'custom', value: 'custom',
}, },
] ]
if (getModel) { if (getModel) {
option_list.push({ option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'), label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables', value: 'ref_variables',
}) })
} }
@ -137,7 +137,7 @@ const default_ref_variables_value_rule = {
validator: (rule: any, value: any, callback: any) => { validator: (rule: any, value: any, callback: any) => {
if (!(Array.isArray(value) && value.length > 1)) { if (!(Array.isArray(value) && value.length > 1)) {
callback( callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'), t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
) )
} }

View File

@ -144,13 +144,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => { const assignment_method_option_list = computed(() => {
const option_list = [ const option_list = [
{ {
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'), label: t('common.custom'),
value: 'custom', value: 'custom',
}, },
] ]
if (getModel) { if (getModel) {
option_list.push({ option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'), label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables', value: 'ref_variables',
}) })
} }
@ -183,7 +183,7 @@ const default_ref_variables_value_rule = {
console.log(value.length) console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) { if (!(Array.isArray(value) && value.length > 1)) {
callback( callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'), t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
) )
} }

View File

@ -153,13 +153,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => { const assignment_method_option_list = computed(() => {
const option_list = [ const option_list = [
{ {
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'), label: t('common.custom'),
value: 'custom', value: 'custom',
}, },
] ]
if (getModel) { if (getModel) {
option_list.push({ option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'), label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables', value: 'ref_variables',
}) })
} }
@ -192,7 +192,7 @@ const default_ref_variables_value_rule = {
console.log(value.length) console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) { if (!(Array.isArray(value) && value.length > 1)) {
callback( callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'), t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
) )
} }

View File

@ -144,13 +144,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => { const assignment_method_option_list = computed(() => {
const option_list = [ const option_list = [
{ {
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'), label: t('common.custom'),
value: 'custom', value: 'custom',
}, },
] ]
if (getModel) { if (getModel) {
option_list.push({ option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'), label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables', value: 'ref_variables',
}) })
} }
@ -182,7 +182,7 @@ const default_ref_variables_value_rule = {
console.log(value.length) console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) { if (!(Array.isArray(value) && value.length > 1)) {
callback( callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'), t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
) )
} }

View File

@ -144,13 +144,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => { const assignment_method_option_list = computed(() => {
const option_list = [ const option_list = [
{ {
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'), label: t('common.custom'),
value: 'custom', value: 'custom',
}, },
] ]
if (getModel) { if (getModel) {
option_list.push({ option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'), label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables', value: 'ref_variables',
}) })
} }
@ -183,7 +183,7 @@ const default_ref_variables_value_rule = {
console.log(value.length) console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) { if (!(Array.isArray(value) && value.length > 1)) {
callback( callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'), t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
) )
} }

View File

@ -143,13 +143,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => { const assignment_method_option_list = computed(() => {
const option_list = [ const option_list = [
{ {
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'), label: t('common.custom'),
value: 'custom', value: 'custom',
}, },
] ]
if (getModel) { if (getModel) {
option_list.push({ option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'), label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables', value: 'ref_variables',
}) })
} }
@ -182,7 +182,7 @@ const default_ref_variables_value_rule = {
console.log(value.length) console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) { if (!(Array.isArray(value) && value.length > 1)) {
callback( callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'), t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
) )
} }

View File

@ -50,13 +50,14 @@ export default {
beautify: 'Auto-Arrange', beautify: 'Auto-Arrange',
}, },
variable: { variable: {
label: 'Variable',
global: 'Global Variable', global: 'Global Variable',
Referencing: 'Referenced Variable', Referencing: 'Referenced Variable',
ReferencingRequired: 'Referenced variable is required', ReferencingRequired: 'Referenced variable is required',
ReferencingError: 'Invalid referenced variable', ReferencingError: 'Invalid referenced variable',
NoReferencing: 'Referenced variable does not exist', NoReferencing: 'Referenced variable does not exist',
placeholder: 'Please select a variable', placeholder: 'Please select a variable',
inputPlaceholder: 'Please enter variable',
loop: 'Loop Variable',
}, },
condition: { condition: {
title: 'Execution Condition', title: 'Execution Condition',
@ -199,11 +200,7 @@ You are a master of problem optimization, adept at accurately inferring user int
replyNode: { replyNode: {
label: 'Specified Reply', label: 'Specified Reply',
text: 'Specify reply content, referenced variables will be converted to strings for output', text: 'Specify reply content, referenced variables will be converted to strings for output',
content: 'Content', replyContent: 'Reply Content',
replyContent: {
label: 'Reply Content',
reference: 'Reference Variable',
},
}, },
rerankerNode: { rerankerNode: {
label: 'Multi-path Recall', label: 'Multi-path Recall',
@ -267,11 +264,11 @@ You are a master of problem optimization, adept at accurately inferring user int
placeholder: 'Return the first non-null value of each group', placeholder: 'Return the first non-null value of each group',
placeholder1: 'Return the set of variables for each group', placeholder1: 'Return the set of variables for each group',
group: { group: {
placeholder: 'Please select a variable',
noneError: 'Name cannot be empty', noneError: 'Name cannot be empty',
dupError: 'Name cannot be duplicated', dupError: 'Name cannot be duplicated',
}, },
add: 'Add Group', addGroup: 'Add Group',
editGroup: 'Edit Group',
}, },
mcpNode: { mcpNode: {
label: 'MCP Node', label: 'MCP Node',
@ -421,7 +418,6 @@ You are a master of problem optimization, adept at accurately inferring user int
label: 'Loop Start', label: 'Loop Start',
loopIndex: 'Index', loopIndex: 'Index',
loopItem: 'Loop Element', loopItem: 'Loop Element',
loopVariable: 'Loop Variable',
}, },
loopBodyNode: { loopBodyNode: {
label: 'Loop Body', label: 'Loop Body',
@ -445,7 +441,6 @@ You are a master of problem optimization, adept at accurately inferring user int
inputVariables: 'Input Variable', inputVariables: 'Input Variable',
addVariables: 'Add Variables', addVariables: 'Add Variables',
editVariables: 'Edit Variables', editVariables: 'Edit Variables',
variablePlaceholder: 'Please enter variable',
variableListPlaceholder: 'Please add split variables', variableListPlaceholder: 'Please add split variables',
expression: { expression: {
label: 'Expression', label: 'Expression',

View File

@ -123,7 +123,6 @@ export default {
label: '自定义', label: '自定义',
}, },
ref_variables: { ref_variables: {
label: '引用变量 ',
popover: '变量的值必须符合', popover: '变量的值必须符合',
json_format: 'JSON 格式', json_format: 'JSON 格式',
popover_label: '标签', popover_label: '标签',

View File

@ -57,6 +57,7 @@ export default {
ReferencingError: '引用变量错误', ReferencingError: '引用变量错误',
NoReferencing: '不存在的引用变量', NoReferencing: '不存在的引用变量',
placeholder: '请选择变量', placeholder: '请选择变量',
inputPlaceholder: '请输入变量',
loop: '循环变量', loop: '循环变量',
}, },
condition: { condition: {
@ -206,11 +207,7 @@ export default {
replyNode: { replyNode: {
label: '指定回复', label: '指定回复',
text: '指定回复内容,引用变量会转换为字符串进行输出', text: '指定回复内容,引用变量会转换为字符串进行输出',
content: '内容', replyContent: '回复内容',
replyContent: {
label: '回复内容',
reference: '引用变量',
},
}, },
rerankerNode: { rerankerNode: {
label: '多路召回', label: '多路召回',
@ -268,11 +265,11 @@ export default {
placeholder: '返回每组的第一个非空值', placeholder: '返回每组的第一个非空值',
placeholder1: '返回每组变量的集合', placeholder1: '返回每组变量的集合',
group: { group: {
placeholder: '请选择变量',
noneError: '名称不能为空', noneError: '名称不能为空',
dupError: '名称不能重复', dupError: '名称不能重复',
}, },
add: '添加分组', addGroup: '添加分组',
editGroup: '编辑分组',
}, },
variableAssignNode: { variableAssignNode: {
label: '变量赋值', label: '变量赋值',
@ -433,7 +430,6 @@ export default {
label: '循环开始', label: '循环开始',
loopIndex: '下标', loopIndex: '下标',
loopItem: '循环元素', loopItem: '循环元素',
loopVariable: '循环变量',
}, },
loopBodyNode: { loopBodyNode: {
label: '循环体', label: '循环体',
@ -456,7 +452,6 @@ export default {
inputVariables: '输入变量', inputVariables: '输入变量',
addVariables: '添加变量', addVariables: '添加变量',
editVariables: '编辑变量', editVariables: '编辑变量',
variablePlaceholder: '请输入变量',
variableListPlaceholder: '请添加拆分变量', variableListPlaceholder: '请添加拆分变量',
expression: { expression: {
label: '表达式', label: '表达式',

View File

@ -50,13 +50,14 @@ export default {
beautify: '一鍵美化', beautify: '一鍵美化',
}, },
variable: { variable: {
label: '變量',
global: '全局變量', global: '全局變量',
Referencing: '引用變量', Referencing: '引用變量',
ReferencingRequired: '引用變量必填', ReferencingRequired: '引用變量必填',
ReferencingError: '引用變量錯誤', ReferencingError: '引用變量錯誤',
NoReferencing: '不存在的引用變量', NoReferencing: '不存在的引用變量',
placeholder: '請選擇變量', placeholder: '請選擇變量',
inputPlaceholder: '請輸入變量',
loop: '循環變量',
}, },
condition: { condition: {
title: '執行條件', title: '執行條件',
@ -200,11 +201,7 @@ export default {
replyNode: { replyNode: {
label: '指定回覆', label: '指定回覆',
text: '指定回覆內容,引用變量會轉換為字符串進行輸出', text: '指定回覆內容,引用變量會轉換為字符串進行輸出',
content: '內容', replyContent: '回覆內容',
replyContent: {
label: '回覆內容',
reference: '引用變量',
},
}, },
rerankerNode: { rerankerNode: {
label: '多路召回', label: '多路召回',
@ -267,11 +264,11 @@ export default {
placeholder: '返回每組的第一個非空值', placeholder: '返回每組的第一個非空值',
placeholder1: '返回每組變量的集合', placeholder1: '返回每組變量的集合',
group: { group: {
placeholder: '請選擇變量',
noneError: '名稱不能為空', noneError: '名稱不能為空',
dupError: '名稱不能重複', dupError: '名稱不能重複',
}, },
add: '新增分組', addGroup: '添加分組',
editGroup: '編輯分組',
}, },
mcpNode: { mcpNode: {
label: 'MCP 調用', label: 'MCP 調用',
@ -414,7 +411,6 @@ export default {
label: '循環開始', label: '循環開始',
loopIndex: '下標', loopIndex: '下標',
loopItem: '循環元素', loopItem: '循環元素',
loopVariable: '循環變量',
}, },
loopBodyNode: { label: '循環體', text: '循環體' }, loopBodyNode: { label: '循環體', text: '循環體' },
loopContinueNode: { loopContinueNode: {
@ -431,7 +427,6 @@ export default {
inputVariables: '輸入變量', inputVariables: '輸入變量',
addVariables: '添加變量', addVariables: '添加變量',
editVariables: '編輯變量', editVariables: '編輯變量',
variablePlaceholder: '請輸入變量',
variableListPlaceholder: '請添加折開變數', variableListPlaceholder: '請添加折開變數',
expression: { expression: {
label: '表達式', label: '表達式',

View File

@ -233,7 +233,7 @@ export const replyNode = {
config: { config: {
fields: [ fields: [
{ {
label: t('views.applicationWorkflow.nodes.replyNode.content'), label: t('common.content'),
value: 'answer', value: 'answer',
}, },
], ],

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex-between mb-16"> <div class="flex-between mb-16">
<h5 class="break-all ellipsis lighter" style="max-width: 80%"> <h5 class="break-all ellipsis lighter" style="max-width: 80%">
{{ $t('views.applicationWorkflow.variable.loop', '循环变量') }} {{ $t('views.applicationWorkflow.variable.loop') }}
</h5> </h5>
<div> <div>
<span class="ml-4"> <span class="ml-4">

View File

@ -4,7 +4,7 @@
<LoopFieldTable :nodeModel="nodeModel"></LoopFieldTable> <LoopFieldTable :nodeModel="nodeModel"></LoopFieldTable>
<template v-if="loop_input_fields?.length"> <template v-if="loop_input_fields?.length">
<h5 class="title-decoration-1 mb-8"> <h5 class="title-decoration-1 mb-8">
{{ $t('views.applicationWorkflow.nodes.loopStartNode.loopVariable') }} {{ $t('views.applicationWorkflow.variable.loop') }}
</h5> </h5>
<div <div
v-for="(item, index) in loop_input_fields || []" v-for="(item, index) in loop_input_fields || []"

View File

@ -142,7 +142,7 @@
@change="form_data.tool_params[form_data.params_nested][item.label.label] = ''" @change="form_data.tool_params[form_data.params_nested][item.label.label] = ''"
> >
<el-option <el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')" :label="$t('views.applicationWorkflow.variable.Referencing')"
value="referencing" value="referencing"
/> />
<el-option :label="$t('common.custom')" value="custom" /> <el-option :label="$t('common.custom')" value="custom" />
@ -212,7 +212,7 @@
@change="form_data.tool_params[item.label.label] = ''" @change="form_data.tool_params[item.label.label] = ''"
> >
<el-option <el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')" :label="$t('views.applicationWorkflow.variable.Referencing')"
value="referencing" value="referencing"
/> />
<el-option :label="$t('common.custom')" value="custom" /> <el-option :label="$t('common.custom')" value="custom" />

View File

@ -9,10 +9,10 @@
label-width="auto" label-width="auto"
ref="replyNodeFormRef" ref="replyNodeFormRef"
> >
<el-form-item :label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.label')"> <el-form-item :label="$t('views.applicationWorkflow.nodes.replyNode.replyContent')">
<template #label> <template #label>
<div class="flex-between"> <div class="flex-between">
<span>{{ $t('views.applicationWorkflow.nodes.replyNode.replyContent.label') }}</span> <span>{{ $t('views.applicationWorkflow.nodes.replyNode.replyContent') }}</span>
<el-select <el-select
:teleported="false" :teleported="false"
v-model="form_data.reply_type" v-model="form_data.reply_type"
@ -20,7 +20,7 @@
style="width: 85px" style="width: 85px"
> >
<el-option <el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')" :label="$t('views.applicationWorkflow.variable.Referencing')"
value="referencing" value="referencing"
/> />
<el-option <el-option
@ -34,7 +34,7 @@
<MdEditorMagnify <MdEditorMagnify
v-if="form_data.reply_type === 'content'" v-if="form_data.reply_type === 'content'"
@wheel="wheel" @wheel="wheel"
:title="$t('views.applicationWorkflow.nodes.replyNode.replyContent.label')" :title="$t('views.applicationWorkflow.nodes.replyNode.replyContent')"
v-model="form_data.content" v-model="form_data.content"
style="height: 150px" style="height: 150px"
@submitDialog="submitDialog" @submitDialog="submitDialog"

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:title="isEdit ? $t('common.param.editParam') : $t('common.param.addParam')" :title="isEdit ? $t('views.applicationWorkflow.nodes.variableAggregationNode.editGroup') : $t('views.applicationWorkflow.nodes.variableAggregationNode.addGroup')"
v-model="dialogVisible" v-model="dialogVisible"
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
@ -16,7 +16,7 @@
require-asterisk-position="right" require-asterisk-position="right"
> >
<el-form-item <el-form-item
:label="$t('dynamicsForm.paramForm.field.label')" :label="$t('common.variable')"
:required="true" :required="true"
prop="field" prop="field"
:rules="rules.field" :rules="rules.field"
@ -24,7 +24,7 @@
<el-input <el-input
v-model="form.field" v-model="form.field"
:maxlength="64" :maxlength="64"
:placeholder="$t('dynamicsForm.paramForm.field.placeholder')" :placeholder="$t('views.applicationWorkflow.variable.inputPlaceholder')"
show-word-limit show-word-limit
/> />
</el-form-item> </el-form-item>
@ -70,10 +70,10 @@ const form = ref<any>({
const rules = reactive({ const rules = reactive({
label: [ label: [
{ required: true, message: t('dynamicsForm.paramForm.name.requiredMessage'), trigger: 'blur' }, { required: true, message: t('views.applicationWorkflow.variable.inputPlaceholder'), trigger: 'blur' },
], ],
field: [ field: [
{ required: true, message: t('dynamicsForm.paramForm.field.requiredMessage'), trigger: 'blur' }, { required: true, message: t('views.applicationWorkflow.variable.inputPlaceholder'), trigger: 'blur' },
{ {
pattern: /^[a-zA-Z0-9_]+$/, pattern: /^[a-zA-Z0-9_]+$/,
message: t('dynamicsForm.paramForm.field.requiredMessage2'), message: t('dynamicsForm.paramForm.field.requiredMessage2'),

View File

@ -2,67 +2,71 @@
<NodeContainer :nodeModel="nodeModel"> <NodeContainer :nodeModel="nodeModel">
<h5 class="title-decoration-1 mb-8">{{ $t('views.applicationWorkflow.nodeSetting') }}</h5> <h5 class="title-decoration-1 mb-8">{{ $t('views.applicationWorkflow.nodeSetting') }}</h5>
<el-form <el-form
@submit.prevent @submit.prevent
:model="form_data" :model="form_data"
label-position="top" label-position="top"
require-asterisk-position="right" require-asterisk-position="right"
label-width="auto" label-width="auto"
ref="VariableAggregationRef" ref="VariableAggregationRef"
hide-required-asterisk hide-required-asterisk
> >
<el-form-item <el-form-item
:label="$t('views.applicationWorkflow.nodes.variableAggregationNode.Strategy')" :label="$t('views.applicationWorkflow.nodes.variableAggregationNode.Strategy')"
:rules="{ :rules="{
required: true, required: true,
trigger: 'change', trigger: 'change',
}" }"
> >
<template #label> <template #label>
<div class="flex-between"> <div class="flex-between">
<div> <div>
<span>{{ $t('views.applicationWorkflow.nodes.variableAggregationNode.Strategy') }} <span
<span class="color-danger">*</span> >{{ $t('views.applicationWorkflow.nodes.variableAggregationNode.Strategy') }}
</span> <span class="color-danger">*</span>
</div> </span>
</div> </div>
</template> </div>
<el-select </template>
v-model="form_data.strategy" <el-select v-model="form_data.strategy">
> <el-option
<el-option :label="t('views.applicationWorkflow.nodes.variableAggregationNode.placeholder')"
:label="t('views.applicationWorkflow.nodes.variableAggregationNode.placeholder')" value="first_non_null"
value="first_non_null" />
/> <el-option
<el-option :label="t('views.applicationWorkflow.nodes.variableAggregationNode.placeholder1')"
:label="t('views.applicationWorkflow.nodes.variableAggregationNode.placeholder1')" value="variable_to_json"
value="variable_to_json" />
/> </el-select>
</el-select>
</el-form-item> </el-form-item>
<div v-for="(group, gIndex) in form_data.group_list" :key="group.id" class="mb-8"> <div v-for="(group, gIndex) in form_data.group_list" :key="group.id" class="mb-8">
<el-card shadow="never" class="card-never" style="--el-card-padding: 12px"> <el-card shadow="never" class="card-never" style="--el-card-padding: 12px">
<div class="flex-between mb-12"> <div class="flex-between mb-12">
<span class="font-bold">{{ group.label }}</span> <span class="font-bold">{{ group.label }}</span>
<div class="flex align-center"> <div class="flex align-center" style="margin-right: -3px;">
<el-button @click="openAddOrEditDialog(group,gIndex)" size="large" link> <el-button @click="openAddOrEditDialog(group, gIndex)" link>
<el-icon><EditPen /></el-icon> <el-icon><EditPen /></el-icon>
</el-button> </el-button>
<el-button @click="deleteGroup(gIndex)" size="large" link :disabled="form_data.group_list.length <= 1"> <el-button
@click="deleteGroup(gIndex)"
link
:disabled="form_data.group_list.length <= 1"
>
<AppIcon iconName="app-delete"></AppIcon> <AppIcon iconName="app-delete"></AppIcon>
</el-button> </el-button>
</div> </div>
</div> </div>
<div v-for="(item, vIndex) in group.variable_list" :key="item.v_id" class="mb-4"> <div v-for="(item, vIndex) in group.variable_list" :key="item.v_id">
<el-row :gutter="8"> <el-row>
<el-col :span="21"> <el-col :span="22">
<el-form-item <el-form-item
:prop="`group_list.${gIndex}.variable_list.${vIndex}.variable`" :prop="`group_list.${gIndex}.variable_list.${vIndex}.variable`"
:rules="{ :rules="{
type: 'array', type: 'array',
required: true, required: true,
message: $t('views.applicationWorkflow.nodes.variableAggregationNode.group.placeholder'), message: $t(
'views.applicationWorkflow.variable.placeholder',
),
trigger: 'change', trigger: 'change',
}" }"
> >
@ -70,16 +74,15 @@
ref="nodeCascaderRef" ref="nodeCascaderRef"
:nodeModel="nodeModel" :nodeModel="nodeModel"
class="w-full" class="w-full"
:placeholder="$t('views.applicationWorkflow.nodes.variableAggregationNode.group.placeholder')" :placeholder="$t('views.applicationWorkflow.variable.placeholder')"
v-model="item.variable" v-model="item.variable"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3" style="text-align: center;"> <el-col :span="2">
<el-button <el-button
link link
size="large" class="mt-4 ml-4"
class="mt-4"
:disabled="group.variable_list.length <= 1" :disabled="group.variable_list.length <= 1"
@click="deleteVariable(gIndex, vIndex)" @click="deleteVariable(gIndex, vIndex)"
> >
@ -90,18 +93,17 @@
</div> </div>
<el-button @click="addVariable(gIndex)" type="primary" size="large" link> <el-button @click="addVariable(gIndex)" type="primary" size="large" link>
<AppIcon iconName="app-add-outlined" class="mr-4"/> <AppIcon iconName="app-add-outlined" class="mr-4" />
{{ $t('common.add') }} {{ $t('common.add') }}
</el-button> </el-button>
</el-card> </el-card>
</div> </div>
<el-button @click="openAddOrEditDialog()" type="primary" size="large" link> <el-button @click="openAddOrEditDialog()" type="primary" size="large" link>
<AppIcon iconName="app-add-outlined" class="mr-4"/> <AppIcon iconName="app-add-outlined" class="mr-4" />
{{ $t('views.applicationWorkflow.nodes.variableAggregationNode.add') }} {{ $t('views.applicationWorkflow.nodes.variableAggregationNode.addGroup') }}
</el-button> </el-button>
</el-form> </el-form>
<GroupFieldDialog ref="GroupFieldDialogRef" @refresh="refreshFieldList"></GroupFieldDialog> <GroupFieldDialog ref="GroupFieldDialogRef" @refresh="refreshFieldList"></GroupFieldDialog>
</NodeContainer> </NodeContainer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -130,11 +132,11 @@ const form = {
variable_list: [ variable_list: [
{ {
v_id: randomId(), v_id: randomId(),
variable: [] variable: [],
} },
] ],
}, },
] ],
} }
const form_data = computed({ const form_data = computed({
get: () => { get: () => {
@ -147,7 +149,7 @@ const form_data = computed({
}, },
set: (value) => { set: (value) => {
set(props.nodeModel.properties, 'node_data', value) set(props.nodeModel.properties, 'node_data', value)
} },
}) })
const inputFieldList = ref<any[]>([]) const inputFieldList = ref<any[]>([])
@ -160,7 +162,7 @@ function openAddOrEditDialog(group?: any, index?: any) {
label: group.label, label: group.label,
} }
} }
GroupFieldDialogRef.value.open(data,index) GroupFieldDialogRef.value.open(data, index)
} }
function refreshFieldList(data: any, index: any) { function refreshFieldList(data: any, index: any) {
@ -178,9 +180,7 @@ function refreshFieldList(data: any, index: any) {
editGroupDesc(data, index) editGroupDesc(data, index)
} }
GroupFieldDialogRef.value.close() GroupFieldDialogRef.value.close()
const fields = [ const fields = [...inputFieldList.value.map((item) => ({ label: item.label, value: item.field }))]
...inputFieldList.value.map((item) => ({ label: item.label, value: item.field })),
]
set(props.nodeModel.properties.config, 'fields', fields) set(props.nodeModel.properties.config, 'fields', fields)
} }
@ -193,23 +193,23 @@ const editGroupDesc = (data: any, gIndex: any) => {
const deleteGroup = (gIndex: number) => { const deleteGroup = (gIndex: number) => {
const c_group_list = cloneDeep(form_data.value.group_list) const c_group_list = cloneDeep(form_data.value.group_list)
c_group_list.splice(gIndex,1) c_group_list.splice(gIndex, 1)
form_data.value.group_list = c_group_list form_data.value.group_list = c_group_list
inputFieldList.value.splice(gIndex, 1) inputFieldList.value.splice(gIndex, 1)
const fields = c_group_list.map((item:any) => ({ label: item.label, value: item.field})) const fields = c_group_list.map((item: any) => ({ label: item.label, value: item.field }))
set(props.nodeModel.properties.config, 'fields', fields) set(props.nodeModel.properties.config, 'fields', fields)
} }
const addVariable = (gIndex: number) => { const addVariable = (gIndex: number) => {
const c_group_list = cloneDeep(form_data.value.group_list) const c_group_list = cloneDeep(form_data.value.group_list)
c_group_list[gIndex].variable_list.push({ c_group_list[gIndex].variable_list.push({
v_id: randomId(), v_id: randomId(),
variable: [] variable: [],
}) })
form_data.value.group_list = c_group_list form_data.value.group_list = c_group_list
} }
const deleteVariable = (gIndex: number,vIndex: number) => { const deleteVariable = (gIndex: number, vIndex: number) => {
const c_group_list = cloneDeep(form_data.value.group_list) const c_group_list = cloneDeep(form_data.value.group_list)
c_group_list[gIndex].variable_list.splice(vIndex, 1) c_group_list[gIndex].variable_list.splice(vIndex, 1)
form_data.value.group_list = c_group_list form_data.value.group_list = c_group_list
@ -221,23 +221,23 @@ const addGroup = (data: any) => {
id: randomId(), id: randomId(),
field: data.field, field: data.field,
label: data.label, label: data.label,
variable_list: [{ variable_list: [
v_id: randomId(), {
variable: [] v_id: randomId(),
}] variable: [],
},
],
}) })
form_data.value.group_list = c_group_list form_data.value.group_list = c_group_list
} }
const validate = async () => { const validate = async () => {
const validate_list = [ const validate_list = [
...nodeCascaderRef.value.map((item:any)=>item.validate()), ...nodeCascaderRef.value.map((item: any) => item.validate()),
VariableAggregationRef.value?.validate(), VariableAggregationRef.value?.validate(),
] ]
return Promise.all(validate_list).catch((err) => { return Promise.all(validate_list).catch((err) => {
return Promise.reject({node: props.nodeModel, errMessage: err}) return Promise.reject({ node: props.nodeModel, errMessage: err })
}) })
} }
@ -249,12 +249,16 @@ onMounted(() => {
} }
set(props.nodeModel, 'validate', validate) set(props.nodeModel, 'validate', validate)
if (props.nodeModel.properties.node_data.group_list) { if (props.nodeModel.properties.node_data.group_list) {
inputFieldList.value = form_data.value.group_list.map((item:any) => ({ label: item.label, field: item.field})) inputFieldList.value = form_data.value.group_list.map((item: any) => ({
label: item.label,
field: item.field,
}))
} }
const fields = form_data.value.group_list.map((item: any) => ({ label: item.label, value: item.field })) const fields = form_data.value.group_list.map((item: any) => ({
label: item.label,
value: item.field,
}))
set(props.nodeModel.properties.config, 'fields', fields) set(props.nodeModel.properties.config, 'fields', fields)
}) })
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@ -44,7 +44,7 @@
> >
<el-select :teleported="false" v-model="item.source" size="small" style="width: 85px"> <el-select :teleported="false" v-model="item.source" size="small" style="width: 85px">
<el-option <el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')" :label="$t('views.applicationWorkflow.variable.Referencing')"
value="referencing" value="referencing"
/> />
<el-option :label="$t('common.custom')" value="custom" /> <el-option :label="$t('common.custom')" value="custom" />

View File

@ -29,7 +29,7 @@
v-model="form.field" v-model="form.field"
:maxlength="64" :maxlength="64"
:placeholder=" :placeholder="
$t('views.applicationWorkflow.nodes.variableSplittingNode.variablePlaceholder') $t('views.applicationWorkflow.variable.inputPlaceholder')
" "
show-word-limit show-word-limit
/> />