From 9917683f0ae88401477b14f45bb0bf1c5de90ea2 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 5 Aug 2025 17:33:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=80=90IoT=20=E7=89=A9=E8=81=94?= =?UTF-8?q?=E7=BD=91=E3=80=91=E5=9C=BA=E6=99=AF=E8=81=94=E5=8A=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20JsonParamsInput=20=E6=94=AF=E6=8C=81=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E6=8A=A5=EF=BC=88=E5=A1=AB=E5=86=99=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E8=BE=93=E5=87=BA=E5=8F=82=E6=95=B0=EF=BC=89?= =?UTF-8?q?=20=E6=9C=8D=E5=8A=A1=E8=B0=83=E7=94=A8=EF=BC=88=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E6=9C=8D=E5=8A=A1=E7=9A=84=E8=BE=93=E5=85=A5=E5=8F=82?= =?UTF-8?q?=E6=95=B0=EF=BC=89=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE=EF=BC=88?= =?UTF-8?q?=E5=A1=AB=E5=86=99=E4=BA=A7=E5=93=81=E7=89=A9=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=8F=AF=E5=86=99=E5=B1=9E=E6=80=A7=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/rule/scene/scene.types.ts | 3 + .../form/configs/DeviceControlConfig.vue | 752 +----------------- .../form/configs/MainConditionInnerConfig.vue | 76 +- .../scene/form/inputs/JsonParamsInput.vue | 499 ++++++++++++ .../scene/form/inputs/ServiceParamsInput.vue | 495 ------------ .../scene/form/selectors/PropertySelector.vue | 1 - 6 files changed, 603 insertions(+), 1223 deletions(-) create mode 100644 src/views/iot/rule/scene/form/inputs/JsonParamsInput.vue delete mode 100644 src/views/iot/rule/scene/form/inputs/ServiceParamsInput.vue 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数据