From 7c198ea84c75e9d549b7c4fa4875c4020f327d28 Mon Sep 17 00:00:00 2001 From: hnlc <15321852+zhb3901@user.noreply.gitee.com> Date: Tue, 30 Sep 2025 11:18:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E3=80=90IoT=20=E7=89=A9=E8=81=94?= =?UTF-8?q?=E7=BD=91=E3=80=91=E4=BF=AE=E5=A4=8D=E4=BA=A7=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=89=8D=E5=BE=80=E7=AE=A1=E7=90=86=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=AE=BE=E5=A4=87=E6=97=A0=E6=B3=95=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E5=88=86=E7=B1=BB=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/iot/device/device/index.vue | 15 ++++++++++++++- .../product/detail/ProductDetailsHeader.vue | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/views/iot/device/device/index.vue b/src/views/iot/device/device/index.vue index 56139be9a..2b02f9430 100644 --- a/src/views/iot/device/device/index.vue +++ b/src/views/iot/device/device/index.vue @@ -406,7 +406,17 @@ const selectedIds = ref([]) // 选中的设备编号数组 const viewMode = ref<'card' | 'list'>('card') // 视图模式状态 const defaultPicUrl = ref('/src/assets/imgs/iot/device.png') // 默认设备图片 const defaultIconUrl = ref('/src/assets/svgs/iot/card-fill.svg') // 默认设备图标 - +const route = useRoute() +/** 监听传过来的参数 */ +const stopWatch = watch( + () => route.query.productId, + (newId) => { + if (newId) { + queryParams.productId = Number(newId) as any + } + }, + { immediate: true } +) /** 查询列表 */ const getList = async () => { loading.value = true @@ -520,4 +530,7 @@ onMounted(async () => { // 获取分组列表 deviceGroups.value = await DeviceGroupApi.getSimpleDeviceGroupList() }) +onBeforeUnmount(() => { + stopWatch.stop() +}) diff --git a/src/views/iot/product/product/detail/ProductDetailsHeader.vue b/src/views/iot/product/product/detail/ProductDetailsHeader.vue index 919006477..3eb999fa4 100644 --- a/src/views/iot/product/product/detail/ProductDetailsHeader.vue +++ b/src/views/iot/product/product/detail/ProductDetailsHeader.vue @@ -72,7 +72,7 @@ const copyToClipboard = async (text: string) => { /** 路由跳转到设备管理 */ const { push } = useRouter() const goToDeviceList = (productId: number) => { - push({ name: 'IoTDevice', params: { productId } }) + push({ name: 'IoTDevice', query: { productId } }) } /** 修改操作 */ -- Gitee