<template>
  <div class="app-container part-container">
    <Header :company-id="companyId" v-if="companyId" />
    <div class="flex-box part-main">
      <div class="part-left">
        <side-bar @currentPath="showPartPage" :pathName="currentPath.pathName" :partBoxHeight="partBoxHeight" />
      </div>
      <div class="part-right">
        <div id="partBox" v-if="companyId">
          <Overview v-if="currentPath.pathName=='overview'" />
          <Businfo v-if="currentPath.pathName=='businfo'" :company-id="companyId" />
          <Holderinfo v-if="currentPath.pathName=='holderinfo'" :company-id="companyId" />
          <Execuinfo v-if="currentPath.pathName=='execuinfo'" :company-id="companyId" />
          <Overseas v-if="currentPath.pathName=='overseas'" :company-id="companyId" />
          <Branch v-if="currentPath.pathName=='branch'" :company-id="companyId" />
          <Financial v-if="currentPath.pathName=='financial'" :company-id="companyId" />
          <Business v-if="currentPath.pathName=='business'" />
          <!-- 投诚分析 -->
          <LandAcquisition v-if="currentPath.pathName=='landAcquisition'" />
          <RegionalEconomies v-if="currentPath.pathName=='regionalEconomies'" />
          <SameRegion v-if="currentPath.pathName=='sameRegion'" />
          <!-- 风险信息 -->
          <Punish v-if="currentPath.pathName=='punish'" />
          <BusinessAnomaly v-if="currentPath.pathName=='businessAnomaly'" />
          <IfThePerson v-if="currentPath.pathName=='ifThePerson'" />
          <Dishonesty v-if="currentPath.pathName=='dishonesty'" />
          <Judgment v-if="currentPath.pathName=='judgment'" />
          <CourtNotice v-if="currentPath.pathName=='courtNotice'" />
          <OpenacourtsessionNotice v-if="currentPath.pathName=='openacourtsessionNotice'" />
          <!-- 招标偏好 -->
          <Preference v-if="currentPath.pathName=='preference'" />
          <!-- 合作情况 -->
          <Cooperate v-if="currentPath.pathName=='cooperate'" />
          <!-- 决策链条 -->
          <DecisionMaking v-if="currentPath.pathName=='decisionMaking'" />
          <!-- 跟进记录 -->
          <Gjjl v-if="currentPath.pathName=='gjjl'" types="gjdt" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { idRemark } from '@/api/common'
import elementResizeDetectorMaker from "element-resize-detector"
import Header from "./component/Header"
import SideBar from "./component/Sidebar"
import Overview from "./overview/overview"  //企业概览-企业速览
import Businfo from "./overview/businfo"   //企业概览-工商信息
import Holderinfo from "./overview/holderinfo"   //企业概览-股东信息
import Execuinfo from "./overview/execuinfo"   //企业概览-高管信息
import Overseas from "./overview/overseas"   //企业概览-对外投资
import Branch from "./overview/branch"   //企业概览-分支机构
import Financial from "./financial" //财务简析
import Business from "./business" //商务信息
import LandAcquisition from "./urbanLnvestment/landAcquisition" //投诚分析-城投拿地
import RegionalEconomies from "./urbanLnvestment/regionalEconomies" //投诚分析-区域经济
import SameRegion from "./urbanLnvestment/sameRegion" //投诚分析-同地区城投
import Punish from "./riskInformation/punish" //风险信息-行政处罚
import BusinessAnomaly from "./riskInformation/businessAnomaly" //风险信息-经营异常
import IfThePerson from "./riskInformation/ifThePerson" //风险信息-被执行人
import Dishonesty from "./riskInformation/dishonesty" //风险信息-失信被执行
import Judgment from "./riskInformation/judgment" //风险信息-判决文书
import CourtNotice from "./riskInformation/courtNotice" //风险信息-法院公告
import OpenacourtsessionNotice from "./riskInformation/openacourtsessionNotice" //风险信息-开庭公告
import Preference from "./preference" //招标偏好
import Cooperate from "./cooperate" //合作情况
import DecisionMaking from "./decisionMaking" //决策链条
import Gjjl from "../../project/projectList/component/gjjl" //跟进记录
export default {
  name: 'PartyA',
  components: {
    Header,
    SideBar,
    Overview,
    Businfo,
    Holderinfo,
    Execuinfo,
    Overseas,
    Branch,
    Financial,
    Business,
    LandAcquisition,
    RegionalEconomies,
    SameRegion,
    Punish,
    BusinessAnomaly,
    IfThePerson,
    Dishonesty,
    Judgment,
    CourtNotice,
    OpenacourtsessionNotice,
    Preference,
    Cooperate,
    DecisionMaking,
    Gjjl
  },
  data() {
    return {
      companyId: 3068,  //企业Id（测试默认3068）
      currentPath: {
        pathName: 'overview'  //默认展示页
      },
      partBoxHeight: null
    }
  },
  created() {
    if (this.$route.query.companyId) { // 获取companyId
      let id = this.$route.query.companyId
      this.getCompanyId(id)
    }
    if (this.$route.query.path) { // 获取跳转对应板块
      this.currentPath.pathName = this.$route.query.path
    }
  },
  mounted() {
    const _this = this, erd = elementResizeDetectorMaker(), partBox = document.getElementById("partBox")
    erd.listenTo(partBox, element => {
      _this.$nextTick(() => {
        _this.partBoxHeight = partBox.offsetHeight
      })
    })
  },
  methods: {
    showPartPage(e){
      this.currentPath = e
    },
    // 解密
    async getCompanyId(companyId){
      let { data } = await idRemark({companyId})
      if( data.code == 200){
        this.companyId = data.data
      }
    }
  }
}
</script>

<style lang="scss" scoped>
  .part-container{
    padding: 0;
  }
  .part-main{
    margin-top: 12px;
    align-items: initial;
  }
  .part-left{
    margin-right: 16px;
  }
  .part-right{
    min-width: 1088px;
    width: 100%;
  }
</style>
