<template>
  <div class="leakage-cable">
    <el-button-group>
      <el-button
        v-for="item in tabs"
        :key="item.key"
        :type="activeName === item.key ? 'primary' : ''"
        style="width: 100px"
        @click="changeType(item)"
      >{{ item.label }}</el-button>
    </el-button-group>

    <railWayTable v-if="activeName == '0'" />
    <stationTable v-if="activeName == '1'" />
    <fsuTable v-if="activeName == '2'" />
    <monitorTable v-if="activeName == '3'" />
    <leakyTable v-if="activeName == '4'" />
    <lineTable v-if="activeName == '5'" />
  </div>
</template>

<script>
import railWayTable from "./comp/railWayTable.vue";
import stationTable from "./comp/stationTable.vue";
import fsuTable from "./comp/fsuTable.vue";
import monitorTable from "./comp/monitorTable.vue";
import leakyTable from "./comp/leakyTable.vue";
import lineTable from "./comp/lineTable.vue";

export default {
  components: {
    railWayTable,
    stationTable,
    fsuTable,
    monitorTable,
    leakyTable,
    lineTable
  },
  data() {
    return {
      params: {
        pageNum: 1,
        pageSize: 10
      },
      total: 10,
      activeName: "0",
      tabs: [
        {
          label: "铁路线",
          key: "0",
        },
        {
          label: "站点",
          key: "1",
        },
        {
          label: "FSU",
          key: "2",
        },
        {
          label: "监测设备",
          key: "3",
        },
        {
          label: "漏缆",
          key: "4",
        },
        {
          label: "天馈线",
          key: "5",
        }
      ],
      tableData2: [],
      tableData: [],
      multipleSelection: [],
      ids: []
    }
  },
  methods: {
    tableRowClassName({ row, rowIndex }) {
      return rowIndex % 2 === 0 ? "" : "single-row";
    },
    changeType(item) {
      this.activeName = item.key
    },
  }
}
</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>
<style lang="scss">
.statistics-table {
  .single-row {
    background: #f1f6ff;
  }
  td {
    padding: 5px !important;
  }
}
</style>
