From 5607f23322a75ddb07e9ee16795b640dbec0b012 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 20 May 2026 09:57:05 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=88iot=EF=BC=89:=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20rule=20scene=20=E7=9A=84=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rule/scene/form/configs/alert-config.vue | 3 +- .../form/configs/device-control-config.vue | 27 +++++++------- .../form/configs/device-trigger-config.vue | 7 ++-- .../configs/main-condition-inner-config.vue | 8 ++--- .../configs/timer-condition-group-config.vue | 4 --- .../scene/form/sections/trigger-section.vue | 36 ++++--------------- .../scene/form/selectors/product-selector.vue | 5 ++- .../form/selectors/property-selector.vue | 10 +++--- .../src/views/iot/rule/scene/index.vue | 5 ++- 9 files changed, 36 insertions(+), 69 deletions(-) diff --git a/apps/web-antd/src/views/iot/rule/scene/form/configs/alert-config.vue b/apps/web-antd/src/views/iot/rule/scene/form/configs/alert-config.vue index 5d829a6de..10b8ea04f 100644 --- a/apps/web-antd/src/views/iot/rule/scene/form/configs/alert-config.vue +++ b/apps/web-antd/src/views/iot/rule/scene/form/configs/alert-config.vue @@ -28,7 +28,8 @@ function handleChange(value?: any) { emit('update:modelValue', value); } -// TODO @AI:这个是不是 antd + vue 也使用这个接口?要不增加一个 simple-list 接口? +// TODO DONE @AI:当前 antd + vue3+ep 都用同一个接口,无需 simple-list +// TODO @AI:那就修复这个。后端增加接口,antd 和 vue3 + ep 都改; /** 加载告警配置列表 */ async function loadAlertConfigs() { loading.value = true; diff --git a/apps/web-antd/src/views/iot/rule/scene/form/configs/device-control-config.vue b/apps/web-antd/src/views/iot/rule/scene/form/configs/device-control-config.vue index f02275060..51b09ee6c 100644 --- a/apps/web-antd/src/views/iot/rule/scene/form/configs/device-control-config.vue +++ b/apps/web-antd/src/views/iot/rule/scene/form/configs/device-control-config.vue @@ -52,8 +52,7 @@ const paramsValue = computed({ }, set: (value: string) => { // 直接保存为 JSON 字符串,不进行解析转换 - // TODO @AI:这里有 linter 报错 - action.value.params = value.trim() || ''; + action.value.params = (value.trim() || '') as any; }, }); @@ -82,8 +81,8 @@ function handleProductChange(productId?: number) { if (action.value.productId !== productId) { action.value.deviceId = undefined; action.value.identifier = undefined; // 清空服务标识符 - // TODO @AI:这里有 linter 报错 - action.value.params = ''; // 清空参数,保存为空字符串 + // TODO DONE @AI:这里有 linter 报错 + action.value.params = '' as any; // 清空参数,保存为空字符串 selectedService.value = null; // 清空选中的服务 serviceList.value = []; // 清空服务列表 } @@ -105,8 +104,8 @@ function handleProductChange(productId?: number) { function handleDeviceChange(deviceId?: number) { // 当设备变化时,清空参数配置 if (action.value.deviceId !== deviceId) { - // TODO @AI:这里有 linter 报错 - action.value.params = ''; // 清空参数,保存为空字符串 + // TODO DONE @AI:这里有 linter 报错 + action.value.params = '' as any; // 清空参数,保存为空字符串 } } @@ -121,16 +120,16 @@ function handleServiceChange(serviceIdentifier?: any) { selectedService.value = service; // 当服务变化时,清空参数配置 - action.value.params = ''; + action.value.params = '' as any; // 如果选择了服务且有输入参数,生成默认参数结构 if (service && service.inputParams && service.inputParams.length > 0) { - const defaultParams = {}; + const defaultParams: Record = {}; service.inputParams.forEach((param) => { - defaultParams[param.identifier] = getDefaultValueForParam(param); + defaultParams[param.identifier!] = getDefaultValueForParam(param); }); // 将默认参数转换为 JSON 字符串保存 - action.value.params = JSON.stringify(defaultParams, null, 2); + action.value.params = JSON.stringify(defaultParams, null, 2) as any; } } @@ -139,7 +138,7 @@ function handleServiceChange(serviceIdentifier?: any) { * @param productId 产品ID * @returns 物模型TSL数据 */ -async function getThingModelTSL(productId: number) { +async function getThingModelTSL(productId: number): Promise { if (!productId) return null; try { @@ -164,7 +163,7 @@ async function loadThingModelProperties(productId: number) { loadingThingModel.value = true; const tslData = await getThingModelTSL(productId); - // TODO @AI:这里有 linter 报错 + // TODO DONE @AI:这里有 linter 报错 if (!tslData?.properties) { thingModelProperties.value = []; return; @@ -199,13 +198,13 @@ async function loadServiceList(productId: number) { loadingServices.value = true; const tslData = await getThingModelTSL(productId); - // TODO @AI:这里有 linter 报错 + // TODO DONE @AI:这里有 linter 报错 if (!tslData?.services) { serviceList.value = []; return; } - // TODO @AI:这里有 linter 报错 + // TODO DONE @AI:这里有 linter 报错 serviceList.value = tslData.services; } catch (error) { console.error('加载服务列表失败:', error); diff --git a/apps/web-antd/src/views/iot/rule/scene/form/configs/device-trigger-config.vue b/apps/web-antd/src/views/iot/rule/scene/form/configs/device-trigger-config.vue index e68c3fef7..b76f642a8 100644 --- a/apps/web-antd/src/views/iot/rule/scene/form/configs/device-trigger-config.vue +++ b/apps/web-antd/src/views/iot/rule/scene/form/configs/device-trigger-config.vue @@ -43,7 +43,7 @@ function updateCondition(condition: RuleSceneApi.Trigger) { * @param type 触发器类型 */ function handleTriggerTypeChange(type: number) { - trigger.value.type = type.toString(); + trigger.value.type = type; emit('triggerTypeChange', type); } @@ -120,11 +120,10 @@ function removeConditionGroup() { - @@ -229,7 +228,7 @@ function removeConditionGroup() { @update:model-value=" (value) => updateSubGroup(subGroupIndex, value) " - :trigger-type="trigger.type" + :trigger-type="(trigger.type as number)" :max-conditions="maxConditionsPerGroup" /> diff --git a/apps/web-antd/src/views/iot/rule/scene/form/configs/main-condition-inner-config.vue b/apps/web-antd/src/views/iot/rule/scene/form/configs/main-condition-inner-config.vue index 1da332a92..2e0d73b88 100644 --- a/apps/web-antd/src/views/iot/rule/scene/form/configs/main-condition-inner-config.vue +++ b/apps/web-antd/src/views/iot/rule/scene/form/configs/main-condition-inner-config.vue @@ -176,10 +176,9 @@ function handlePropertyChange(propertyInfo: any) {
-