This commit is contained in:
chenlin
2025-12-15 20:57:13 +08:00

View File

@@ -15,9 +15,9 @@
<div class="card-title">总设备数</div> <div class="card-title">总设备数</div>
<div class="card-value">{{ totalDevices.toLocaleString() }}</div> <div class="card-value">{{ totalDevices.toLocaleString() }}</div>
<div class="card-trend growth"> <div class="card-trend growth">
<svg class="trend-icon" viewBox="0 0 1024 1024" width="16" height="16" fill="currentColor"> <!-- <svg class="trend-icon" viewBox="0 0 1024 1024" width="16" height="16" fill="currentColor">
<path d="M868 545.5L536.1 163a31.96 31.96 0 0 0-48.3 0L156 545.5a7.97 7.97 0 0 0 6 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z" /> <path d="M868 545.5L536.1 163a31.96 31.96 0 0 0-48.3 0L156 545.5a7.97 7.97 0 0 0 6 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z" />
</svg> </svg> -->
<!-- <span>较上月增长 {{ totalDevicesGrowth }}%</span> --> <!-- <span>较上月增长 {{ totalDevicesGrowth }}%</span> -->
</div> </div>
</div> </div>
@@ -442,9 +442,9 @@ const fetchTotalDevices = async () => {
pageSize: 10 pageSize: 10
}; };
const response = await getPowerEnvDeviceTotalNum(params); const response = await getPowerEnvDeviceTotalNum(params);
debugger
if (response.records?.length > 0) { if (response.records?.length > 0) {
debugger
const total = parseInt(response.records[0].total || '0', 10); const total = parseInt(response.records[0].total || '0', 10);
totalDevices.value = total; totalDevices.value = total;
onlineDevices.value = total; // 在线设备数也用total onlineDevices.value = total; // 在线设备数也用total
@@ -462,8 +462,9 @@ const fetchAlarmDistribution = async () => {
pageSize: 10 pageSize: 10
}; };
const response = await getPowerEnvDeviceAlarmDistribution(params); const response = await getPowerEnvDeviceAlarmDistribution(params);
if (response.code === 0 && response.data?.records?.length > 0) { debugger
const record = response.data.records[0]; if (response.records?.length > 0) {
const record = response.records[0];
deviceTypeData.value = [ deviceTypeData.value = [
{ name: 'UPS', value: parseInt(record.ups_num || '0', 10) }, { name: 'UPS', value: parseInt(record.ups_num || '0', 10) },
{ name: '精密空调', value: parseInt(record.jmkt_num || '0', 10) }, { name: '精密空调', value: parseInt(record.jmkt_num || '0', 10) },
@@ -486,8 +487,9 @@ const fetchAlarmTrend = async () => {
pageSize: 100 // 可能需要获取更多数据 pageSize: 100 // 可能需要获取更多数据
}; };
const response = await getPowerEnvAlarmTrend(params); const response = await getPowerEnvAlarmTrend(params);
if (response.code === 0 && response.data?.records?.length > 0) { debugger
const records = response.data.records; if (response.records?.length > 0) {
const records = response.records;
// 处理日期格式:从 "2025-12-10" 转换为 "10日" // 处理日期格式:从 "2025-12-10" 转换为 "10日"
const dates = records.map((item: any) => { const dates = records.map((item: any) => {
const date = new Date(item.alarm_date); const date = new Date(item.alarm_date);
@@ -526,7 +528,7 @@ const fetchParkList = async () => {
pageSize: parkListPage.value.pageSize pageSize: parkListPage.value.pageSize
}; };
const response = await getPowerEnvDeviceGroupTypeCampus(params); const response = await getPowerEnvDeviceGroupTypeCampus(params);
debugger
if (response.records?.length>0) { if (response.records?.length>0) {
parkListPage.value.total = response.records?.length || 0; parkListPage.value.total = response.records?.length || 0;