<template>
  <div class="data-list">
    <div class="data-item" v-for="(item, index) in props.list" :key="index">
      <div class="item-head">
        <div class="item-name">{{ `(${onNumToChinese(Number(index)+1)}). ${item.title}` }}</div>
        <div class="button-box" @click="onNavigateTo()">
          <div class="button-icon">
            <img src="../assets/icons/open.png" alt="" />
          </div>
          <div class="button-text">跳转原文</div>
        </div>
      </div>
      <Level2List :list="item.data"></Level2List>
    </div>
  </div>
</template>

<script setup lang="ts" name="Level2List">
import router from "@/router";
import { useRoute } from "vue-router";
import { onNumToChinese } from "@/views/marketAccessRestrictions/utils/index"
import Level2List from "@/views/marketAccessRestrictions/com/Level2List.vue";

const route = useRoute();

const props = defineProps({
  list: {
    type: Array as any,
    default: () => ([])
  },
})

const onNavigateTo = () => {
  const page = router.resolve({
		name: "MarketSingleReportOriginal",
		query: { ...route.query }
	});
	window.open(page.href, "_blank");
}

</script>

<style scoped lang="scss">
.data-list {
  margin-bottom: 16px;
  border-top: 1px solid rgba(234, 236, 238, 1);
  .data-item {
    .item-head {
      padding: 0 20px;
      height: 48px;
      border-bottom: 1px solid rgba(234, 236, 238, 1);
      background: rgba(247, 248, 249, 1);
      display: flex;
      align-items: center;
      .item-name {
        width: 20px;
        flex: auto;
        font-family: Source Han Sans CN;
        font-size: 18px;
        font-weight: bold;
        line-height: 30px;
        color: var(--text-primary-80-color);
      }
      .button-box {
        display: flex;
        align-items: center;
        margin-left: 50px;
        cursor: pointer;
        .button-icon {
          width: 16px;
          height: 16px;
          font-size: 0;
          margin-right: 4px;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .button-text {
          color: var(--color-primary-100);
          font-family: Microsoft YaHei;
          font-size: 12px;
          font-weight: 400;
          line-height: 12px;
        }
      }
    }
  }
}
</style>