From 58f2e2365432079537f08b8413652b308462b452 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 21 May 2026 14:43:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20iot=20=E8=A1=A5=E9=BD=90=20vue3=20?= =?UTF-8?q?=E6=BA=90=E7=BC=BA=E5=A4=B1=E7=9A=84=E8=A1=A8=E5=8D=95=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=EF=BC=88P1=EF=BC=89=20-=20=E7=89=A9=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=9A=E4=B9=89=E3=80=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E3=80=8D=E5=AD=97=E6=AE=B5=E8=A1=A5=20requir?= =?UTF-8?q?ed=20=E5=BF=85=E5=A1=AB=E6=A0=A1=E9=AA=8C=20-=20=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E9=80=89=E6=8B=A9=E5=99=A8=EF=BC=88ProductSelect?= =?UTF-8?q?=EF=BC=89=E8=A1=A5=E6=90=9C=E7=B4=A2=E8=83=BD=E5=8A=9B=EF=BC=9A?= =?UTF-8?q?antd=20=E5=8A=A0=20show-search=20+=20option-filter-prop=20?= =?UTF-8?q?=EF=BC=8Cele=20=E5=8A=A0=20filterable=20-=20=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=20onConfirm=20=E5=A2=9E=E5=8A=A0=20advancedF?= =?UTF-8?q?ormApi.validate()=20=E8=B0=83=E7=94=A8=EF=BC=8C=20=20=20?= =?UTF-8?q?=E5=90=A6=E5=88=99=E9=AB=98=E7=BA=A7=E8=A1=A8=E5=8D=95=EF=BC=88?= =?UTF-8?q?=E5=90=AB=E7=BB=8F=E7=BA=AC=E5=BA=A6=E7=AD=89=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=89=E7=9A=84=20schema=20rules=20=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=20-=20=E8=AE=BE=E5=A4=87=E7=BB=8F=E7=BA=AC?= =?UTF-8?q?=E5=BA=A6=E5=A2=9E=E5=8A=A0=E3=80=8C=E6=88=90=E5=AF=B9=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E3=80=8D=E8=B7=A8=E5=AD=97=E6=AE=B5=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=EF=BC=9A=E4=BB=85=E5=A1=AB=E4=B8=80=E9=A1=B9=E6=97=B6=E7=BB=99?= =?UTF-8?q?=20warning=20=E6=8F=90=E7=A4=BA=EF=BC=8C=20=20=20=E4=B8=8E=20vu?= =?UTF-8?q?e3=20=E6=BA=90=20DeviceForm.vue=20=E8=A1=8C=E4=B8=BA=E5=AF=B9?= =?UTF-8?q?=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/iot/alert/record/data.ts | 2 +- .../views/iot/device/device/modules/form.vue | 20 +++++++++++ .../src/views/iot/home/chart-options.ts | 34 +++++++++++++++---- .../iot/home/modules/message-trend-card.vue | 6 +--- .../iot/product/product/components/select.vue | 2 ++ .../views/iot/thingmodel/modules/property.vue | 6 +++- .../src/views/iot/alert/record/data.ts | 2 +- .../views/iot/device/device/modules/form.vue | 22 ++++++++++++ .../src/views/iot/home/chart-options.ts | 34 +++++++++++++++---- .../iot/home/modules/message-trend-card.vue | 6 +--- .../iot/product/product/components/select.vue | 1 + .../views/iot/thingmodel/modules/property.vue | 6 +++- 12 files changed, 113 insertions(+), 28 deletions(-) diff --git a/apps/web-antd/src/views/iot/alert/record/data.ts b/apps/web-antd/src/views/iot/alert/record/data.ts index 9afdb18a2..2b0643832 100644 --- a/apps/web-antd/src/views/iot/alert/record/data.ts +++ b/apps/web-antd/src/views/iot/alert/record/data.ts @@ -75,7 +75,7 @@ export function useGridFormSchema(): VbenFormSchema[] { label: '是否处理', component: 'Select', componentProps: { - options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING), + options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean'), placeholder: '请选择是否处理', allowClear: true, }, 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 82353ae87..a0a0600a6 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 @@ -118,6 +118,26 @@ const [Modal, modalApi] = useVbenModal({ if (!valid) { return; } + // 高级表单:先单独校验,再做经纬度成对填写的跨字段检查 + if (advancedFormApi.isMounted) { + const { valid: advancedValid } = await advancedFormApi.validate(); + if (!advancedValid) { + return; + } + const advValues = await advancedFormApi.getValues(); + const hasLongitude = + advValues.longitude !== undefined && + advValues.longitude !== null && + advValues.longitude !== ''; + const hasLatitude = + advValues.latitude !== undefined && + advValues.latitude !== null && + advValues.latitude !== ''; + if (hasLongitude !== hasLatitude) { + message.warning(hasLongitude ? '请同时填写设备纬度' : '请同时填写设备经度'); + return; + } + } modalApi.lock(); // 合并两个表单的值(字段不冲突,可直接合并) const basicValues = await formApi.getValues(); diff --git a/apps/web-antd/src/views/iot/home/chart-options.ts b/apps/web-antd/src/views/iot/home/chart-options.ts index af5eefa39..8745452ec 100644 --- a/apps/web-antd/src/views/iot/home/chart-options.ts +++ b/apps/web-antd/src/views/iot/home/chart-options.ts @@ -15,7 +15,7 @@ export function getMessageTrendChartOptions( }, }, legend: { - data: ['上行消息', '下行消息'], + data: ['上行消息量', '下行消息量'], top: '5%', }, grid: { @@ -40,11 +40,21 @@ export function getMessageTrendChartOptions( ], series: [ { - name: '上行消息', + name: '上行消息量', type: 'line', smooth: true, areaStyle: { - opacity: 0.3, + color: { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: 'rgba(24, 144, 255, 0.3)' }, + { offset: 1, color: 'rgba(24, 144, 255, 0)' }, + ], + }, }, emphasis: { focus: 'series', @@ -55,11 +65,21 @@ export function getMessageTrendChartOptions( }, }, { - name: '下行消息', + name: '下行消息量', type: 'line', smooth: true, areaStyle: { - opacity: 0.3, + color: { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { offset: 0, color: 'rgba(82, 196, 26, 0.3)' }, + { offset: 1, color: 'rgba(82, 196, 26, 0)' }, + ], + }, }, emphasis: { focus: 'series', @@ -84,8 +104,8 @@ export function getDeviceStateGaugeChartOptions( series: [ { type: 'gauge', - startAngle: 225, - endAngle: -45, + startAngle: 360, + endAngle: 0, min: 0, max, center: ['50%', '50%'], diff --git a/apps/web-antd/src/views/iot/home/modules/message-trend-card.vue b/apps/web-antd/src/views/iot/home/modules/message-trend-card.vue index 21799db0e..bde4b7ba5 100644 --- a/apps/web-antd/src/views/iot/home/modules/message-trend-card.vue +++ b/apps/web-antd/src/views/iot/home/modules/message-trend-card.vue @@ -3,7 +3,7 @@ import type { Dayjs } from 'dayjs'; import type { IotStatisticsApi } from '#/api/iot/statistics'; -import { computed, nextTick, onMounted, reactive, ref } from 'vue'; +import { computed, nextTick, reactive, ref } from 'vue'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; @@ -123,10 +123,6 @@ async function renderChartWhenReady() { initChart(); } -/** 组件挂载时查询数据 */ -onMounted(() => { - fetchMessageData(); -}); diff --git a/apps/web-antd/src/views/iot/thingmodel/modules/property.vue b/apps/web-antd/src/views/iot/thingmodel/modules/property.vue index 622b5f428..85ac7b322 100644 --- a/apps/web-antd/src/views/iot/thingmodel/modules/property.vue +++ b/apps/web-antd/src/views/iot/thingmodel/modules/property.vue @@ -102,7 +102,11 @@ if (!props.isStructDataSpecs && !props.isParams) {