perf.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <cl-scrollbar>
  3. <div class="system-perf">
  4. <ct ref="ct"></ct>
  5. <network ref="network"></network>
  6. <el-row :gutter="20">
  7. <el-col :lg="12" :xs="24" style="margin-top: 15px">
  8. <redis ref="redis"></redis>
  9. </el-col>
  10. <el-col :lg="12" :xs="24" style="margin-top: 15px">
  11. <mysql ref="mysql"></mysql>
  12. </el-col>
  13. </el-row>
  14. </div>
  15. </cl-scrollbar>
  16. </template>
  17. <script>
  18. import Ct from "./components/ct";
  19. import Network from "./components/network";
  20. import Redis from "./components/redis";
  21. import Mysql from "./components/mysql";
  22. export default {
  23. components: {
  24. Network,
  25. Ct,
  26. Redis,
  27. Mysql
  28. },
  29. beforeRouteLeave(to, from, next) {
  30. clearTimeout(this.tiemr);
  31. next();
  32. },
  33. data() {
  34. return {
  35. list: {},
  36. tiemr: null
  37. };
  38. },
  39. mounted() {
  40. this.refresh();
  41. this.tiemr = setInterval(this.refresh, 3000);
  42. },
  43. methods: {
  44. refresh() {
  45. this.$service.system.info.record().then((res) => {
  46. const { network, ct, redis, mysql } = this.$refs;
  47. if (network) {
  48. network.refresh(res);
  49. }
  50. if (ct) {
  51. ct.refresh(res);
  52. }
  53. if (redis) {
  54. redis.refresh(res);
  55. }
  56. if (mysql) {
  57. mysql.refresh(res);
  58. }
  59. });
  60. }
  61. }
  62. };
  63. </script>
  64. <style lang="scss" scoped>
  65. .system-perf {
  66. }
  67. </style>