From 057de400fe3d4db3d2c4caad39b74020e3ff7b5c Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Mon, 23 Oct 2023 09:36:46 +0800 Subject: [PATCH] fix: bug#18733 --- .../Save/action/Device/actions/FunctionItem.vue | 8 ++++++-- .../action/Device/actions/WriteProperty.vue | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue b/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue index cc5fe7d2..64dd0f80 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue @@ -109,13 +109,17 @@ const upperOptions = computed(() => { }); const onChange = () => { + const objValue: any = { source: _source.value, value: _value.value } + if (_source.value === 'upper') { + objValue.upperKey = _value.value + } emit('update:value', _value.value); emit('update:source', _source.value); - emit('change', { source: _source.value, value: _value.value }); + emit('change', objValue); }; watchEffect(() => { _value.value = props.value; _source.value = props.source || 'fixed'; }); - \ No newline at end of file + diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue b/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue index b744e408..7c1d621c 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue @@ -173,11 +173,18 @@ const onChange = () => { const onValueChange = (val: any, label: string) => { const optionColumn = isObject(val) && (val as any).metadata ? [(val as any).column] : [] + + const objectValue: any = { + value: propertyModelRef?.propertiesValue, + source: propertyModelRef?.source, + } + + if (propertyModelRef?.source === 'upper') { + objectValue.upperKey = propertyModelRef?.propertiesValue + } + const obj = { - [`${propertyModelRef.properties}`]: { - value: propertyModelRef?.propertiesValue, - source: propertyModelRef?.source, - }, + [`${propertyModelRef.properties}`]: objectValue }; emit('update:value', obj); emit('change', label || val, optionColumn) @@ -212,4 +219,4 @@ const onSave = () => { }; defineExpose({ onSave }); - \ No newline at end of file +