feat: 【IoT 物联网】产品详情添加路由参数处理以支持跳转到设备管理根据产品查询
This commit is contained in:
@ -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,6 +514,12 @@ const handleImport = () => {
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
// 处理路由参数中的 productId
|
||||
const productId = route.query.productId
|
||||
if (productId) {
|
||||
queryParams.productId = Number(productId)
|
||||
}
|
||||
|
||||
getList()
|
||||
|
||||
// 获取产品列表
|
||||
|
||||
@ -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 } })
|
||||
}
|
||||
|
||||
/** 修改操作 */
|
||||
|
||||
Reference in New Issue
Block a user