feat(iot): refactor TimerConditionGroupConfig and PropertySelector for improved readability

pull/850/MERGE
YunaiV 2026-01-29 19:39:19 +08:00
parent da969d3be7
commit 4c5825389e
2 changed files with 5 additions and 16 deletions

View File

@ -15,9 +15,7 @@
<span>附加条件组</span>
</div>
<el-tag size="small" type="info">定时触发时需满足以下条件</el-tag>
<el-tag size="small" type="warning">
{{ conditionGroups?.length || 0 }} 个子条件组
</el-tag>
<el-tag size="small" type="warning"> {{ conditionGroups?.length || 0 }} 个子条件组 </el-tag>
</div>
<el-button
type="primary"
@ -138,12 +136,10 @@ const addConditionGroup = async () => {
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

View File

@ -219,13 +219,13 @@ const thingModelTSL = ref<IotThingModelTSLResp | null>(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({