From 9bec4dcae002f36aa23231da11cb03a156b40110 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 30 4月 2025 16:24:16 +0800 Subject: [PATCH] 222 --- PipeLineLems/web/src/components/Variable/Variable.tsx | 36 ++++++++++++++++++++++-------------- 1 files changed, 22 insertions(+), 14 deletions(-) diff --git a/PipeLineLems/web/src/components/Variable/Variable.tsx b/PipeLineLems/web/src/components/Variable/Variable.tsx index e3d854f..1ae8c4f 100644 --- a/PipeLineLems/web/src/components/Variable/Variable.tsx +++ b/PipeLineLems/web/src/components/Variable/Variable.tsx @@ -4,7 +4,11 @@ import Icon from '../Icon/Icon' import { Base } from '@/libs/Base/Base' import { useVModels } from '@vueuse/core' +import get from 'lodash/get' +import { set } from 'lodash' +import { text } from 'stream/consumers' const { openVariableDialog } = sdk.utils +import { _t, getScopeT, Language } from '@/libs/Language/Language' interface CurrentVariableType { id?: string @@ -47,6 +51,10 @@ type: String, default: '', }, + LanguageScopeKey: { + type: String, + default: '', + }, }, emits: ['update:modelValue', 'update:dataSource', 'change'], setup(props, { attrs, slots, emit }) { @@ -69,14 +77,14 @@ const onMultipleSelectVariable = (varData: any[]) => { if (props.field) { const index = props.index + varData.forEach((variable, i: number) => { const row: any = dataSource.value[index + i] if (row) { - if ( - typeof row[props.field] !== 'object' || - row[props.field] === null - ) { - row[props.field] = variable.name + const v = get(row, props.field) + + if (typeof v !== 'object' || v === null) { + set(row, props.field, variable.name) } } }) @@ -85,10 +93,10 @@ const onSelectVariable = async () => { const currentVariable: CurrentVariableType = {} - if (variable.value) { - currentVariable.id = Base.getVariableIdByName(variable.value) - currentVariable.name = variable.value - } + // if (variable.value) { + // currentVariable.id = Base.getVariableIdByName(variable.value) + // currentVariable.name = variable.value + // } try { const varData = await openVariableDialog({ currentVariable, @@ -98,8 +106,8 @@ configData: {}, }) if (!props.isMultiple) { - variable.value = varData.name - emit('change', varData.name) + variable.value = varData?.name + emit('change', varData?.name) } else { onMultipleSelectVariable(varData) } @@ -120,7 +128,7 @@ clearable={props.clearable || props.isClose} readonly={props.isClose || props.clearable} class={styles.selectVariable} - placeholder="璇疯緭鍏�" + placeholder={_t('璇烽�夋嫨')} suffix-icon={ <el-button link @@ -129,7 +137,7 @@ style="margin-right: 10px;" onClick={onSelectVariable} > - 閫夋嫨 + {_t('閫夋嫨')} </el-button> } ></el-input> @@ -173,7 +181,7 @@ </div> ) : ( <span onClick={onSelectVariable} class={styles.select}> - 璇烽�夋嫨 + {_t('璇烽�夋嫨')} </span> )} </div> -- Gitblit v1.9.3