<template>
  <view class="page__view">
		<navbar title="报告" leftClick @leftClick="$utils.navigateBack" />

    <view class="title">2025年9月16日xxx公司风险测评报告</view>

    <view class="section">
      <view class="flex section-header">
        <view class="line"></view>
        <view>总概述</view>
      </view>
      <view class="section-content">
        <view class="summary">
          <view class="text">
            经过本次问答信息收集的综合分析，检测出风险点共<text class="highlight">12</text>项，其中极高风险4项，高风险2项，中风险4项，低风险2项
          </view>
          <view class="flex charts">
            <progressCircle label="极高风险" value="4" color="#B81C1C"></progressCircle>
            <progressCircle label="高风险" value="2" color="#FF0000"></progressCircle>
            <progressCircle label="中风险" value="4" color="#FFA800"></progressCircle>
            <progressCircle label="低风险" value="2" color="#014FA2"></progressCircle>
          </view>
        </view>
        <view class="table">
          <reportTableView :list="tableList"></reportTableView>
        </view>
      </view>
    </view>

    <view class="flex flex-column contact">
      <view>扫下方二维码联系我们给你1V1解决方案</view>
      <!-- todo: check key -->
      <image class="qr" :src="configList.service" :show-menu-by-longpress="true"></image>
    </view>
    
    <view>
      <uv-parse :content="content"></uv-parse>
    </view>

  </view>
</template>

<script>
  import progressCircle from './progressCircle.vue';
  import reportTableView from './reportTableView.vue';

  export default {
    components: {
      progressCircle,
      reportTableView,
    },
    data() {
      return {
        tableList: [],
        content: '',
      }
    },
    onLoad(arg) {
      const { batchNo } = arg
      this.getData(batchNo)
    },
    methods: {
      async getData(batchNo) {
        // todo: delete
        this.tableList = [
          {
            id: '001',
            title: '风险文字内容文字内',
            children: [
              {
                id: '0011',
                reason: '风险原因文字',
                level: 0,
                result: '可能导致的结果文字内容文字内容',
              },
              {
                id: '0012',
                reason: '风险原因文字',
                level: 2,
                result: '文字内容',
              },
            ],
          },
          {
            id: '002',
            title: '风险文字内容文字内文字内文字内文字内文字内文字内',
            children: [
              {
                id: '0021',
                reason: '风险原因文字',
                level: 3,
                result: '可能导致的结果文字内容文字内容',
              },
              {
                id: '0022',
                reason: '风险原因文字',
                level: 0,
                result: '',
              },
              {
                id: '0023',
                reason: '风险原因文字',
                level: 1,
                result: '',
              },
              {
                id: '0024',
                reason: '风险原因文字',
                level: 2,
                result: '文字内容',
              },
            ],
          },
          {
            id: '003',
            title: '风险文字内容文字内',
            children: [
              {
                id: '0031',
                reason: '风险原因文字',
                level: 3,
                result: '',
              },
              {
                id: '0032',
                reason: '风险原因文字',
                level: 2,
                result: '',
              },
              {
                id: '0033',
                reason: '风险原因文字',
                level: 3,
                result: '',
              },
            ],
          },
        ]

        try {
          await this.$fetch('queryReportById', { batchNo })
        } catch (err) {

        }
      },
    },
  }
</script>

<style scoped lang="scss">
  .title {
    width: 100%;
    padding: 42rpx 0 40rpx 0;
    box-sizing: border-box;
    text-align: center;
    font-size: 30rpx;
    font-weight: 600;
    color: #000000;
  }

  .section {
    padding: 0 12rpx;

    &-header {
      justify-content: flex-start;
      column-gap: 9rpx;
      padding: 0 17rpx;
      font-size: 28rpx;
      font-weight: 600;
      color: #014FA2;

      .line {
        width: 9rpx;
        height: 33rpx;
        background: #014FA2;
        border-radius: 6rpx;
      }
    }

    &-content {
      margin-top: 30rpx;
    }
  }

  .summary {
    .text {
      padding: 20rpx 10rpx;
      font-size: 26rpx;
      color: #014FA2;
      background: rgba($color: #014FA2, $alpha: 0.16);

      .highlight {
        color: #DB5742;
      }
    }

    .charts {
      margin-top: 54rpx;
      justify-content: space-between;
      padding: 0 42rpx;
    }
  }

  .table {
    margin-top: 49rpx;
  }
  
  .contact {
    margin-top: 53rpx;
    row-gap: 40rpx;
    width: 100%;
    padding: 30rpx 0 22rpx 0;
    box-sizing: border-box;
    font-size: 28rpx;
    color: #014FA2;
    border: 1rpx dashed #014FA2;

    .qr {
      width: 157rpx;
      height: auto;
    }
  }
</style>