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

@@ -13,7 +13,7 @@ defineOptions({ name: 'DeviceCountCard' });
const props = defineProps<{
loading?: boolean;
statsData: IotStatisticsApi.StatisticsSummary;
statsData: IotStatisticsApi.StatisticsSummaryRespVO;
}>();
const deviceCountChartRef = ref();
@@ -75,9 +75,3 @@ onMounted(() => {
</div>
</Card>
</template>
<style scoped>
:deep(.ant-card-body) {
padding: 20px;
}
</style>

View File

@@ -13,7 +13,7 @@ defineOptions({ name: 'DeviceStateCountCard' });
const props = defineProps<{
loading?: boolean;
statsData: IotStatisticsApi.StatisticsSummary;
statsData: IotStatisticsApi.StatisticsSummaryRespVO;
}>();
const deviceOnlineChartRef = ref();
@@ -111,9 +111,3 @@ onMounted(() => {
</Row>
</Card>
</template>
<style scoped>
:deep(.ant-card-body) {
padding: 20px;
}
</style>

View File

@@ -23,7 +23,7 @@ const messageChartRef = ref();
const { renderEcharts } = useEcharts(messageChartRef);
const loading = ref(false);
const messageData = ref<IotStatisticsApi.DeviceMessageSummaryByDate[]>([]);
const messageData = ref<IotStatisticsApi.DeviceMessageSummaryByDateRespVO[]>([]);
/** 时间范围(仅日期,不包含时分秒) */
const dateRange = ref<[string, string]>([
@@ -38,7 +38,7 @@ function formatDateRangeWithTime(dates: [string, string]): [string, string] {
}
/** 查询参数 */
const queryParams = reactive<IotStatisticsApi.DeviceMessageReq>({
const queryParams = reactive<IotStatisticsApi.DeviceMessageReqVO>({
interval: 1, // 默认按天
times: formatDateRangeWithTime(dateRange.value),
});
@@ -89,12 +89,6 @@ async function fetchMessageData() {
loading.value = true;
try {
messageData.value = await getDeviceMessageSummaryByDate(queryParams);
} catch (error) {
// TODO @haohaocatch 可以删除哈;
// 开发环境:记录错误信息,便于调试
console.error('获取消息统计数据失败:', error);
// 错误时清空数据,避免显示错误的数据
messageData.value = [];
} finally {
loading.value = false;
await renderChartWhenReady();