index.vue 3.78 KB
Newer Older
yanzhongrong's avatar
yanzhongrong committed
1
<template>
neogcg's avatar
neogcg committed
2
  <!-- 设备连接告警 -->
neogcg's avatar
neogcg committed
3 4
  <div class="leakage-cable"> 
     <el-button-group>
yanzhongrong's avatar
yanzhongrong committed
5 6
        <el-button v-for="item in tabs" :key="item.key" :type="activeName === item.key ? 'primary' : ''" @click="changeType(item)">{{ item.label }}</el-button>
      </el-button-group>
neogcg's avatar
neogcg committed
7 8
    <div class="leakage-top">
    
neogcg's avatar
neogcg committed
9
       <div style="color: #666666"></div>
yanzhongrong's avatar
yanzhongrong committed
10 11 12 13 14 15
      <div class="operate-btn">
        <el-button type="primary">刷新</el-button>
        <el-button type="primary">查询</el-button>
        <el-button type="primary">导出</el-button>
      </div>
    </div>
neogcg's avatar
neogcg committed
16
   
neogcg's avatar
neogcg committed
17
    <el-table :data="tableData2" style="width: 100%" :cell-class-name="cellClassFn" :header-cell-style="{background:'#EAF1FE',color:'#666666'}">
yanzhongrong's avatar
yanzhongrong committed
18 19 20 21 22 23 24 25 26
      <el-table-column prop="equipment1" label="网元设备" align="center" />
      <el-table-column prop="state1" label="连接状态" align="center" />
      <el-table-column prop="equipment2" label="网元设备" align="center" />
      <el-table-column prop="uploadDate" label="上传时间" align="center" />
      <el-table-column prop="confirmUser" label="确认人" align="center" />
      <el-table-column prop="confirmTime" label="确认时间" align="center" />
      <el-table-column
        fixed="right"
        label="操作"
yanzhongrong's avatar
yanzhongrong committed
27
        align="center"
yanzhongrong's avatar
yanzhongrong committed
28 29
        width="100">
        <template slot-scope="scope">
yanzhongrong's avatar
yanzhongrong committed
30
          <el-button type="text">确认</el-button>
yanzhongrong's avatar
yanzhongrong committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
        </template>
      </el-table-column>
    </el-table>
    <pagination
      :limit="searchForm.pageSize"
      :page="searchForm.pageNum"
      :total="total"
      class="pagination"
      @pagination="handlePageChange"
    />
  </div>
</template>

<script>
import Pagination from '@/components/Pagination'
import { tableData } from './const'
export default {
  components: { Pagination },
  data() {
    return {
      searchForm: {
        pageNum: 1,
        pageSize: 10
      },
      total: 10,
neogcg's avatar
neogcg committed
56
      tableData2:[],
yanzhongrong's avatar
yanzhongrong committed
57
      tableData,
yanzhongrong's avatar
yanzhongrong committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
      activeName: '0',
      tabs: [
        {
          label: '全部',
          key: '0'
        },
        {
          label: '已确认',
          key: '1'
        },
        {
          label: '未确认',
          key: '2'
        }
      ],
yanzhongrong's avatar
yanzhongrong committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
    };
  },
  methods: {
    // 表格背景图颜色
    cellClassFn({row, column, rowIndex, columnIndex}) {
      if ((row.state1 == '连接正常' && column.property == 'state1')) {
        return 'green'
      }
      if ((row.state1 == '连接异常' && column.property == 'state1')) {
        return 'red'
      }
      if ((row.state2 == '连接正常' && column.property == 'state2')) {
        return 'green'
      } else if ((row.state2 == '连接异常' && column.property == 'state2')) {
        return 'red'
      }
      if (rowIndex%2 == 1) {
        return 'stripe'
      }
    },
    handlePageChange(pageData) {
      this.searchForm.pageSize = pageData.size
      this.searchForm.pageNum = pageData.page
neogcg's avatar
neogcg committed
96 97 98 99 100 101 102 103
         this.getTableData()
    },
      getTableData() {
      this.tableData2 = this.tableData.slice(( this.searchForm.pageNum - 1) * this.searchForm.pageSize,
         this.searchForm.pageNum * this.searchForm.pageSize
      );
      this.total = this.tableData.length
  
yanzhongrong's avatar
yanzhongrong committed
104 105 106 107
    },
    changeType(item) {
      this.activeName = item.key
    },
neogcg's avatar
neogcg committed
108 109 110 111
   },
  mounted() {
    this.getTableData()
  },
yanzhongrong's avatar
yanzhongrong committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
};
</script>

<style lang="scss" scoped>
.leakage-cable {
  .leakage-top {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
  }
  & ::v-deep .cell {
    color: #333333;
  }
  & ::v-deep .stripe {
    background-color: #EAF1FE;
  }
  & ::v-deep .red {
    background-color: #f00;
  }
  & ::v-deep .green {
    background-color: green;
  }
  .page {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    .pageNum {
      margin: 0 20px;
    }
  }
}
</style>