From 4c5825389ea4fc750e2f09d68fd4f3e0d9da7800 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 29 Jan 2026 19:39:19 +0800 Subject: [PATCH] feat(iot): refactor TimerConditionGroupConfig and PropertySelector for improved readability --- .../form/configs/TimerConditionGroupConfig.vue | 17 +++-------------- .../scene/form/selectors/PropertySelector.vue | 4 ++-- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/views/iot/rule/scene/form/configs/TimerConditionGroupConfig.vue b/src/views/iot/rule/scene/form/configs/TimerConditionGroupConfig.vue index da9c3b3b..bd52d2e4 100644 --- a/src/views/iot/rule/scene/form/configs/TimerConditionGroupConfig.vue +++ b/src/views/iot/rule/scene/form/configs/TimerConditionGroupConfig.vue @@ -15,9 +15,7 @@ 附加条件组 定时触发时需满足以下条件 - - {{ conditionGroups?.length || 0 }} 个子条件组 - + {{ conditionGroups?.length || 0 }} 个子条件组 { if (!conditionGroups.value) { conditionGroups.value = [] } - // 检查是否达到最大条件组数量限制 if (conditionGroups.value.length >= maxGroups) { return } - // 使用 nextTick 确保响应式更新完成后再添加新的条件组 await nextTick() if (conditionGroups.value) { @@ -151,21 +147,14 @@ const addConditionGroup = async () => { } } -/** - * 移除条件组 - * @param index 条件组索引 - */ +/** 移除条件组 */ const removeConditionGroup = (index: number) => { if (conditionGroups.value) { conditionGroups.value.splice(index, 1) } } -/** - * 更新条件组 - * @param index 条件组索引 - * @param group 条件组数据 - */ +/** 更新条件组 */ const updateConditionGroup = (index: number, group: TriggerCondition[]) => { if (conditionGroups.value) { conditionGroups.value[index] = group diff --git a/src/views/iot/rule/scene/form/selectors/PropertySelector.vue b/src/views/iot/rule/scene/form/selectors/PropertySelector.vue index 66fb7b10..861f98a6 100644 --- a/src/views/iot/rule/scene/form/selectors/PropertySelector.vue +++ b/src/views/iot/rule/scene/form/selectors/PropertySelector.vue @@ -219,13 +219,13 @@ const thingModelTSL = ref(null) // 物模型TSL数 const propertyGroups = computed(() => { const groups: { label: string; options: any[] }[] = [] - // 设备属性上报触发器 或 定时触发器(条件组中的设备属性条件) + // 设备属性上报触发器、定时触发器(条件组中的设备属性条件) if ( props.triggerType === IotRuleSceneTriggerTypeEnum.DEVICE_PROPERTY_POST || props.triggerType === IotRuleSceneTriggerTypeEnum.TIMER ) { const propertyOptions = propertyList.value.filter( - (p) => p.type === IoTThingModelTypeEnum.PROPERTY + (property) => property.type === IoTThingModelTypeEnum.PROPERTY ) if (propertyOptions.length > 0) { groups.push({