<template>
  <a-card :bordered="false" :class="$style.newcard">
    <a-tabs v-model="activeKey" type="line" @change="toggleTabs">
      <a-tab-pane key="1" tab="综合文档">
        <audit-comdocument-list
          ref="auditComdocumentList"
          :project-id="projectId"
        ></audit-comdocument-list>
      </a-tab-pane>
      <a-tab-pane key="2" tab="项目台账">
        <audit-account-list ref="auditAccountList" :project-id="projectId"></audit-account-list>
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>

<script>
import auditComdocumentList from '@product/iam/audit/work/projectmanage/comdocument/audit-comdocument-list'
import auditAccountList from '@product/iam/audit/work/projectmanage/account/audit-account-list'
import components from './_import-components/audit-projectmanage-list-import'

export default {
  name: 'AuditProjectManageList',
  metaInfo: {
    title: '审计作业项目管理列表',
  },
  components: { auditComdocumentList, auditAccountList, ...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 = 'auditComdocumentList'
      }
      if (this.activeKey === '2') {
        dataTable = 'auditAccountList'
      }
      // 初始化信息
      setTimeout(() => {
        this.$refs[`${dataTable}`].refreshDataTable()
      }, 500)
    },
  },
}
</script>

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

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