fix: 场景联动内置参数校验

This commit is contained in:
100011797 2023-06-02 11:17:48 +08:00
parent af5d2e08f6
commit 89458dbf96
2 changed files with 18 additions and 2 deletions

View File

@ -17,7 +17,7 @@
<FunctionItem
:builtInList="builtInList"
@change="onChange"
:source="record.source"
v-model:source="record.source"
:data="record"
v-model:value="record.value"
/>

View File

@ -152,8 +152,8 @@ const checkDeviceDelete = async () => {
if (item!.message!.messageType === 'WRITE_PROPERTY') {
let hasProperties = false
const propertiesKey = Object.keys(item!.message!.properties!)?.[0]
if (item!.message!.properties && metadata.properties.length) {
const propertiesKey = Object.keys(item!.message!.properties!)?.[0]
hasProperties = metadata.properties?.some((item: any) => item.id === propertiesKey)
}
if (!hasProperties) {
@ -162,6 +162,22 @@ const checkDeviceDelete = async () => {
formTouchOff()
return
}
// -
const _value = item!.message!.properties?.[propertiesKey]
if(_value.source === 'upper') {
const _params = {
branch: props.thenName,
branchGroup: props.branchesName,
action: props.name - 1,
};
const option = (await getBuildInData(_params, _data.value))(_value?.value!, 'id')
if(!option) {
_data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.message!.properties![propertiesKey] = undefined
_data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.changeData = true
formTouchOff()
return
}
}
}
if (item!.message!.messageType === 'INVOKE_FUNCTION') {