Dashboard.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <el-container>
  3. <el-main class="movie-list">
  4. <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
  5. <el-card class="box-card">
  6. <div slot="header" class="clearfix">
  7. <span>机器节点</span>
  8. </div>
  9. <div class="text item">
  10. <el-table
  11. :data="machineStatList"
  12. style="width: 100%"
  13. >
  14. <el-table-column
  15. prop="env"
  16. label="环境"
  17. />
  18. <el-table-column
  19. prop="total"
  20. label="总数"
  21. />
  22. <el-table-column
  23. prop="onlineCount"
  24. label="在线"
  25. >
  26. <template slot-scope="scope">
  27. <span style="color: green">{{ scope.row.onlineCount }}</span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column
  31. prop="offlineCount"
  32. label="离线"
  33. >
  34. <template slot-scope="scope">
  35. <span style="color: red">{{ scope.row.offlineCount }}</span>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. </div>
  40. </el-card>
  41. </el-col>
  42. <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
  43. <el-card class="box-card">
  44. <div slot="header" class="clearfix">
  45. <span>系统信息</span>
  46. </div>
  47. <div class="text item">
  48. <el-descriptions v-if="sysInfo !== null" class="margin-top" :column="1" border>
  49. <el-descriptions-item>
  50. <template slot="label">
  51. <i class="el-icon-user" />
  52. 应用版本
  53. </template>
  54. <a target="_blank" :href="`https://git.reghao.cn/reghao/bnt/commit/${sysInfo.commitId}`" style="text-decoration-line: none">
  55. {{ sysInfo.commitId }}
  56. </a>
  57. </el-descriptions-item>
  58. <el-descriptions-item>
  59. <template slot="label">
  60. <i class="el-icon-mobile-phone" />
  61. 机器地址
  62. </template>
  63. {{ sysInfo.ipv4 }}
  64. </el-descriptions-item>
  65. <el-descriptions-item>
  66. <template slot="label">
  67. <i class="el-icon-location-outline" />
  68. 操作系统
  69. </template>
  70. {{ sysInfo.osInfo }}
  71. </el-descriptions-item>
  72. <el-descriptions-item>
  73. <template slot="label">
  74. <i class="el-icon-tickets" />
  75. JVM
  76. </template>
  77. {{ sysInfo.jvmInfo }}
  78. </el-descriptions-item>
  79. <el-descriptions-item>
  80. <template slot="label">
  81. <i class="el-icon-office-building" />
  82. 启动时间
  83. </template>
  84. {{ sysInfo.startAt }}
  85. </el-descriptions-item>
  86. <el-descriptions-item>
  87. <template slot="label">
  88. <i class="el-icon-office-building" />
  89. PID
  90. </template>
  91. {{ sysInfo.pid }}
  92. </el-descriptions-item>
  93. </el-descriptions>
  94. </div>
  95. </el-card>
  96. </el-col>
  97. </el-main>
  98. </el-container>
  99. </template>
  100. <script>
  101. import { getDashboard } from '@/api/devops'
  102. export default {
  103. name: 'Dashboard',
  104. data() {
  105. return {
  106. machineStatList: [],
  107. sysInfo: null
  108. }
  109. },
  110. created() {
  111. document.title = 'Dashboard'
  112. this.getData()
  113. },
  114. methods: {
  115. getData() {
  116. getDashboard().then(resp => {
  117. if (resp.code === 0) {
  118. this.sysInfo = resp.data.sysInfo
  119. this.machineStatList = resp.data.machineStatList
  120. } else {
  121. this.$message.error(resp.msg)
  122. }
  123. }).catch(error => {
  124. this.$message.error(error.message)
  125. })
  126. }
  127. }
  128. }
  129. </script>
  130. <style>
  131. </style>