Browse Source

首页系统数据

master
xuhuajiao 2 weeks ago
parent
commit
1954b8c71d
  1. 4
      src/views/home.vue

4
src/views/home.vue

@ -213,7 +213,9 @@ export default {
console.log('res', res) console.log('res', res)
if (res && Object.keys(res).length) { if (res && Object.keys(res).length) {
// cpu cpuTotal-cpuFree/cpuTotal // cpu cpuTotal-cpuFree/cpuTotal
this.systemData.cpuPercentage = Math.round((res.cpuTotal - res.cpuFree) / res.cpuTotal * 100)
// cpuSy cpu使 cpuFree cpu
// this.systemData.cpuPercentage = Math.round((res.cpuTotal - res.cpuFree) / res.cpuTotal * 100)
this.systemData.cpuPercentage = Math.round(res.cpuSy / (res.cpuSy + res.cpuFree) * 100)
// 使memUsed/memTotal // 使memUsed/memTotal
this.systemData.memPercentage = Math.round(res.memUsed / res.memTotal * 100) this.systemData.memPercentage = Math.round(res.memUsed / res.memTotal * 100)

Loading…
Cancel
Save