diff --git a/src/views/iot/rule/scene/form/configs/DeviceTriggerConfig.vue b/src/views/iot/rule/scene/form/configs/DeviceTriggerConfig.vue index b5e37d5d..69ab5052 100644 --- a/src/views/iot/rule/scene/form/configs/DeviceTriggerConfig.vue +++ b/src/views/iot/rule/scene/form/configs/DeviceTriggerConfig.vue @@ -7,6 +7,7 @@ v-model="trigger" :trigger-type="trigger.type" @validate="handleMainConditionValidate" + @trigger-type-change="handleTriggerTypeChange" /> @@ -42,6 +43,7 @@ const props = defineProps<{ const emit = defineEmits<{ (e: 'update:modelValue', value: TriggerFormData): void (e: 'validate', value: { valid: boolean; message: string }): void + (e: 'trigger-type-change', type: number): void }>() const trigger = useVModel(props, 'modelValue', emit) @@ -83,6 +85,11 @@ const handleMainConditionValidate = (result: { valid: boolean; message: string } updateValidationResult() } +const handleTriggerTypeChange = (type: number) => { + trigger.value.type = type + emit('trigger-type-change', type) +} + // 事件处理 const handleConditionGroupValidate = () => { updateValidationResult() diff --git a/src/views/iot/rule/scene/form/configs/MainConditionConfig.vue b/src/views/iot/rule/scene/form/configs/MainConditionConfig.vue index 0376a01a..5753d7bb 100644 --- a/src/views/iot/rule/scene/form/configs/MainConditionConfig.vue +++ b/src/views/iot/rule/scene/form/configs/MainConditionConfig.vue @@ -1,38 +1,33 @@