From 66843f239232fbb45dc349a295ea0b515618f762 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 21 May 2026 18:46:59 +0800 Subject: [PATCH] =?UTF-8?q?chore(iot):=20=E6=95=B0=E7=BB=84=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E7=BC=A9=E5=86=99=E5=8F=82=E6=95=B0=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E4=B8=BA=E5=AE=8C=E6=95=B4=E4=B8=9A=E5=8A=A1=E5=91=BD=E5=90=8D?= =?UTF-8?q?=20-=20products.find((p))=20=E2=86=92=20((product))=EF=BC=8Cpro?= =?UTF-8?q?pertyList.find((p))=20=E2=86=92=20((property))=20=20=20?= =?UTF-8?q?=E7=AD=89=EF=BC=9A=E6=8A=8A=20.find=20/=20.filter=20/=20.map=20?= =?UTF-8?q?/=20.reduce=20=E7=9A=84=E5=8D=95=E5=AD=97=E6=AF=8D=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E5=8F=82=E6=95=B0=20(p=20/=20d=20/=20s=20/=20g=20/=20?= =?UTF-8?q?v=20=20=20/=20acc=20/=20val)=20=E5=85=A8=E9=83=A8=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E4=B8=BA=20product=20/=20device=20/=20service=20/=20g?= =?UTF-8?q?roup=20/=20value=20/=20=20=20total=20=E7=AD=89=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E5=91=BD=E5=90=8D=20-=20=E6=B6=89=E5=8F=8A=20web-antd?= =?UTF-8?q?=20=E4=B8=8E=20web-ele=20=E4=B8=A4=E4=BE=A7=20=EF=BC=9Adevice?= =?UTF-8?q?=20=E5=88=97=E8=A1=A8=20/=20=E5=8D=A1=E7=89=87=20/=20=E7=89=A9?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=B1=9E=E6=80=A7=E5=8E=86=E5=8F=B2=20/=20?= =?UTF-8?q?=20=20ota=20=E5=9B=BA=E4=BB=B6=20/=20=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=99=A8=E6=9C=8D=E5=8A=A1=E9=80=89=E6=8B=A9?= =?UTF-8?q?=20/=20=E5=B1=9E=E6=80=A7=E9=80=89=E6=8B=A9=E5=99=A8=20/=20?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E9=80=89=E6=8B=A9=E7=BB=84=E4=BB=B6=20-=20?= =?UTF-8?q?=E5=A4=96=E5=B1=82=E5=B7=B2=E7=BB=91=E5=AE=9A=E5=90=8C=E5=90=8D?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E7=9A=84=E5=9C=BA=E6=99=AF=EF=BC=8C=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E5=BD=A2=E5=8F=82=E7=94=A8=20item=20=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=91=BD=E5=90=8D=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/adapter/form.ts | 1 + .../modules/thing-model-property-history.vue | 8 ++-- .../src/views/iot/device/device/index.vue | 7 +++- .../views/iot/device/device/modules/form.vue | 2 +- .../src/views/iot/ota/firmware/data.ts | 4 +- .../iot/product/product/components/select.vue | 7 +++- .../form/configs/device-control-config.vue | 4 +- .../form/selectors/property-selector.vue | 8 +++- apps/web-ele/src/adapter/form.ts | 1 + .../modules/thing-model-property-history.vue | 8 ++-- .../detail/modules/thing-model-property.vue | 4 +- .../src/views/iot/device/device/index.vue | 9 ++-- .../iot/device/device/modules/card-view.vue | 2 +- .../views/iot/device/device/modules/form.vue | 2 +- .../src/views/iot/ota/firmware/data.ts | 4 +- .../src/views/iot/ota/firmware/index.vue | 6 +-- apps/web-ele/src/views/iot/ota/task/data.ts | 4 +- apps/web-ele/src/views/iot/rule/scene/data.ts | 6 +-- .../configs/current-time-condition-config.vue | 6 +-- .../form/configs/device-control-config.vue | 4 +- .../configs/main-condition-inner-config.vue | 4 +- .../configs/sub-condition-group-config.vue | 8 ++-- .../scene/form/inputs/json-params-input.vue | 25 ++++++----- .../rule/scene/form/inputs/value-input.vue | 6 +-- .../scene/form/sections/action-section.vue | 27 ++++++++---- .../form/sections/basic-info-section.vue | 15 +++++-- .../scene/form/sections/trigger-section.vue | 30 ++++++++----- .../scene/form/selectors/device-selector.vue | 6 ++- .../form/selectors/operator-selector.vue | 6 +-- .../scene/form/selectors/product-selector.vue | 6 ++- .../form/selectors/property-selector.vue | 42 ++++++++++--------- packages/constants/src/biz-iot-enum.ts | 2 +- 32 files changed, 169 insertions(+), 105 deletions(-) diff --git a/apps/web-antd/src/adapter/form.ts b/apps/web-antd/src/adapter/form.ts index b386c3860..0d5bb167b 100644 --- a/apps/web-antd/src/adapter/form.ts +++ b/apps/web-antd/src/adapter/form.ts @@ -65,5 +65,6 @@ const useVbenForm = useForm; export { initSetupVbenForm, useVbenForm, z }; +export type VbenFormApi = ReturnType[1]; // add by 芋艿:用于 data.ts 表单 schema 内调用 setFieldValue export type VbenFormSchema = FormSchema; export type VbenFormProps = FormProps; diff --git a/apps/web-antd/src/views/iot/device/device/detail/modules/thing-model-property-history.vue b/apps/web-antd/src/views/iot/device/device/detail/modules/thing-model-property-history.vue index db252d76a..73fc51173 100644 --- a/apps/web-antd/src/views/iot/device/device/detail/modules/thing-model-property-history.vue +++ b/apps/web-antd/src/views/iot/device/device/detail/modules/thing-model-property-history.vue @@ -85,7 +85,7 @@ const maxValue = computed(() => { if (!canShowChart.value || list.value.length === 0) return '-'; const values = list.value .map((item) => Number(item.value)) - .filter((v) => !Number.isNaN(v)); + .filter((value) => !Number.isNaN(value)); return values.length > 0 ? Math.max(...values).toFixed(2) : '-'; }); @@ -94,7 +94,7 @@ const minValue = computed(() => { if (!canShowChart.value || list.value.length === 0) return '-'; const values = list.value .map((item) => Number(item.value)) - .filter((v) => !Number.isNaN(v)); + .filter((value) => !Number.isNaN(value)); return values.length > 0 ? Math.min(...values).toFixed(2) : '-'; }); @@ -103,9 +103,9 @@ const avgValue = computed(() => { if (!canShowChart.value || list.value.length === 0) return '-'; const values = list.value .map((item) => Number(item.value)) - .filter((v) => !Number.isNaN(v)); + .filter((value) => !Number.isNaN(value)); if (values.length === 0) return '-'; - const sum = values.reduce((acc, val) => acc + val, 0); + const sum = values.reduce((total, value) => total + value, 0); return (sum / values.length).toFixed(2); }); diff --git a/apps/web-antd/src/views/iot/device/device/index.vue b/apps/web-antd/src/views/iot/device/device/index.vue index dec1bd13e..4d21ca3bf 100644 --- a/apps/web-antd/src/views/iot/device/device/index.vue +++ b/apps/web-antd/src/views/iot/device/device/index.vue @@ -434,7 +434,10 @@ onMounted(async () => { class="cursor-pointer text-primary" @click="openProductDetail(row.productId)" > - {{ products.find((p) => p.id === row.productId)?.name || '-' }} + {{ + products.find((product) => product.id === row.productId)?.name || + '-' + }} - diff --git a/apps/web-antd/src/views/iot/device/device/modules/form.vue b/apps/web-antd/src/views/iot/device/device/modules/form.vue index a0a0600a6..12c4a2a52 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/form.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/form.vue @@ -48,7 +48,7 @@ const [Form, formApi] = useVbenForm({ return; } // 从产品列表中查找产品 - const product = products.value.find((p) => p.id === productId); + const product = products.value.find((item) => item.id === productId); if (product?.deviceType !== undefined) { await formApi.setFieldValue('deviceType', product.deviceType); } diff --git a/apps/web-antd/src/views/iot/ota/firmware/data.ts b/apps/web-antd/src/views/iot/ota/firmware/data.ts index 9d0801ca7..02dd85b8d 100644 --- a/apps/web-antd/src/views/iot/ota/firmware/data.ts +++ b/apps/web-antd/src/views/iot/ota/firmware/data.ts @@ -17,7 +17,9 @@ export function getProductName(productId?: number): string { if (!productId) { return '-'; } - return productList.find((p) => p.id === productId)?.name || '-'; + return ( + productList.find((product) => product.id === productId)?.name || '-' + ); } /** 固件详情的描述字段 */ diff --git a/apps/web-antd/src/views/iot/product/product/components/select.vue b/apps/web-antd/src/views/iot/product/product/components/select.vue index 45bdcde3a..b73a8b9ce 100644 --- a/apps/web-antd/src/views/iot/product/product/components/select.vue +++ b/apps/web-antd/src/views/iot/product/product/components/select.vue @@ -47,7 +47,12 @@ onMounted(() => { diff --git a/apps/web-ele/src/views/iot/rule/scene/form/configs/sub-condition-group-config.vue b/apps/web-ele/src/views/iot/rule/scene/form/configs/sub-condition-group-config.vue index 222ded1ed..23f6dca9d 100644 --- a/apps/web-ele/src/views/iot/rule/scene/form/configs/sub-condition-group-config.vue +++ b/apps/web-ele/src/views/iot/rule/scene/form/configs/sub-condition-group-config.vue @@ -89,8 +89,8 @@ function updateCondition(
- -
+ +

