<template> <div class="container"> <Breadcrumb :items="['物联网管理', '设备管理', '设备详情']" /> <a-card class="general-card" title=" "> <a-descriptions v-model="renderData" size="large"> <template #title><h3 style="margin-top: -15px"><a-button class="nav-btn" type="outline" :shape="'circle'" @click="() => $router.go(-1)" > <icon-undo /> </a-button> 设备详情</h3> </template> <a-descriptions-item label="设备名称">{{renderData.name }}</a-descriptions-item> <a-descriptions-item label="硬件版本">{{renderData.hardwareVersion }}</a-descriptions-item> <a-descriptions-item label="固件版本">{{renderData.firmwareVersion }}</a-descriptions-item> <a-descriptions-item label="所属产品">{{renderData.productId }}</a-descriptions-item> <!-- <a-descriptions-item label="备注">{{renderData.remark }}</a-descriptions-item>--> <a-descriptions-item label="创建时间">{{dayjs(renderData.createTime).format('YYYY-MM-DD HH:mm:ss') }}</a-descriptions-item> </a-descriptions> </a-card> <a-card class="general-card" style="margin-top: 10px"> <a-tabs :active-key="activeKey" @tab-click="handleMenuClick" style="padding-top: 20px"> <a-tab-pane key="1" tab="参数" title="扩展属性"> <a-table :columns="columns" :data="renderData.extendParams" /> </a-tab-pane> <a-tab-pane key="2" tab="基本信息" title="基本信息"> 基本信息 </a-tab-pane> <a-tab-pane key="3" tab="执行服务" title="执行服务"> 执行服务内容 </a-tab-pane> </a-tabs> </a-card> </div> </template> <script lang="ts" setup> import dayjs from 'dayjs'; import { useRoute } from 'vue-router'; import { onMounted, ref } from 'vue'; import { queryDeviceDetail } from '@/api/device'; const route = useRoute(); const id = Number(route.params.id); const columns = [ { title: '参数名称', dataIndex: 'name', slotName: 'name', }, { title: '参数标识', dataIndex: 'identifier', slotName: 'identifier', }, { title: '数据类型', dataIndex: 'dataType', slotName: 'dataType', }, { title: '参数类型', dataIndex: 'type', slotName: 'type', }, ]; const activeKey = ref('1'); const renderData = ref([]); const fetchData = async (Id: number) => { const res = await queryDeviceDetail(Id); renderData.value = res.data; }; const handleMenuClick = (e: any) => { activeKey.value = e; }; onMounted(() => { fetchData(id); }); </script> <style scoped> .container { padding: 0 20px 20px 20px; } h1 { font-size: 24px; margin-bottom: 10px; } .meta span { margin-right: 20px; } .attachments li { margin-bottom: 10px; } .attachments a { display: flex; align-items: center; font-size: 14px; color: #1890ff; text-decoration: none; } .attachments a:hover { text-decoration: underline; } .nav-btn { border-color: rgb(var(--gray-2)); color: rgb(var(--gray-8)); font-size: 16px; } </style>