faultAlarm.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <!-- style="padding:6px;border:3px solid #96c2f1;background:#eff7ff;height:180px;margin-top:60px" -->
  3. <div class="table-wrapper">
  4. <span class="top_title">故障报警</span>
  5. <el-table :data="tableData" max-height="160">
  6. <el-table-column
  7. prop="name"
  8. label="时间"
  9. width="180"
  10. >
  11. </el-table-column>
  12. <el-table-column
  13. prop="problem"
  14. label="记录"
  15. width="180"
  16. >
  17. </el-table-column>
  18. </el-table>
  19. </div>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. tableData: [
  26. {
  27. name: "2022-1-18 17:41:25",
  28. problem: "过流",
  29. },
  30. {
  31. name: "2022-1-18 17:44:26",
  32. problem: "过压",
  33. },
  34. {
  35. name: "2022-1-18 17:52:22",
  36. problem: "欠压",
  37. },
  38. ],
  39. };
  40. },
  41. mounted() {
  42. let interval = setInterval(() => {
  43. let now = new Date();
  44. let temp = {
  45. name: now.toLocaleTimeString().replace(/^\D*/, ''),
  46. problem:
  47. Math.random() > 0.5 ? "过压" : "过流",
  48. };
  49. this.tableData.unshift(temp);
  50. console.log(this.tableData);
  51. }, 3000);
  52. this.$once("hook:beforeDestroy", () => {
  53. clearInterval(interval);
  54. });
  55. },
  56. methods: {
  57. headerStyle({ row, column, rowIndex, columnIndex }) {
  58. return "tableStyle";
  59. },
  60. tableRowStyle({ row, rowIndex }) {
  61. return "background-color:#ecf5ff";
  62. },
  63. },
  64. };
  65. </script>
  66. <style lang='scss' scoped>
  67. .table-wrapper {
  68. padding-top: 20px;
  69. margin-left: 80px;
  70. height: 80%;
  71. margin-top: 10px;
  72. ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
  73. background-color: rgba(9, 12, 14, 0.2);
  74. color: #fff;
  75. }
  76. } /* 删除表格下横线 */
  77. .table-wrapper ::v-deep .el-table::before {
  78. left: 0;
  79. bottom: 0;
  80. width: 100%;
  81. height: 0px;
  82. border: none;
  83. }
  84. .table-wrapper ::v-deep .el-table,
  85. .el-table__expanded-cell {
  86. background-color: transparent;
  87. border: none;
  88. }
  89. .table-wrapper ::v-deep .el-table tr {
  90. background-color: transparent !important;
  91. border: none;
  92. }
  93. .table-wrapper ::v-deep .el-table th {
  94. background-color: transparent !important;
  95. border: none;
  96. color: #4ADEFE;
  97. font-size: 16px;
  98. }
  99. .table-wrapper ::v-deep .el-table td,
  100. .el-table th.is-leaf {
  101. background-color: transparent !important;
  102. color: #F3DB5C;
  103. font-size: 15px;
  104. border: none;
  105. }
  106. .table-wrapper ::v-deep .el-table__body-wrapper::-webkit-scrollbar {
  107. width: 6px;
  108. height: 6px;
  109. }
  110. .title {
  111. /* font-weight:; */
  112. /* padding-bottom: 15px; */
  113. font-size: 18px;
  114. color: #4ADEFE;
  115. }
  116. </style>