<template>
  <div class="app-container group-container">
    <div class="header-container">
      <div class="flex-box part-header">
        <img class="header-logo" :src="details && details.logoUrl || require('@/assets/images/detail/company_logo.png')">
        {{name || '--'}}
      </div>
    </div>
    <div class="flex-box group-main" ref="contentData">
      <div class="group-left">
        <side-bar ref="sidebar" :statisticObj="statisticObj" @currentPath="showPartPage" :pathName="currentPath.pathName" :customerId="customerId"/>
      </div>
      <div class="group-right">
        <div id="groupBox" v-if="customerId">
          <Members v-if="currentPath.pathName=='members'" @handle-scroll="scrollToTop" :customer-id="customerId" :isSkeleton="isSkeleton" :combineName="name"/>
          <Qualifications v-if="currentPath.pathName=='qualifications'" @handle-scroll="scrollToTop" :customer-id="customerId" :isSkeleton="isSkeleton" :combineName="name"/>
          <Landtransaction v-if="currentPath.pathName=='landtransaction'" @handle-scroll="scrollToTop" :customer-id="customerId" :isSkeleton="isSkeleton" :combineName="name"/>
          <Performance v-if="currentPath.pathName=='performance'" @handle-scroll="scrollToTop" :customer-id="customerId" :isSkeleton="isSkeleton"  :combineName="name"/>
          <Zhaobiao v-if="currentPath.pathName=='zhaobiao'" @handle-scroll="scrollToTop" :customer-id="customerId" :isSkeleton="isSkeleton"  :combineName="name"/>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import { idRemark } from '@/api/common'
  import SideBar from "./component/Sidebar"
  import Members from "./component/members"
  import Qualifications from "./component/qualifications"
  import Landtransaction from "./component/landtransaction"
  import Performance from "./component/performance"
  import Zhaobiao from "./component/zhaobiao"
  import { infoHeader } from '@/api/detail/party-a/index'
  import {combineMemberLogo,infoMemberCount} from '@/api/detail/groupAccount/groupAccount'
  export default {
    name: 'GroupAccount',
    components:{
      SideBar,Members,Qualifications,Landtransaction,Performance,Zhaobiao
    },
    data(){
      return{
        customerId: '',  //集团Id（测试默认'81de7ca2a967d91c2afad9cb5fc30e6d'）
        companyInfo: {},
        statisticObj: {},
        cooDetail: {},
        currentPath: {
          pathName: 'members'  //默认展示页
        },
        isCompany: false,
        isSkeleton: false,
        name:'',
        details:{},
      }
    },
    created() {
      if (this.$route.params.id) { // customerId
        this.customerId = this.$route.params.id
      }
      combineMemberLogo({combineId: this.customerId}).then(res=>{
        this.details=res.data;
      })
      infoMemberCount({combineId: this.customerId}).then(res=>{
        if(res.code==200){
          this.statisticObj = res.data
        }
      })
      // if (this.$route.query.path) { // 获取跳转对应板块
      //   this.currentPath.pathName = this.$route.query.path
      // }
      this.name=this.$route.query.name ? this.$route.query.name : this.details.companyName
    },
    mounted(){},
    methods: {
      showPartPage(e){
        this.currentPath = e
      },
      scrollToTop() {
        this.$nextTick(() => {
          this.$refs.contentData.scrollTop = 0
        })
      },
    }
  }
</script>

<style lang="scss" scoped>
  .group-container{
    padding: 0;
    margin-top: 0;
    margin-bottom: 0;
  }
  .group-main{
    margin-top: 12px;
    /*position: fixed;*/
    width: 100%;
    /*width: calc(100% - 192px);*/
    height: calc(100vh - 155px);
    overflow-y: auto;
    align-items: initial;
  }
  .group-left{
    margin-right: 16px;
    padding-bottom: 16px;
    position: fixed;
    background: #FFFFFF;
    width: 144px;
  }
  .group-right{
    min-width: 1088px;
    /*width: calc(100% - 162px);*/
    width: 100%;
    background: #FFFFFF;
    border-radius: 4px;
    margin-left: 160px;
    ::v-deep .el-table__header-wrapper{
      position: sticky;
      top:0;
      z-index: 9;
    }
    #groupBox{
      height: 100%;
    }
  }
  .part-header{
    font-size: 16px;
    font-weight: bold;
    color: #232323;
    background: #FFFFFF;
    padding: 14px 16px;
    margin-top: 12px;
    border-radius: 4px;
    .header-logo{
      width: 28px;
      height: 28px;
      margin-right: 16px;
    }
  }
</style>
