<template>
  <div class="company-box">
    <cy-info-title type="collapse" name="核心企业">
      <core-enterprise ref="core" :details="coreEnterpriseInfo" :disabled="true" />
    </cy-info-title>
    <cy-info-title v-if="hasHistory" type="collapse" name="历史合作情况">
      <history-cooperation ref="history" :details="historyInfo" :disabled="true" />
    </cy-info-title>
    <cy-info-title type="collapse" name="核心企业审核">
      <auditing ref="audit" :details="auditInfo" :disabled="true" />
    </cy-info-title>
    <assess :assess-info="assessResult" :disabled="true" />

    <div class="submit-btn">
      <el-button @click="$router.push({name: 'ProjectCredit'})">返回</el-button>
    </div>
  </div>
</template>

<script>
export default {
  components: {
    CoreEnterprise: () => import('../../dueReview/components/Company/CoreEnterprise.vue'),
    HistoryCooperation: () => import('../../dueReview/components/Company/HistoryCooperation.vue'),
    Auditing: () => import('../../dueReview/components/Company/Auditing.vue'),
    Assess: () => import('../../dueReview/components/Company/Assess.vue')
  },
  provide() {
    return {
      disabled: true
    }
  },
  props: {
    detailsInfo: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      hasHistory: 0,
      detailInfo: {},
      coreEnterpriseInfo: {},
      historyInfo: {},
      auditInfo: {},
      assessResult: {}
    }
  },
  watch: {
    detailsInfo: {
      handler(newV) {
        if (newV && Object.keys(newV).length) {
          this.detailInfo = JSON.parse(JSON.stringify(newV))
          // 核心企业信息
          const { projectCoreEnterprise, enterpriseNature, regStocks, involvingLitigationAccessCcount, administrativePenaltyAccessCcount, administrativePenaltyAmount, environmentalPenaltyAmount, privateLendings, equityFreezeDataList, majorAnomalies, seriousIllegalData, taxOweNoticeData, taxIllegalData, blacklists, exceptionData, news, projectCoreEnterpriseComprehensiveEvaluations, evaluationOpinions, involvingLitigationAccess, administrativePenaltyAccess, administrativePenaltyAmountAccess, environmentalPenaltyAmountAccess, holdingRatio, equityHierarchy, equityHierarchyDetail } = this.detailInfo
          const { id,
            cEnterpriseHistoryId,
            cProjectInformationId,
            enterprise,
            centralizedProcurementPlatform,
            historicalCooperation,
            historicalCooperationDuration,
            historicalCooperationInvoicingAmount,
            historicalCooperationMaximumAccountingPeriod,
            historicalCooperationScale,
            historicalCooperationTimes,
            projectCoreEnterpriseFiles } = projectCoreEnterprise
          const { corporateName } = enterprise
          this.coreEnterpriseInfo = {
            id,
            cEnterpriseHistoryId,
            cProjectInformationId,
            corporateName,
            centralizedProcurementPlatform,
            historicalCooperation
          }
          this.hasHistory = historicalCooperation

          // 历史合作情况
          this.historyInfo = {
            historicalCooperationDuration,
            historicalCooperationInvoicingAmount,
            historicalCooperationMaximumAccountingPeriod,
            historicalCooperationScale,
            historicalCooperationTimes,
            projectCoreEnterpriseFiles
          }

          // 核心企业审核
          this.auditInfo = { enterpriseNature, regStocks, involvingLitigationAccessCcount, administrativePenaltyAccessCcount, administrativePenaltyAmount, environmentalPenaltyAmount, privateLendings, equityFreezeDataList, majorAnomalies, seriousIllegalData, taxOweNoticeData, taxIllegalData, blacklists, exceptionData, news, evaluationOpinions, involvingLitigationAccess, administrativePenaltyAccess, administrativePenaltyAmountAccess, environmentalPenaltyAmountAccess, holdingRatio, equityHierarchy, equityHierarchyDetail }

          // 准入结论
          this.assessResult = projectCoreEnterpriseComprehensiveEvaluations
        }
      },
      immediate: true,
      deep: true
    }
  }
}
</script>

<style lang="scss" scoped>
.company-box {

}
</style>
