diff --git a/src/api/iot/rule/scene/scene.types.ts b/src/api/iot/rule/scene/scene.types.ts index dc9342ca..9c0ee6f1 100644 --- a/src/api/iot/rule/scene/scene.types.ts +++ b/src/api/iot/rule/scene/scene.types.ts @@ -194,6 +194,9 @@ interface FormValidationRules { [key: string]: ValidationRule[] } +// 表单数据类型别名 +export type TriggerFormData = Trigger + // TODO @puhui999:这个文件,目标最终没有哈,和别的模块一致; export { IotSceneRule, Trigger, TriggerCondition, Action, ValidationRule, FormValidationRules } diff --git a/src/views/iot/rule/scene/form/configs/DeviceControlConfig.vue b/src/views/iot/rule/scene/form/configs/DeviceControlConfig.vue index e8ea5f1b..0598c454 100644 --- a/src/views/iot/rule/scene/form/configs/DeviceControlConfig.vue +++ b/src/views/iot/rule/scene/form/configs/DeviceControlConfig.vue @@ -1,5 +1,4 @@ - - - diff --git a/src/views/iot/rule/scene/form/configs/MainConditionInnerConfig.vue b/src/views/iot/rule/scene/form/configs/MainConditionInnerConfig.vue index 9906160b..3ef84848 100644 --- a/src/views/iot/rule/scene/form/configs/MainConditionInnerConfig.vue +++ b/src/views/iot/rule/scene/form/configs/MainConditionInnerConfig.vue @@ -82,11 +82,23 @@ required > - + + @@ -106,11 +118,44 @@
- + + + + + + + + + + + + + + + + + + + + + + + +
@@ -131,8 +176,8 @@ import DeviceSelector from '../selectors/DeviceSelector.vue' import PropertySelector from '../selectors/PropertySelector.vue' import OperatorSelector from '../selectors/OperatorSelector.vue' import ValueInput from '../inputs/ValueInput.vue' -import ServiceParamsInput from '../inputs/ServiceParamsInput.vue' -import DeviceStatusConditionConfig from './DeviceStatusConditionConfig.vue' +import JsonParamsInput from '../inputs/JsonParamsInput.vue' + import { TriggerFormData } from '@/api/iot/rule/scene/scene.types' import { IotRuleSceneTriggerTypeEnum, getTriggerTypeOptions } from '@/views/iot/utils/constants' import { useVModel } from '@vueuse/core' @@ -198,11 +243,6 @@ const updateConditionField = (field: keyof TriggerFormData, value: any) => { updateValidationResult() } -const updateCondition = (value: TriggerFormData) => { - emit('update:modelValue', value) - updateValidationResult() -} - const handleTriggerTypeChange = (type: number) => { emit('trigger-type-change', type) } @@ -232,14 +272,12 @@ const handleOperatorChange = () => { updateValidationResult() } -const handleValueValidate = (_result: { valid: boolean; message: string }) => { - updateValidationResult() -} - -const handleValidate = (result: { valid: boolean; message: string }) => { +// 处理参数验证结果 +const handleValueValidate = (result: { valid: boolean; message: string }) => { isValid.value = result.valid validationMessage.value = result.message emit('validate', result) + updateValidationResult() } // 验证逻辑 diff --git a/src/views/iot/rule/scene/form/inputs/JsonParamsInput.vue b/src/views/iot/rule/scene/form/inputs/JsonParamsInput.vue new file mode 100644 index 00000000..8abff791 --- /dev/null +++ b/src/views/iot/rule/scene/form/inputs/JsonParamsInput.vue @@ -0,0 +1,499 @@ + + + + + + diff --git a/src/views/iot/rule/scene/form/inputs/ServiceParamsInput.vue b/src/views/iot/rule/scene/form/inputs/ServiceParamsInput.vue deleted file mode 100644 index 2751168e..00000000 --- a/src/views/iot/rule/scene/form/inputs/ServiceParamsInput.vue +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - diff --git a/src/views/iot/rule/scene/form/selectors/PropertySelector.vue b/src/views/iot/rule/scene/form/selectors/PropertySelector.vue index e353fc27..5012c77e 100644 --- a/src/views/iot/rule/scene/form/selectors/PropertySelector.vue +++ b/src/views/iot/rule/scene/form/selectors/PropertySelector.vue @@ -286,7 +286,6 @@ const handleChange = (value: string) => { config: property }) } - // 选择变化时,el-popover 会自动关闭 } // 获取物模型TSL数据