diff --git a/src/views/iot/device/device/index.vue b/src/views/iot/device/device/index.vue index 56139be9ab652e46e8fbcba06d9acf9f3252722a..2b02f943065d0cdca380a4dc7746779a8d8cb1aa 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 91900647771b79cfa96ad775d6da7121a4d15836..3eb999fa40c60f804fb237603a1b2efb544eb065 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 } }) } /** 修改操作 */