<template>
  <AnalysisBox :title="title" :showAllBtn="false" height="auto">
    <el-empty v-if="!props.listData?.length" description="暂无数据" :image-size="200" />
    <div v-else class="box-main">
      <div class="data-list">
        <div class="data-item" v-for="(item, index) in props.listData" :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>
          <div class="item-down">
            <div class="item-info" v-for="(text, num) in item.data" :key="num">
              <div class="item-num">{{ Number(num) + 1 }}.</div>
              <div class="text-align-justify">{{ text }}</div>
            </div>
          </div>
        </div>
      </div>
      <AiTips :tips="tips"></AiTips>
    </div>
  </AnalysisBox>
</template>

<script setup lang="ts" name="SurveyConclusion">
import AiTips from "@/views/marketAccessRestrictions/com/AiTips.vue";
import { onNumToChinese } from "@/views/marketAccessRestrictions/utils/index"
import router from "@/router";
import { useRoute } from "vue-router";
const route = useRoute();

const props = defineProps({
  listData: {
    type: Array as any,
    default: () => ([])
  },
  title: {
    type: String,
    default: ""
  },
  tips: {
    type: String,
    default: ""
  }
})

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

</script>

<style scoped lang="scss">
.box-main {
	padding: 0 22px 20px;
  .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;
          }
        }
      }
      .item-info {
        padding: 12px 20px 12px 50px;
        color: rgba(59, 65, 75, 1);
        font-family: Source Han Sans CN;
        font-size: 16px;
        font-weight: 400;
        line-height: 30px;
        letter-spacing: 0px;
        border-bottom: 1px solid rgba(234, 236, 238, 1);
        position: relative;
        .item-num {
          position: absolute;
          left: 26px;
          top: 12px;
        }
      }
    }
  }
}
</style>