refactor:【antd】【iot】更新首页必要的 ReqVO、RespVO

This commit is contained in:
haohao
2025-12-15 21:51:09 +08:00
parent 47dfccd9eb
commit 5cb412a4da
6 changed files with 32 additions and 98 deletions

View File

@@ -1,5 +1,4 @@
<script setup lang="ts">
// TODO @芋艿
import type { StatsData } from './data';
import { onMounted, ref } from 'vue';
@@ -22,38 +21,7 @@ const statsData = ref<StatsData>(defaultStatsData);
/** 加载统计数据 */
async function loadStatisticsData(): Promise<StatsData> {
try {
return await getStatisticsSummary();
} catch (error) {
// TODO @haohao后续记得删除下哈。catch 部分可以删除
// 开发环境:记录错误信息,便于调试
console.error('获取统计数据出错:', error);
// 开发环境:提示使用 Mock 数据,提醒检查后端接口
console.warn('使用 Mock 数据,请检查后端接口是否已实现');
// TODO @haohao后续记得删除下哈。
// 开发调试:返回 Mock 数据,确保前端功能正常开发
// 生产环境:建议移除 Mock 数据,直接抛出错误或返回空数据
return {
productCategoryCount: 12,
productCount: 45,
deviceCount: 328,
deviceMessageCount: 15_678,
productCategoryTodayCount: 2,
productTodayCount: 5,
deviceTodayCount: 23,
deviceMessageTodayCount: 1234,
deviceOnlineCount: 256,
deviceOfflineCount: 48,
deviceInactiveCount: 24,
productCategoryDeviceCounts: {
智能家居: 120,
工业设备: 98,
环境监测: 65,
智能穿戴: 45,
},
};
}
return await getStatisticsSummary();
}
/** 加载数据 */
@@ -61,9 +29,6 @@ async function loadData() {
loading.value = true;
try {
statsData.value = await loadStatisticsData();
} catch (error) {
// TODO @haohao后续记得删除下哈。catch 部分可以删除
console.error('获取统计数据出错:', error);
} finally {
loading.value = false;
}
@@ -139,9 +104,3 @@ onMounted(() => {
</Row>
</Page>
</template>
<style scoped>
:deep(.vben-page-content) {
padding: 16px;
}
</style>