+
内存使用率:
- 0%
-
-
-
+
{% raw %}{{ systemInfo.memory_usage }}{% endraw %}%
+
+
-
+
磁盘使用率:
- 0%
-
-
-
+
{% raw %}{{ systemInfo.disk_usage }}{% endraw %}%
+
+
-
最后更新: -
+
最后更新: {% raw %}{{ systemInfo.timestamp }}{% endraw %}
@@ -228,10 +231,26 @@
}
}
},
+ computed: {
+ // 计算属性:格式化的运行时间
+ formattedUptime() {
+ const seconds = this.systemInfo.uptime;
+ const days = Math.floor(seconds / 86400);
+ const hours = Math.floor((seconds % 86400) / 3600);
+ const minutes = Math.floor((seconds % 3600) / 60);
+
+ let result = '';
+ if (days > 0) result += days + '天 ';
+ if (hours > 0 || days > 0) result += hours + '小时 ';
+ result += minutes + '分钟';
+
+ return result;
+ }
+ },
mounted() {
this.currentView = '1';
this.loadData();
- // 添加加载系统信息
+ // 加载系统信息
this.loadSystemInfo();
// 设置定时刷新系统信息(每30秒)
this.systemInfoTimer = setInterval(this.loadSystemInfo, 30000);
@@ -255,7 +274,6 @@
.then(response => {
if (response.data.success) {
this.systemInfo = response.data.data;
- this.updateSystemInfoUI();
}
})
.catch(error => {
@@ -543,5 +561,28 @@
font-size: 16px;
color: #606266;
}
+
+ /* 系统状态卡片样式 */
+ .system-info-item {
+ margin-bottom: 15px;
+ }
+
+ .system-info-row {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 8px;
+ }
+
+ .system-update-time {
+ text-align: right;
+ font-size: 12px;
+ color: #909399;
+ margin-top: 10px;
+ }
+
+ /* 进度条样式调整 */
+ .el-progress {
+ margin-bottom: 15px;
+ }
{% endblock %}
\ No newline at end of file