<template>
  <div class="main-content">
    <el-tabs v-model="activeName" type="border-card" @tab-click="handleTabClick">
      <el-tab-pane :label="basicInfo.reviewType === 'project' ? '项目' : '核心企业'" name="porject">
        <project v-if="basicInfo.reviewType === 'project'" ref="projectPage" :basic-info="basicInfo" />
        <company v-if="basicInfo.reviewType === 'coreEnterprise'" ref="enterprisePage" :basic-info="basicInfo" />
        <div class="submit-btn">
          <el-button @click="$router.push({name: 'ProjectCredit'})">取消</el-button>
          <el-button type="primary" @click="auditSubmit('temp')">暂存</el-button>
          <el-button type="primary" @click="auditSubmit('submit')">提交</el-button>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  components: {
    Project: () => import('./components/Project/index'),
    Company: () => import('./components/Company/index')
  },
  props: {
    basicInfo: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      activeName: 'porject'
    }
  },
  created() {
    console.log(this.basicInfo)
  },
  methods: {
    handleTabClick(tab) {
      this.activeName = tab.name
    },
    auditSubmit(type) {
      if (this.basicInfo.reviewType === 'project') {
        this.$refs.projectPage.assessClick(type)
      } else if (this.basicInfo.reviewType === 'coreEnterprise') {
        this.$refs.enterprisePage.assessClick(type)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.main-content {

}
</style>
