<template>
  <div class="app-container part-container">
    <template v-if="isInfo">
      <!-- 企业信息 -->
      <div class="view-content">
        <Info :companyInfo="companyInfo" />
      </div>
      <!-- 基本信息 -->
      <div class="view-content">
        <BasicIinformation
          :infos="infos"
          :companyType="companyType"
          :nowedit="nowedit"
          :noweditis="1"
          @focus-nowedit="focusNowedits"/>
      </div>
      <!-- 发包属性 -->
      <div class="view-content">
        <ElCardinput
          :infos="infos"
          title="发包属性"
          field="companyAttribute"
          :projectDetails="infos.companyAttribute"
          :nowedit="nowedit"
          :noweditis="2"
          @focus-nowedit="focusNowedits" />
      </div>
      <!-- 主营业务 -->
      <div class="view-content">
        <ElCardinput
          :infos="infos"
          title="主营业务"
          field="mainBusiness"
          :projectDetails="infos.mainBusiness"
          :nowedit="nowedit"
          :noweditis="3"
          @focus-nowedit="focusNowedits" />
      </div>
      <!-- 经营范围 -->
      <div class="view-content">
        <ElCardinput
          :infos="infos"
          title="经营范围"
          field="businessScope"
          :projectDetails="infos.businessScope"
          :nowedit="nowedit"
          :noweditis="4"
          @focus-nowedit="focusNowedits" />
      </div>
    </template>
  </div>
</template>

<script>
import { getDictType } from '@/api/main'
import { customerInfo } from '@/api/detail/party-a/cooperate'
import Info from "./component/info"
import BasicIinformation from "./component/basicIinformation"
import ElCardinput from "./component/elCardinput"
export default {
  name: 'Business',
  props: ['customerIds', 'companyInfo'],
  components: {
    Info,
    BasicIinformation,
    ElCardinput
  },
  data() {
    return {
      isInfo:false,
      infos:{},
      projectDetails:'',
      nowedit: -1,
      companyType: {
        companyNaturelist: [],//企业性质
        companyLevellist: [],//企业级别
        isOnlistlist:[
          {
            dictValue: 0,
            dictLabel:'否',
          },
          {
            dictValue: 1,
            dictLabel:'是',
          }
        ],//上市公司
        isMajorlist:[
          {
            dictValue: 0,
            dictLabel:'否',
          },
          {
            dictValue: 1,
            dictLabel:'是',
          }
        ],//局级大客户
        creditLevellist: [],//资信等级
      }
    }
  },
  created() {
    this.customerInfos()
    //企业性质
    getDictType('company_nature_type').then(result=>{
      this.companyType.companyNaturelist = result.code == 200 ? result.data:[]
    })
    //企业级别
    getDictType('company_level_type').then(result=>{
      this.companyType.companyLevellist = result.code == 200 ? result.data:[]
    })
    //资信等级
    getDictType('credit_level_type').then(result=>{
      this.companyType.creditLevellist = result.code == 200 ? result.data:[]
    })
  },
  methods: {
    customerInfos(){
      customerInfo(this.customerIds).then(res=>{
        this.infos = res.data
        this.isInfo = true
      })
    },
    focusNowedits(e){
      this.nowedit = e
    }
  }
}
</script>

<style lang="scss" scoped>
.part-container{
  margin: 0;
  padding: 0;
  .view-content{
    margin-top: 16px;
  }
}
</style>
