Jelajahi Sumber

🐞 fix(设备监控): 修复不是车的设备跳转不了

Zimo 1 Minggu lalu
induk
melakukan
c1156a7c41

+ 1 - 1
src/router/modules/remaining.ts

@@ -532,7 +532,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
         }
       },
       {
-        path: 'tddevice/detail/:id/:ifInline/:carOnline/:time/:name/:code/:dept/:vehicle?',
+        path: 'tddevice/detail',
         component: () => import('@/views/pms/device/monitor/TdDeviceInfo.vue'),
         name: 'TdDeviceDetail',
         meta: {

+ 14 - 12
src/views/pms/device/monitor/TdDeviceInfo.vue

@@ -12,16 +12,18 @@ defineOptions({ name: 'TdDeviceDetail' })
 
 dayjs.extend(quarterOfYear)
 
-const { params } = useRoute()
+const { query } = useRoute()
+
+console.log('query :>> ', query)
 
 const data = ref({
-  deviceCode: params.code || '',
-  deviceName: params.name || '',
-  lastInlineTime: params.time || '',
-  ifInline: params.ifInline || '',
-  dept: params.dept || '',
-  vehicle: params.vehicle || '',
-  carOnline: params.carOnline || ''
+  deviceCode: query.code || '',
+  deviceName: query.name || '',
+  lastInlineTime: query.time || '',
+  ifInline: query.ifInline || '',
+  dept: query.dept || '',
+  vehicle: query.vehicle || '',
+  carOnline: query.carOnline || ''
 })
 
 const disabledIdentifier = ref<string[]>(['online', 'vehicle_name', 'touchScreenDataAccumulate'])
@@ -100,10 +102,10 @@ let minInterval = 0
 
 // 1. 加载 specs
 const loadSpecs = async () => {
-  if (!params.id) return
+  if (!query.id) return
   specsLoading.value = true
-  const res = await IotDeviceApi.getIotDeviceTds(Number(params.id))
-  const zhbdres = await IotDeviceApi.getIotDeviceZHBDTds(Number(params.id))
+  const res = await IotDeviceApi.getIotDeviceTds(Number(query.id))
+  const zhbdres = await IotDeviceApi.getIotDeviceZHBDTds(Number(query.id))
 
   zhbdspecs.value = zhbdres.sort((a, b) => b.modelOrder - a.modelOrder)
   gatewayspecs.value = res.sort((a, b) => b.modelOrder - a.modelOrder)
@@ -365,7 +367,7 @@ onUnmounted(() => {
           离线
         </el-tag>
       </el-form-item>
-      <el-form-item label="中航北斗" class="online" type="plain">
+      <el-form-item v-if="data.carOnline" label="中航北斗" class="online" type="plain">
         <el-tag
           v-if="data.carOnline === 'true'"
           type="success"

+ 3 - 3
src/views/pms/device/monitor/index.vue

@@ -200,7 +200,7 @@
                             item.deviceCode,
                             item.deptName,
                             item.vehicleName,
-                            item.carOnline
+                            item.carOnline ?? ''
                           )
                         "
                       >
@@ -267,7 +267,7 @@
                       scope.row.deviceCode,
                       scope.row.deptName,
                       scope.row.vehicleName,
-                      scope.row.carOnline
+                      scope.row.carOnline ?? ''
                     )
                   "
                 >
@@ -394,7 +394,7 @@ const openDetail = (
   }
   push({
     name: 'TdDeviceDetail',
-    params: { id, ifInline, carOnline, time, name, code, dept, vehicle }
+    query: { id, ifInline, carOnline, time, name, code, dept, vehicle }
   })
 }