From 2a4c774aca2ab7d52434014ef2892f36c1d40fc1 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 7 Dec 2025 16:36:55 +0800 Subject: [PATCH] =?UTF-8?q?review=EF=BC=9A=E3=80=90antd/ele=E3=80=91?= =?UTF-8?q?=E3=80=90iot=E3=80=91=E4=BB=A3=E7=A0=81=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E7=9A=84=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/iot/device/device/index.vue | 47 ++++++++++--------- .../iot/device/device/modules/card-view.vue | 15 +++--- .../device/device/modules/detail/index.vue | 5 +- .../device/modules/detail/modules/config.vue | 23 ++++----- .../device/modules/detail/modules/message.vue | 2 + .../modules/detail/modules/simulator.vue | 1 + .../modules/detail/modules/sub-device.vue | 2 + .../detail/modules/thing-model-event.vue | 1 + .../modules/thing-model-property-history.vue | 28 +++++------ .../detail/modules/thing-model-property.vue | 1 + .../detail/modules/thing-model-service.vue | 1 + .../views/iot/device/device/modules/form.vue | 10 ++-- .../iot/device/device/modules/group-form.vue | 3 +- .../iot/product/category/modules/form.vue | 1 + .../src/views/iot/product/product/data.ts | 1 + .../src/views/iot/product/product/index.vue | 27 +++++------ .../iot/product/product/modules/card-view.vue | 4 +- .../product/product/modules/detail/index.vue | 1 + .../product/modules/detail/modules/header.vue | 3 +- .../iot/product/product/modules/form.vue | 12 +++-- 20 files changed, 96 insertions(+), 92 deletions(-) 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 153099e79..59ee900d3 100644 --- a/apps/web-antd/src/views/iot/device/device/index.vue +++ b/apps/web-antd/src/views/iot/device/device/index.vue @@ -63,17 +63,17 @@ const [DeviceImportFormModal, deviceImportFormModalApi] = useVbenModal({ destroyOnClose: true, }); -// 搜索参数 -const searchParams = ref({ +const queryParams = ref({ deviceName: '', nickname: '', productId: undefined as number | undefined, deviceType: undefined as number | undefined, status: undefined as number | undefined, groupId: undefined as number | undefined, -}); +}); // 搜索参数 // 获取字典选项 +// TODO @haohao:直接使用 getDictOptions 哈,不用包装方法; const getIntDictOptions = (dictType: string) => { return getDictOptions(dictType, 'number'); }; @@ -81,21 +81,22 @@ const getIntDictOptions = (dictType: string) => { /** 搜索 */ function handleSearch() { if (viewMode.value === 'list') { - gridApi.formApi.setValues(searchParams.value); + gridApi.formApi.setValues(queryParams.value); gridApi.query(); } else { - cardViewRef.value?.search(searchParams.value); + // todo @haohao:改成 query 方法,更统一; + cardViewRef.value?.search(queryParams.value); } } /** 重置 */ function handleReset() { - searchParams.value.deviceName = ''; - searchParams.value.nickname = ''; - searchParams.value.productId = undefined; - searchParams.value.deviceType = undefined; - searchParams.value.status = undefined; - searchParams.value.groupId = undefined; + queryParams.value.deviceName = ''; + queryParams.value.nickname = ''; + queryParams.value.productId = undefined; + queryParams.value.deviceType = undefined; + queryParams.value.status = undefined; + queryParams.value.groupId = undefined; handleSearch(); } @@ -110,7 +111,7 @@ function handleRefresh() { /** 导出表格 */ async function handleExport() { - const data = await exportDeviceExcel(searchParams.value); + const data = await exportDeviceExcel(queryParams.value); downloadFileFromBlobPart({ fileName: '物联网设备.xls', source: data }); } @@ -212,7 +213,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ return await getDevicePage({ pageNo: page.currentPage, pageSize: page.pageSize, - ...searchParams.value, + ...queryParams.value, }); }, }, @@ -238,7 +239,7 @@ onMounted(async () => { // 处理 productId 参数 const { productId } = route.query; if (productId) { - searchParams.value.productId = Number(productId); + queryParams.value.productId = Number(productId); // 自动触发搜索 handleSearch(); } @@ -256,7 +257,7 @@ onMounted(async () => {