From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/iot/home/index.vue | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 110 insertions(+), 0 deletions(-)
diff --git a/src/views/iot/home/index.vue b/src/views/iot/home/index.vue
new file mode 100644
index 0000000..3d60ace
--- /dev/null
+++ b/src/views/iot/home/index.vue
@@ -0,0 +1,110 @@
+<template>
+ <!-- 绗竴琛岋細缁熻鍗$墖琛� -->
+ <el-row :gutter="16" class="mb-4">
+ <el-col :span="6">
+ <ComparisonCard
+ title="鍒嗙被鏁伴噺"
+ :value="statsData.productCategoryCount"
+ :todayCount="statsData.productCategoryTodayCount"
+ icon="ep:menu"
+ iconColor="text-blue-400"
+ :loading="loading"
+ />
+ </el-col>
+ <el-col :span="6">
+ <ComparisonCard
+ title="浜у搧鏁伴噺"
+ :value="statsData.productCount"
+ :todayCount="statsData.productTodayCount"
+ icon="ep:box"
+ iconColor="text-orange-400"
+ :loading="loading"
+ />
+ </el-col>
+ <el-col :span="6">
+ <ComparisonCard
+ title="璁惧鏁伴噺"
+ :value="statsData.deviceCount"
+ :todayCount="statsData.deviceTodayCount"
+ icon="ep:cpu"
+ iconColor="text-purple-400"
+ :loading="loading"
+ />
+ </el-col>
+ <el-col :span="6">
+ <ComparisonCard
+ title="璁惧娑堟伅鏁�"
+ :value="statsData.deviceMessageCount"
+ :todayCount="statsData.deviceMessageTodayCount"
+ icon="ep:message"
+ iconColor="text-teal-400"
+ :loading="loading"
+ />
+ </el-col>
+ </el-row>
+
+ <!-- 绗簩琛岋細鍥捐〃琛� -->
+ <el-row :gutter="16" class="mb-4">
+ <el-col :span="12">
+ <DeviceCountCard :statsData="statsData" :loading="loading" />
+ </el-col>
+ <el-col :span="12">
+ <DeviceStateCountCard :statsData="statsData" :loading="loading" />
+ </el-col>
+ </el-row>
+
+ <!-- 绗笁琛岋細娑堟伅缁熻琛� -->
+ <el-row>
+ <el-col :span="24">
+ <MessageTrendCard />
+ </el-col>
+ </el-row>
+
+ <!-- TODO 绗洓琛岋細鍦板浘 -->
+</template>
+
+<script setup lang="ts" name="Index">
+import { IotStatisticsSummaryRespVO, StatisticsApi } from '@/api/iot/statistics'
+import ComparisonCard from './components/ComparisonCard.vue'
+import DeviceCountCard from './components/DeviceCountCard.vue'
+import DeviceStateCountCard from './components/DeviceStateCountCard.vue'
+import MessageTrendCard from './components/MessageTrendCard.vue'
+
+/** IoT 棣栭〉 */
+defineOptions({ name: 'IoTHome' })
+
+const statsData = ref<IotStatisticsSummaryRespVO>({
+ productCategoryCount: -1,
+ productCount: -1,
+ deviceCount: -1,
+ deviceMessageCount: -1,
+ productCategoryTodayCount: -1,
+ productTodayCount: -1,
+ deviceTodayCount: -1,
+ deviceMessageTodayCount: -1,
+ deviceOnlineCount: -1,
+ deviceOfflineCount: -1,
+ deviceInactiveCount: -1,
+ productCategoryDeviceCounts: {}
+}) // 鍩虹缁熻鏁版嵁
+
+const loading = ref(true) // 鍔犺浇鐘舵��
+
+/** 鑾峰彇缁熻鏁版嵁 */
+const getStats = async () => {
+ loading.value = true
+ try {
+ // 鑾峰彇鍩虹缁熻鏁版嵁
+ statsData.value = await StatisticsApi.getStatisticsSummary()
+ } catch (error) {
+ console.error('鑾峰彇缁熻鏁版嵁鍑洪敊:', error)
+ } finally {
+ loading.value = false
+ }
+}
+
+/** 鍒濆鍖� */
+onMounted(() => {
+ getStats()
+})
+</script>
--
Gitblit v1.8.0