diff --git a/src/views/iot/device/device/index.vue b/src/views/iot/device/device/index.vue index 42cc0438c..c9d9d826f 100644 --- a/src/views/iot/device/device/index.vue +++ b/src/views/iot/device/device/index.vue @@ -384,6 +384,7 @@ defineOptions({ name: 'IoTDevice' }) const message = useMessage() // 消息弹窗 const { t } = useI18n() // 国际化 +const route = useRoute() // 路由对象 const loading = ref(true) // 列表加载中 const list = ref([]) // 列表的数据 @@ -392,7 +393,7 @@ const queryParams = reactive({ pageNo: 1, pageSize: 10, deviceName: undefined, - productId: undefined, + productId: undefined as number | undefined, deviceType: undefined, nickname: undefined, status: undefined, @@ -513,6 +514,12 @@ const handleImport = () => { /** 初始化 **/ onMounted(async () => { + // 处理路由参数中的 productId + const productId = route.query.productId + if (productId) { + queryParams.productId = Number(productId) + } + getList() // 获取产品列表 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 } }) } /** 修改操作 */