diff --git a/src/views/devices/DeviceStatus.vue b/src/views/devices/DeviceStatus.vue
index 5685564..a6d947d 100644
--- a/src/views/devices/DeviceStatus.vue
+++ b/src/views/devices/DeviceStatus.vue
@@ -15,22 +15,20 @@
-
- 可用: {{ stats.availableCount }}
- {{ availableDevices.join(', ') }}
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
- {{ row.available ? '是' : '否' }}
+ {{ row.preview }}
@@ -52,15 +50,17 @@ const loading = ref(false)
const autoRefresh = ref(true)
const timer = ref(null)
-const stats = reactive({ totalDevices: 0, availableCount: 0 })
-const availableDevices = ref([])
-const devicesMap = ref({})
+const stats = reactive({ totalDevices: 0, runningCount: 0, usingCount: 0, idleCooldownCount: 0, idleFreeCount: 0 })
+const categoryToDevices = ref({})
-const tableData = computed(() => {
- const map = devicesMap.value || {}
- return Object.values(map).sort((a, b) => {
- if (a.series === b.series) return a.index - b.index
- return String(a.series).localeCompare(String(b.series))
+const categoryOrder = ['RUNNING', 'USING', 'IDLE_COOLDOWN', 'IDLE_FREE']
+const categoryLabelMap = { RUNNING: '已占用', USING: '使用中', IDLE_COOLDOWN: '冷却空闲', IDLE_FREE: '空闲' }
+const categoryRows = computed(() => {
+ const map = categoryToDevices.value || {}
+ return categoryOrder.map(key => {
+ const devices = Array.isArray(map[key]) ? map[key] : []
+ const preview = devices.join(', ')
+ return { key, label: categoryLabelMap[key] || key, count: devices.length, devices, preview }
})
})
@@ -69,10 +69,12 @@ async function fetchData() {
try {
loading.value = true
const data = await getAllDeviceStatus()
- devicesMap.value = data?.devices || {}
- availableDevices.value = data?.availableDevices || []
- stats.totalDevices = data?.totalDevices || Object.keys(devicesMap.value).length
- stats.availableCount = data?.availableCount || availableDevices.value.length
+ categoryToDevices.value = data?.categoryToDevices || {}
+ stats.totalDevices = data?.totalDevices ?? 0
+ stats.runningCount = data?.runningCount ?? (categoryToDevices.value['RUNNING']?.length || 0)
+ stats.usingCount = data?.usingCount ?? (categoryToDevices.value['USING']?.length || 0)
+ stats.idleCooldownCount = data?.idleCooldownCount ?? (categoryToDevices.value['IDLE_COOLDOWN']?.length || 0)
+ stats.idleFreeCount = data?.idleFreeCount ?? (categoryToDevices.value['IDLE_FREE']?.length || 0)
} finally {
loading.value = false
}
@@ -113,7 +115,7 @@ onUnmounted(() => {
.actions { display: flex; gap: 12px; align-items: center; }
.stats { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.inline-tag { height: 24px; align-items: center; }
-.table-card { }
+.devices-list { white-space: normal; word-break: break-all; line-height: 1.6; }
@media (max-width: 768px) {
.title { font-size: 20px; }