123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <!-- style="padding:6px;border:3px solid #96c2f1;background:#eff7ff;height:180px;margin-top:60px" -->
- <div class="table-wrapper">
- <span class="top_title">故障报警</span>
- <el-table :data="tableData" max-height="160">
- <el-table-column
- prop="name"
- label="时间"
- width="180"
- >
- </el-table-column>
- <el-table-column
- prop="problem"
- label="记录"
- width="180"
- >
- </el-table-column>
- </el-table>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- tableData: [
- {
- name: "2022-1-18 17:41:25",
- problem: "过流",
- },
- {
- name: "2022-1-18 17:44:26",
- problem: "过压",
- },
- {
- name: "2022-1-18 17:52:22",
- problem: "欠压",
- },
- ],
- };
- },
- mounted() {
- let interval = setInterval(() => {
- let now = new Date();
- let temp = {
- name: now.toLocaleTimeString().replace(/^\D*/, ''),
- problem:
- Math.random() > 0.5 ? "过压" : "过流",
- };
- this.tableData.unshift(temp);
- console.log(this.tableData);
- }, 3000);
- this.$once("hook:beforeDestroy", () => {
- clearInterval(interval);
- });
- },
- methods: {
- headerStyle({ row, column, rowIndex, columnIndex }) {
- return "tableStyle";
- },
- tableRowStyle({ row, rowIndex }) {
- return "background-color:#ecf5ff";
- },
- },
- };
- </script>
- <style lang='scss' scoped>
- .table-wrapper {
- padding-top: 20px;
- margin-left: 80px;
- height: 80%;
- margin-top: 10px;
- ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
- background-color: rgba(9, 12, 14, 0.2);
- color: #fff;
- }
- } /* 删除表格下横线 */
- .table-wrapper ::v-deep .el-table::before {
- left: 0;
- bottom: 0;
- width: 100%;
- height: 0px;
- border: none;
- }
- .table-wrapper ::v-deep .el-table,
- .el-table__expanded-cell {
- background-color: transparent;
- border: none;
- }
- .table-wrapper ::v-deep .el-table tr {
- background-color: transparent !important;
- border: none;
- }
- .table-wrapper ::v-deep .el-table th {
- background-color: transparent !important;
- border: none;
- color: #4ADEFE;
- font-size: 16px;
- }
- .table-wrapper ::v-deep .el-table td,
- .el-table th.is-leaf {
- background-color: transparent !important;
- color: #F3DB5C;
- font-size: 15px;
- border: none;
- }
- .table-wrapper ::v-deep .el-table__body-wrapper::-webkit-scrollbar {
- width: 6px;
- height: 6px;
- }
- .title {
- /* font-weight:; */
- /* padding-bottom: 15px; */
- font-size: 18px;
- color: #4ADEFE;
- }
- </style>
|