feat: 【IoT 物联网】产品详情添加路由参数处理以支持跳转到设备管理根据产品查询

This commit is contained in:
haohao
2025-10-24 22:33:16 +08:00
parent 9fb17e3235
commit b1a0da9b1c
2 changed files with 9 additions and 2 deletions

View File

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

View File

@ -72,7 +72,7 @@ const copyToClipboard = async (text: string) => {
/** 路由跳转到设备管理 */ /** 路由跳转到设备管理 */
const { push } = useRouter() const { push } = useRouter()
const goToDeviceList = (productId: number) => { const goToDeviceList = (productId: number) => {
push({ name: 'IoTDevice', params: { productId } }) push({ name: 'IoTDevice', query: { productId } })
} }
/** 修改操作 */ /** 修改操作 */