From d4dbc450ea7ca47dd78c060eaf584b3420508051 Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Wed, 29 Mar 2023 18:56:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/media/Device/Save/SaveProduct.vue | 28 ++++++++++------- .../action/Device/actions/FunctionItem.vue | 3 +- .../Scene/Save/action/Device/device/Tag.vue | 25 ++++++++++++---- .../Scene/Save/action/Device/device/index.vue | 23 +++++++------- .../Scene/Save/action/Device/index.vue | 15 +++++++--- .../Scene/Save/action/Device/typings.d.ts | 3 +- .../Save/action/Notify/NotifyTemplate.vue | 1 + .../action/Notify/VariableDefinitions.vue | 1 + .../Scene/Save/action/Notify/index.vue | 4 +-- src/views/rule-engine/Scene/Save/index.vue | 4 ++- src/views/rule-engine/Scene/Save/util.ts | 30 +++++++++++++++++++ 11 files changed, 99 insertions(+), 38 deletions(-) diff --git a/src/views/media/Device/Save/SaveProduct.vue b/src/views/media/Device/Save/SaveProduct.vue index 590fe9c1..3be3b0df 100644 --- a/src/views/media/Device/Save/SaveProduct.vue +++ b/src/views/media/Device/Save/SaveProduct.vue @@ -73,15 +73,21 @@ style="margin-top: 50px" > - 添加{{ providerType[props.channel] }}接入网关 - +
diff --git a/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue b/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue index d839f1bc..da587184 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue @@ -113,9 +113,10 @@ const deleteItem = (_index: number) => { }; const onTypeSelect = (key: any, _index: number) => { - const indexItem = tagList[_index]; + const indexItem = tagList.value[_index]; indexItem.type = key; tagList.value[_index] = indexItem; + onValueChange() }; const onTagSelect = (_data: any, _index: number) => { @@ -127,6 +128,7 @@ const onTagSelect = (_data: any, _index: number) => { handleItem({ ..._data, value: undefined, type: indexType }), ); tagList.value = newList; + onValueChange() }; watch( @@ -173,7 +175,7 @@ const onValueChange = () => { const newValue = _data.map((item: any) => { return { column: item.id, - type: item?.valueType, + type: item?.type, value: item?.value, }; }); @@ -181,10 +183,21 @@ const onValueChange = () => { emits('change', [{ value: newValue, name: '标签' }], _data); }; -// onMounted(() => { -// // console.log(tagList.value, props.tagData, props.value) -// // emits('change', props.value, _data); -// }) +onMounted(() => { + if(props.value?.[0]?.value){ + const arr: any[] = [] + props.value?.[0]?.value.map((item: any) => { + const _item = props.tagData.find(i => i.id === item.column) + if(_item){ + arr.push({ + ..._item, + ...item, + }) + } + }) + emits('change', props.value, arr); + } +})