<template>
  <div id="engineering">
    <!-- 侧边栏 -->
    <!-- <div class="sidebar1">
      <SidebarTitle title="综合评判" />
      <div class="btn-box">
        <button
          @click="sidebarBtn(item, index)"
          v-for="(item, index) in $router.options.routes[2].children[1]
            .children"
          :key="index"
          :class="{ sidebarActive: sidebarIndex === index }"
        >
          {{ item.meta.pageName }}
        </button>
      </div>
    </div> -->

    <div class="sidebar2">
      <div class="box">
        <SidebarTitle2 title="综合评判" />
        <div class="btn-box">
          <!-- <a
            @click="changeBtnIndex(7)"
            target="a"
            href="http://hjsk.guangchuan.org/yqzl.html"
            :class="{ sidebarActive: sidebarIndex === 11 }"
            style="border-bottom: 0"
          >
            研判概述
          </a> -->
          <a
            @click="changeBtnIndex(1)"
            target="a"
            href="http://hjsk.guangchuan.org/zhyp.html"
            :class="{ sidebarActive: sidebarIndex === 1 }"
            style="border-bottom: 0"
          >
            综合评判
          </a>
        </div>
      </div>
      <div class="box">
        <SidebarTitle2 title="单参数评估" />
        <div class="btn-box">
          <a
            @click="changeBtnIndex(2)"
            target="a"
            href="http://hjsk.guangchuan.org/dxpg/spwy.html"
            :class="{ sidebarActive: sidebarIndex === 2 }"
          >
            水平位移
          </a>
          <a
            @click="changeBtnIndex(3)"
            target="a"
            href="http://hjsk.guangchuan.org/dxpg/czwy.html"
            :class="{ sidebarActive: sidebarIndex === 3 }"
          >
            垂直位移
          </a>
          <a
            @click="changeBtnIndex(4)"
            target="a"
            href="http://hjsk.guangchuan.org/dxpg/scspwy.html"
            :class="{ sidebarActive: sidebarIndex === 4 }"
          >
            防渗墙应力应变
          </a>
          <a
            @click="changeBtnIndex(5)"
            target="a"
            href="http://hjsk.guangchuan.org/dxpg/sll.html"
            :class="{ sidebarActive: sidebarIndex === 5 }"
          >
            坝体渗流
          </a>
          <a
            @click="changeBtnIndex(6)"
            target="a"
            href="http://hjsk.guangchuan.org/dxpg/rbsl.html"
            :class="{ sidebarActive: sidebarIndex === 6 }"
            style="border-bottom: 0"
          >
            绕坝渗流
          </a>
        </div>
      </div>
      <div class="box">
        <SidebarTitle2 title="关联评估" />
        <div class="btn-box">
          <!-- <a
            @click="changeBtnIndex(7)"
            target="a"
            href="http://hjsk.guangchuan.org/zbhj.html"
            :class="{ sidebarActive: sidebarIndex === 7 }"
            style="border-bottom: 0"
          >
            关联周边环境
          </a> -->
          <a
            @click="changeBtnIndex(10)"
            :class="{ sidebarActive: sidebarIndex === 10 }"
            style="border-bottom: 0"
          >
            工程巡查
          </a>
          <a
            @click="changeBtnIndex(11)"
            :class="{ sidebarActive: sidebarIndex === 11 }"
            style="border-bottom: 0"
          >
            专项检查
          </a>
          <a
            @click="changeBtnIndex(12)"
            :class="{ sidebarActive: sidebarIndex === 12 }"
            style="border-bottom: 0"
          >
            安全鉴定
          </a>
        </div>
      </div>
      <div class="box">
        <SidebarTitle2 title="理论分析" />
        <div class="btn-box">
          <a
            @click="changeBtnIndex(8)"
            target="a"
            href="http://hjsk.guangchuan.org/jgwdfx.html"
            :class="{ sidebarActive: sidebarIndex === 8 }"
            style="border-bottom: 0"
          >
            理论分析反演
          </a>
        </div>
      </div>
      <div class="box">
        <SidebarTitle2 title="预警处置" />
        <div class="btn-box">
          <a
            @click="changeBtnIndex(9)"
            :class="{ sidebarActive: sidebarIndex === 9 }"
            style="border-bottom: 0"
          >
            预警处置
          </a>
        </div>
      </div>
    </div>

    <!-- 右侧内容 -->
    <div class="main">
      <iframe
        name="a"
        src="http://hjsk.guangchuan.org/zhyp.html"
        frameborder="0"
        v-if="sidebarIndex < 9"
      ></iframe>
      <router-view v-else />
    </div>
  </div>
</template>

<script>
export default {
  name: 'Engineering',
  // created () {
  //   const arr = ['/engineering', '/engineering/security', '/engineering/alert', '/engineering/rescue', '/engineering/expert', '/engineering/evaluate']
  //   const i = arr.indexOf(this.$route.path)
  //   this.sidebarIndex = i
  // },
  data () {
    return {
      sidebarIndex: 1,
      tg: 'btn1'
    }
  },
  methods: {
    changeBtnIndex (num) {
      this.sidebarIndex = num
      if (num === 9) {
        this.$router.push('/engineering/alert')
      } else if (num === 10) {
        this.$router.push('/engineering/maintain')
      }
      // else if (num === 11) {
      // } else if (num === 12) l{
      // }
    },
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    },
    sidebarBtn (item, index) {
      if (this.sidebarIndex === index) return
      this.sidebarIndex = index
      this.$router.replace(item.path)
    }
  }
}
</script>

<style lang="scss" scoped>
#engineering {
  display: flex;
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 966px;
  .sidebar1 {
    position: relative;
    padding-top: 70px;
    padding-left: 30px;
    width: 220px;
    height: 100%;
    background-color: #12386d;
    .btn-box {
      width: 100%;
      margin-top: 3px;
      button {
        display: flex;
        align-items: center;
        width: 100%;
        height: 50px;
        padding-left: 18px;
        border-width: 0 0 1px 0;
        border-color: #2d5c9e;
        border-style: solid;
        background: transparent;
        color: #b1ccf1;
        font-size: 16px;
        &:hover {
          color: #ffb330;
        }
      }
      .sidebarActive {
        color: #ffb330;
      }
    }
  }
  .sidebar2 {
    position: relative;
    width: 220px;
    height: 100%;
    padding: 20px 0 0 10px;
    background-color: #12386d;
    .box {
      .btn-box {
        width: 100%;
        margin-top: 3px;
        a {
          display: flex;
          align-items: center;
          width: 190px;
          height: 50px;
          margin-left: 20px;
          padding-left: 18px;
          border-width: 0 0 1px 0;
          border-color: #2d5c9e;
          border-style: solid;
          background: transparent;
          color: #b1ccf1;
          font-size: 16px;
          &:hover {
            color: #ffb330;
          }
          &.sidebarActive {
            color: #ffb330 !important;
          }
        }
      }
    }
  }
  .main {
    position: relative;
    width: 1700px;
    height: 100%;
    padding: 10px;
    iframe {
      position: absolute;
      width: 1680px;
      height: 946px;
    }
  }
}
</style>
