Overview.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :md="24">
  5. <div>
  6. <el-table
  7. :data="status"
  8. stripe
  9. style="width: 100%"
  10. :default-sort="{ prop: 'type', order: 'ascending' }"
  11. >
  12. <el-table-column
  13. prop="name"
  14. label="name"
  15. sortable
  16. ></el-table-column>
  17. <el-table-column
  18. prop="type"
  19. label="type"
  20. width="150"
  21. sortable
  22. ></el-table-column>
  23. <el-table-column
  24. prop="local_addr"
  25. label="local address"
  26. width="200"
  27. sortable
  28. ></el-table-column>
  29. <el-table-column
  30. prop="plugin"
  31. label="plugin"
  32. width="200"
  33. sortable
  34. ></el-table-column>
  35. <el-table-column
  36. prop="remote_addr"
  37. label="remote address"
  38. sortable
  39. ></el-table-column>
  40. <el-table-column
  41. prop="status"
  42. label="status"
  43. width="150"
  44. sortable
  45. ></el-table-column>
  46. <el-table-column prop="err" label="info"></el-table-column>
  47. </el-table>
  48. </div>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. </template>
  53. <script setup lang="ts">
  54. import { ref } from 'vue'
  55. import { ElMessage } from 'element-plus'
  56. let status = ref<any[]>([])
  57. const fetchData = () => {
  58. fetch('/api/status', { credentials: 'include' })
  59. .then((res) => {
  60. return res.json()
  61. })
  62. .then((json) => {
  63. status.value = new Array()
  64. for (let key in json) {
  65. for (let ps of json[key]) {
  66. console.log(ps)
  67. status.value.push(ps)
  68. }
  69. }
  70. })
  71. .catch((err) => {
  72. ElMessage({
  73. showClose: true,
  74. message: 'Get status info from frpc failed!' + err,
  75. type: 'warning',
  76. })
  77. })
  78. }
  79. fetchData()
  80. </script>
  81. <style></style>