From 192a11882382d35b81ff24a6aaecb73a3e54b7bb Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 2 May 2026 14:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91IoT=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E8=81=94=E5=8A=A8=EF=BC=9A=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E5=99=A8=E6=AF=94=E8=BE=83=E5=80=BC=E6=94=B9?= =?UTF-8?q?=E6=99=AE=E9=80=9A=E6=96=87=E6=9C=AC=E8=BE=93=E5=85=A5=EF=BC=8C?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E7=95=99=E7=A9=BA=EF=BC=88=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=8F=91=E7=94=9F=E5=8D=B3=E5=8C=B9=E9=85=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/rule/scene/form/RuleSceneForm.vue | 20 +++++++---- .../form/configs/MainConditionInnerConfig.vue | 35 ++++++++----------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/views/iot/rule/scene/form/RuleSceneForm.vue b/src/views/iot/rule/scene/form/RuleSceneForm.vue index 22ba268e2..a5b2efede 100644 --- a/src/views/iot/rule/scene/form/RuleSceneForm.vue +++ b/src/views/iot/rule/scene/form/RuleSceneForm.vue @@ -128,13 +128,19 @@ const validateTriggers = (_rule: any, value: any, callback: any) => { callback(new Error(`触发器 ${i + 1}: 物模型标识符不能为空`)) return } - if (!trigger.operator) { - callback(new Error(`触发器 ${i + 1}: 操作符不能为空`)) - return - } - if (trigger.value === undefined || trigger.value === null || trigger.value === '') { - callback(new Error(`触发器 ${i + 1}: 参数值不能为空`)) - return + // 事件上报 / 服务调用:operator 由前端自动设为 '=',参数值留空表示"事件 / 调用发生即匹配" + const isEventOrService = + trigger.type === IotRuleSceneTriggerTypeEnum.DEVICE_EVENT_POST || + trigger.type === IotRuleSceneTriggerTypeEnum.DEVICE_SERVICE_INVOKE + if (!isEventOrService) { + if (!trigger.operator) { + callback(new Error(`触发器 ${i + 1}: 操作符不能为空`)) + return + } + if (trigger.value === undefined || trigger.value === null || trigger.value === '') { + callback(new Error(`触发器 ${i + 1}: 参数值不能为空`)) + return + } } } diff --git a/src/views/iot/rule/scene/form/configs/MainConditionInnerConfig.vue b/src/views/iot/rule/scene/form/configs/MainConditionInnerConfig.vue index 4c61d31e4..4ccff2b43 100644 --- a/src/views/iot/rule/scene/form/configs/MainConditionInnerConfig.vue +++ b/src/views/iot/rule/scene/form/configs/MainConditionInnerConfig.vue @@ -80,14 +80,20 @@ :config="serviceConfig" placeholder="请输入 JSON 格式的服务参数" /> - - + + { return undefined }) -// 计算属性:事件配置 - 用于 JsonParamsInput -const eventConfig = computed(() => { - if (propertyConfig.value && props.triggerType === IotRuleSceneTriggerTypeEnum.DEVICE_EVENT_POST) { - return { - event: { - name: propertyConfig.value.name || '事件', - outputParams: propertyConfig.value.outputParams || [] - } - } - } - return undefined -}) - /** * 更新条件字段 * @param field 字段名