<template>
  <div class="wrap">
    <div class="sider">
      <div
        class="sider-btn"
        :class="{ siderBtnActive: item.isActive }"
        @click="handleClickLeftSiderBtn(item,index)"
        v-for="(item, index) in siderBtnList"
        :key="index"
      >
        <div class="btn-text">{{ item.name }}</div>
        <div class="btn-icon">
          <el-icon v-if="item.isActive" color="#fff"
            ><CaretRight
          /></el-icon>
        </div>
      </div>
    </div>
    <div class="main">
      <router-view />
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import router from "@/router";

const route = useRoute();

const siderBtnList = ref([
  {
    name: "流程概要",
    isActive: true,
    path: "/billLayout/deepDig/processOverview",
  },
  {
    name: "流程分析",
    isActive: false,
    path: "/billLayout/deepDig/processAnalysis",
  },
  {
    name: "政治献金",
    isActive: false,
    path: "/billLayout/deepDig/poliContribution",
  },
]);

const handleClickLeftSiderBtn = (item,index) => {
  siderBtnList.value.forEach(item => {
    item.isActive = false
  })
  siderBtnList.value[index].isActive = true
  router.push({
    path: item.path,
    query: {
      billId: route.query.billId
    }
  });
};
</script>

<style lang="scss" scoped>
.wrap {
  display: flex;
  height: 879px;
  // background: (243, 243, 244, 1);
  .sider {
    width: 160px;
    .sider-btn {
      margin-top: 20px;
      margin-left: 20px;
      width: 120px;
      height: 32px;
      display: flex;
      border-radius: 16px;
      cursor: pointer;
      .btn-text {
        margin-left: 28px;
        width: 68px;
        height: 32px;
        line-height: 32px;
        text-align: left;
        box-sizing: border-box;
        font-size: 16px;
        font-weight: 400;
        font-family: Microsoft YaHei;
        color: rgba(95, 101, 108, 1);
      }
      .btn-icon {
        margin-top: 9px;
        width: 22px;
      }
    }
    .siderBtnActive {
      background: var(--color-main-active);
      .btn-text {
        color: #fff !important;
      }
    }
  }
}
</style>
