<template>
  <a-card :bordered="false" :class="$style.newcard">
    <a-tabs v-model="activeKey" type="line" @change="toggleTabs">
      <a-tab-pane key="1" tab="审计问题">
        <audit-find-list ref="auditFindList" :project-id="projectId"></audit-find-list>
      </a-tab-pane>
      <a-tab-pane key="3" tab="审计建议及风险">
        <xm-audit-find-list ref="xmAuditFindList" :project-id="projectId"></xm-audit-find-list>
      </a-tab-pane>
      <a-tab-pane key="2" tab="审计报告">
        <audit-report-list ref="auditReportList" :project-id="projectId"></audit-report-list>
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>

<script>
import auditFindList from './find/iam-audit-find-list.vue'
import xmAuditFindList from './find/xm-audit-find-list.vue'
import auditReportList from './report/iam-audit-report-list.vue'
import components from './_import-components/audit-report-list-import'

export default {
  name: 'AuditReportList',
  metaInfo: {
    title: '审计报告列表',
  },
  components: { auditFindList, xmAuditFindList, auditReportList, ...components },
  data() {
    return {
      activeKey: '1',
      projectId: '',
    }
  },
  created() {
    const projectId = this.$route.query.projectId
    if (projectId) {
      this.projectId = projectId
    }
  },
  methods: {
    toggleTabs(key) {
      this.activeKey = key
      let dataTable = ''
      if (this.activeKey === '1') {
        dataTable = 'auditFindList'
      }
      if (this.activeKey === '3') {
        dataTable = 'xmAuditFindList'
      }
      if (this.activeKey === '2') {
        dataTable = 'auditReportList'
      }
      // 初始化信息
      setTimeout(() => {
        this.$refs[`${dataTable}`].refresh()
      }, 500)
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;

.newcard {
  margin-top: -7px;
  :global(.ant-card-body) {
    padding: 0;
  }
}
</style>
