<template>
  <div class="rcxj-box">
    <div class="tab">
      <p
        v-for="(item, index) in tabArr"
        :key="index"
        @click="tabClick(index)"
        :class="tabIndex == index ? 'active-item' : ''"
        class="tab-item"
      >
        {{ item.name }}
      </p>
    </div>
    <div class="sub-main">
      <router-view />
    </div>
  </div>
</template>

<script>
export default {
  name: 'rcxj',
  data () {
    return {
      tabIndex: 0,
      tabArr: [
        { name: '日常巡查', url: '/maintain' },
        { name: '汛前检查', url: '/maintain/before' },
        { name: '年度检查', url: '/maintain/year' },
        { name: '特别检查', url: '/maintain/special' },
        { name: '智能台账', url: '/maintain/look' }
      ]
    }
  },
  mounted () {
    this.tabClick(this.tabIndex)
  },
  methods: {
    tabClick (index) {
      this.tabIndex = index
      this.$router.replace(this.tabArr[index].url)
    }
  }
}
</script>

<style lang="scss">
$pry: #00ffff; // rgba(0, 255, 255, 1)
$pry2: #2792a0; // rgba(39, 146, 160, 1)
.rcxj-box {
  width: 100%;
  height: 100%;
  .tab {
    display: flex;
    align-items: center;
    height: 40px;
    background: #12407f;
    color: #fff;
    font-size: 16px;
    .tab-item {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 150px;
      border-right: 1px solid #1d597f;
      height: 100%;
      font-size: 18px;
      cursor: pointer;
    }
    .active-item {
      background: url("~@/assets/images/layout/btn_active.png") no-repeat center /
        cover !important;
    }
  }
  .sub-main {
    height: calc(100% - 40px);
    padding-top: 10px;
    #sub-main {
      display: flex;
      flex-direction: column;
      width: 100%;
      height: 100%;
      background: #0c3061;
      padding-bottom: 10px;
      section {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 100%;
        height: 100%;
        .search-item {
          display: flex;
          align-items: center;
          height: 40px;
          padding: 0 10px;
          background: #12407f;
          margin-bottom: 10px;
        }
        .table-item {
          flex: 1;
          padding: 0 10px;
        }
        .calendar-item {
          flex: 1;
          padding: 0 10px;
        }
        .pagination {
          height: 50px;
          margin: 10px 10px 0;
          background: #103b69;
          display: flex;
          align-items: center;
          .el-pagination {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            position: relative;
            width: 100%;
            height: 50px;
            padding: 0 20px;
            // 默认插槽
            .el-pagination__rightwrapper {
              position: absolute;
              left: 20px;
              top: 11px;
              color: #fff;
              font-size: 14px;
              font-weight: 400;
            }
            .el-pagination__sizes {
              display: flex;
              align-items: center;
              .el-select {
                .el-input {
                  &.is-focus .el-input__inner {
                    border-color: rgba(0, 255, 255, 0.7) !important;
                  }
                  .el-input__inner {
                    background-color: #1b4878;
                    color: #fff;
                    border-color: #2e6d8d;
                    &:hover {
                      height: 28px;
                      border-color: #2792a0;
                    }
                  }

                  .el-input__suffix i {
                    color: #00ffff;
                  }
                }
              }
            }
            // 上一页, 下一页
            .btn-prev,
            .btn-next {
              width: 70px;
              height: 30px;
              background-color: $pry2;
              color: #fff;
              &[disabled] {
                color: #606266;
              }
            }
            .el-pager li {
              background-color: rgba(39, 146, 160, 0.2);
              color: #fff;
              &:hover {
                color: rgba(0, 255, 255, 0.6) !important;
              }
              &.active {
                background-color: $pry2 !important;
                color: #fff !important;
              }
            }
            .el-pagination__jump {
              color: #fff;
              .el-input {
                width: 70px;
                height: 30px;
                input {
                  background-color: rgba(39, 146, 160, 0.2);
                  border-color: $pry2;
                  color: #fff;
                  &:focus {
                    border-color: rgba(0, 255, 255, 0.7);
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>
