Browse Source

feat:【IoT 物联网】为所属产品添加链接,支持跳转到产品详情页面

YunaiV 10 months ago
parent
commit
79d8616510
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/views/iot/device/device/index.vue

+ 10 - 3
src/views/iot/device/device/index.vue

@@ -199,9 +199,9 @@
                 <div class="flex-1">
                   <div class="mb-2.5 last:mb-0">
                     <span class="text-[#717c8e] mr-2.5">所属产品</span>
-                    <span class="text-[#0070ff]">
+                    <el-link class="text-[#0070ff]" @click="openProductDetail(item.productId)">
                       {{ products.find((p) => p.id === item.productId)?.name }}
-                    </span>
+                    </el-link>
                   </div>
                   <div class="mb-2.5 last:mb-0">
                     <span class="text-[#717c8e] mr-2.5">设备类型</span>
@@ -289,7 +289,9 @@
       <el-table-column label="备注名称" align="center" prop="nickname" />
       <el-table-column label="所属产品" align="center" prop="productId">
         <template #default="scope">
-          {{ products.find((p) => p.id === scope.row.productId)?.name || '-' }}
+          <el-link @click="openProductDetail(scope.row.productId)">
+            {{ products.find((p) => p.id === scope.row.productId)?.name || '-' }}
+          </el-link>
         </template>
       </el-table-column>
       <el-table-column label="设备类型" align="center" prop="deviceType">
@@ -442,6 +444,11 @@ const openDetail = (id: number) => {
   push({ name: 'IoTDeviceDetail', params: { id } })
 }
 
+/** 跳转到产品详情页面 */
+const openProductDetail = (productId: number) => {
+  push({ name: 'IoTProductDetail', params: { id: productId } })
+}
+
 /** 删除按钮操作 */
 const handleDelete = async (id: number) => {
   try {