fix:【修复】产品跳转到设备列表时,productId 未传递的问题,对应 https://t.zsxq.com/jvXyq

This commit is contained in:
YunaiV
2025-10-02 11:25:34 +08:00
parent 62a9a99146
commit bdb42bb927
2 changed files with 9 additions and 3 deletions

View File

@ -384,6 +384,7 @@ defineOptions({ name: 'IoTDevice' })
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
const route = useRoute()
const loading = ref(true) // 列表加载中
const list = ref<DeviceVO[]>([]) // 列表的数据
@ -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,7 +514,12 @@ const handleImport = () => {
/** 初始化 **/
onMounted(async () => {
getList()
// 处理 productId 参数
const { productId } = route.query
if (productId) {
queryParams.productId = Number(productId)
}
await getList()
// 获取产品列表
products.value = await ProductApi.getSimpleProductList()

View File

@ -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 } })
}
/** 修改操作 */