From 827bb69f22d21af4db580f2edb1a3d6210189ae4 Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Tue, 25 Feb 2025 22:00:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(iot):=20=E5=A2=9E=E5=8A=A0=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=89=80=E5=B1=9E=E4=BA=A7=E5=93=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=B9=B6=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在设备详情页面添加所属产品信息展示,包括产品名称、类型、型号、通讯协议等 - 实现设备和产品名称的模糊搜索功能 - 优化设备列表查询,改用名称搜索替代原有列表查询方式 -修复产品 TSL 页面权限控制错误 --- .../iot/device/components/device-detail.vue | 46 ++++++++++++------- src/views/iot/device/index.vue | 10 ++-- .../deviceCard/components/device-detail.vue | 26 ++++++++++- src/views/iot/deviceCard/index.vue | 41 +++++++++++++++-- .../iot/product/components/product-tsl.vue | 4 +- .../notice/components/message-edit.vue | 20 ++++---- 6 files changed, 106 insertions(+), 41 deletions(-) diff --git a/src/views/iot/device/components/device-detail.vue b/src/views/iot/device/components/device-detail.vue index 05bd629..9a79d29 100644 --- a/src/views/iot/device/components/device-detail.vue +++ b/src/views/iot/device/components/device-detail.vue @@ -16,22 +16,12 @@ 设备详情 - {{ - renderData.name - }} - {{ - renderData.hardwareVersion - }} - {{ - renderData.firmwareVersion - }} - {{ - renderData.productId - }} + {{ renderData.name }} + {{ renderData.hardwareVersion }} + {{ renderData.firmwareVersion }} + {{ renderData.productId }} - {{ - dayjs(renderData.createTime).format('YYYY-MM-DD HH:mm:ss') - }} + {{dayjs(renderData.createTime).format('YYYY-MM-DD HH:mm:ss') }} @@ -44,7 +34,31 @@ - 基本信息 + + + + {{ + renderData.productName + }} + {{ + renderData.productType + }} + {{ + renderData.model + }} + {{ + renderData.link + }} + {{ + renderData.remark + }} + {{ + dayjs(renderData.createTime).format('YYYY-MM-DD HH:mm:ss') + }} + + 执行服务内容 diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 2ec657e..f1a65b2 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -32,7 +32,7 @@ - {{ + {{ item.name }} @@ -242,7 +242,7 @@ name: '', status: '', isOnline: '', - productName: '', + productId: '', }; }; @@ -338,10 +338,8 @@ window.setTimeout(async () => { const res = await queryDeviceByName({ name: value, - page: 1, - size: 5, }); - options.value = res.data.records.map((item: any) => { + options.value = res.data.map((item: any) => { return { id: item.id, name: item.name, diff --git a/src/views/iot/deviceCard/components/device-detail.vue b/src/views/iot/deviceCard/components/device-detail.vue index 77e9ce3..f799a54 100644 --- a/src/views/iot/deviceCard/components/device-detail.vue +++ b/src/views/iot/deviceCard/components/device-detail.vue @@ -43,7 +43,31 @@ - 基本信息 + + + + {{ + renderData.productName + }} + {{ + renderData.productType + }} + {{ + renderData.model + }} + {{ + renderData.link + }} + {{ + renderData.remark + }} + {{ + dayjs(renderData.createTime).format('YYYY-MM-DD HH:mm:ss') + }} + + 执行服务内容 diff --git a/src/views/iot/deviceCard/index.vue b/src/views/iot/deviceCard/index.vue index c486e13..398ee9f 100644 --- a/src/views/iot/deviceCard/index.vue +++ b/src/views/iot/deviceCard/index.vue @@ -30,13 +30,20 @@ - + + @search="handleSearch" + > + {{ + item.name + }} + @@ -131,7 +138,7 @@ import useLoading from '@/hooks/loading'; import usePagination from '@/hooks/pagination'; import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface'; - import { DeviceRecord, queryDeviceList } from '@/api/device'; + import { DeviceRecord, queryDeviceByName, queryDeviceList } from '@/api/device'; import DeviceEdit from '@/views/iot/deviceCard/components/device-edit.vue'; import CardWrap from './components/card-wrap.vue'; @@ -140,6 +147,7 @@ name: '', status: '', isOnline: '', + productId: '', }; }; @@ -147,6 +155,7 @@ const { pagination, setPagination } = usePagination(); const renderData = ref<[]>([]); const formModel = ref(generateFormModel()); + const options = ref([]); const statusOptions = computed(() => [ { @@ -190,6 +199,28 @@ } as unknown as DeviceRecord); }; + // 搜索 + const handleSearch = (value: any) => { + if (value) { + loading.value = true; + options.value = []; + window.setTimeout(async () => { + const res = await queryDeviceByName({ + name: value, + }); + options.value = res.data.map((item: any) => { + return { + id: item.id, + name: item.name, + }; + }); + loading.value = false; + }, 1000); + } else { + options.value = []; + } + }; + // 分页发生改变 const onPageChange = (current: number) => { pagination.value.page = current; diff --git a/src/views/iot/product/components/product-tsl.vue b/src/views/iot/product/components/product-tsl.vue index fada109..a669d2b 100644 --- a/src/views/iot/product/components/product-tsl.vue +++ b/src/views/iot/product/components/product-tsl.vue @@ -41,7 +41,7 @@