暂无条件

点击下方按钮添加第一个条件

@@ -121,7 +121,7 @@ function updateCondition( > {{ conditionIndex + 1 }}
- + 条件 {{ conditionIndex + 1 }}
@@ -161,7 +161,7 @@ function updateCondition( 继续添加条件 - + 最多可添加 {{ maxConditions }} 个条件
diff --git a/apps/web-ele/src/views/iot/rule/scene/form/inputs/json-params-input.vue b/apps/web-ele/src/views/iot/rule/scene/form/inputs/json-params-input.vue index cbfc9aea6..6715d6f5b 100644 --- a/apps/web-ele/src/views/iot/rule/scene/form/inputs/json-params-input.vue +++ b/apps/web-ele/src/views/iot/rule/scene/form/inputs/json-params-input.vue @@ -450,8 +450,11 @@ watch(
- - + + {{ title }}
@@ -462,9 +465,9 @@ watch(
- + {{ paramsLabel }}
@@ -475,7 +478,7 @@ watch( class="flex items-center justify-between rounded-lg bg-card p-2" >
-
+
{{ param.name }}
-
+
{{ param.identifier }}
@@ -494,7 +497,7 @@ watch( {{ getParamTypeName(param.dataType) }} - + {{ getExampleValue(param) }}
@@ -502,11 +505,11 @@ watch(
-
+
{{ JSON_PARAMS_INPUT_CONSTANTS.COMPLETE_JSON_FORMAT }}
                       {{ generateExampleJson() }}
                     
@@ -516,7 +519,7 @@ watch(
-

+

{{ emptyMessage }}

@@ -550,7 +553,7 @@ watch(
- + {{ JSON_PARAMS_INPUT_CONSTANTS.QUICK_FILL_LABEL }} diff --git a/apps/web-ele/src/views/iot/rule/scene/form/inputs/value-input.vue b/apps/web-ele/src/views/iot/rule/scene/form/inputs/value-input.vue index 673cefc39..78ed75a2b 100644 --- a/apps/web-ele/src/views/iot/rule/scene/form/inputs/value-input.vue +++ b/apps/web-ele/src/views/iot/rule/scene/form/inputs/value-input.vue @@ -205,7 +205,7 @@ watch( class="min-w-0 flex-1" style="width: auto !important" /> - + - 解析结果: + 解析结果: - + {{ propertyConfig.unit }} diff --git a/apps/web-ele/src/views/iot/rule/scene/form/sections/action-section.vue b/apps/web-ele/src/views/iot/rule/scene/form/sections/action-section.vue index d5a5af9d5..3d9fee3db 100644 --- a/apps/web-ele/src/views/iot/rule/scene/form/sections/action-section.vue +++ b/apps/web-ele/src/views/iot/rule/scene/form/sections/action-section.vue @@ -156,12 +156,20 @@ function onActionTypeChange(action: RuleSceneApi.Action, type: number) {