+
+
+
+ Connected Devices Overview
+
+ Refresh
+
+
+
+
+
+
+
{{ connectedDevices.total || 0 }}
+
Total Devices
+
+
+
+
+
{{ connectedDevices.activeToday || 0 }}
+
Active Today
+
+
+
+
+
Firmware Versions in Use:
+
+
+ {{ version }} ({{ count }} devices)
+
+
+
+
+
+
+
+
item.key === type)
return firmwareType ? firmwareType.name : type
},
+ fetchConnectedDevices() {
+ // Fetch connected devices statistics
+ // This would call an API endpoint to get device statistics
+ // For now, we'll use the device management API to get device info
+ const currentAgentId = localStorage.getItem('agentId') || this.$route.query.agentId;
+ if (currentAgentId) {
+ Api.device.getAgentBindDevices(currentAgentId, ({data}) => {
+ if (data.code === 0 && data.data) {
+ const devices = data.data;
+ this.connectedDevices.total = devices.length;
+
+ // Count devices active today
+ const today = new Date();
+ today.setHours(0, 0, 0, 0);
+ this.connectedDevices.activeToday = devices.filter(device => {
+ const lastConnected = new Date(device.lastConnectedAt);
+ return lastConnected >= today;
+ }).length;
+
+ // Calculate version distribution
+ const versionMap = {};
+ devices.forEach(device => {
+ const version = device.appVersion || 'Unknown';
+ versionMap[version] = (versionMap[version] || 0) + 1;
+ });
+ this.connectedDevices.versionDistribution = versionMap;
+ }
+ });
+ }
+ },
},
};
@@ -481,6 +556,45 @@ export default {
flex-direction: column;
}
+.device-summary-card {
+ background: white;
+ border: none;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+
+ ::v-deep .el-card__header {
+ background: linear-gradient(135deg, #f5f7fa 0%, #f0f3f8 100%);
+ padding: 12px 20px;
+ border-bottom: 1px solid #e4e7ed;
+ }
+
+ .device-stats {
+ padding: 10px 0;
+
+ .stat-item {
+ text-align: center;
+ padding: 10px;
+
+ .stat-value {
+ font-size: 28px;
+ font-weight: bold;
+ color: #409eff;
+ margin-bottom: 5px;
+ }
+
+ .stat-label {
+ font-size: 14px;
+ color: #606266;
+ margin-bottom: 8px;
+ }
+
+ .version-list {
+ margin-top: 8px;
+ text-align: left;
+ }
+ }
+ }
+}
+
.params-card {
background: white;
flex: 1;