<!--
  @description: 查看机构之公司基本信息
  @author: change by sunxinman
  @routerPath: /systemManagement/lookMachine/companyInfo
  @date:  2019/10/45-03:33
-->
<template>
  <div>
    <!--机构详情-->
    <template v-if="isRegisterType === '00'">
      <div class="page-title">
        Ⅰ 基本信息
      </div>
      <table class="tableData">
        <tr>
          <td>机构名称</td>
          <td colspan="3">
            {{ formData.departName }}
          </td>
        </tr>
        <tr>
          <td>地区</td>
          <td>{{ filterDictText(areaList, formData.area) }}</td>
          <td>注册类型</td>
          <td>{{ filterDictText(registerTypeList, formData.registerType) }}</td>
        </tr>
        <tr>
          <td>交易主体类型</td>
          <td>{{ filterDictText(departRoleNameList, formData.departRoleName) }}</td>
          <td>区域</td>
          <td>{{ formData.areaValue }}</td>
        </tr>
        <tr>
          <td>机构类型</td>
          <td>{{ filterDictText(orgTypeList, formData.orgType) }}</td>
          <td>是否可用</td>
          <td>{{ filterDictText(useStatusList, formData.useStatus) }}</td>
        </tr>
        <!--境外展示-->
        <template v-if="formData.area === '01'">
          <tr>
            <td>国家/地区</td>
            <td>{{ formData.orgCountry }}</td>
            <td>企业人数</td>
            <td>{{ formData.unitScape }}</td>
          </tr>
          <tr>
            <td>行政区域</td>
            <td>{{ formData.areaAdministration }}</td>
            <td>企业类别</td>
            <td>{{ formData.entCategory }}</td>
          </tr>
        </template>
        <tr>
          <td>法定代表人</td>
          <td>{{ formData.corporation }}</td>
          <td>企业性质</td>
          <td>{{ formData.entPrpt }}</td>
        </tr>
        <tr>
          <td>所属行业</td>
          <td>{{ formData.belongindustry }}</td>
          <td>企业人数</td>
          <td>{{ formData.unitScape }}</td>
        </tr>
        <tr>
          <td>资质等级</td>
          <td>{{ formData.qualevelValue }}</td>
          <td>成立时间</td>
          <td>
            {{ formData.foundingTime && $Moment(formData.foundingTime).format(momentDate) }}
          </td>
        </tr>
        <tr>
          <td>企业类别</td>
          <td colspan="3">
            {{ formData.entCategory }}
          </td>
        </tr>
        <tr>
          <td>公司简介</td>
          <td colspan="3">
            {{ formData.descr }}
          </td>
        </tr>
      </table>
      <div class="page-title">
        Ⅱ 机构资质
      </div>
      <!--境外展示-->
      <template v-if="formData.area === '01'">
        <table class="tableData">
          <tr>
            <td>证件类型</td>
            <td>境外经营活动证明</td>
            <td>核发机关机构</td>
            <td>{{ formData.issuingOrg }}</td>
          </tr>
          <tr>
            <td>经营范围</td>
            <td colspan="3">
              {{ formData.busyScope }}
            </td>
          </tr>
          <tr>
            <td>境外活动证明号</td>
            <td colspan="3">
              {{ formData.overseasNo }}
            </td>
          </tr>
          <tr>
            <td>境外活动证件扫描件</td>
            <td colspan="3">
              <downloadFile :data="overseasUpLoadData" />
            </td>
          </tr>
        </table>
      </template>
      <!--境内展示-->
      <template v-if="formData.area === '00'">
        <table class="tableData">
          <tr>
            <td>营业执照号</td>
            <td>{{ formData.businesslicence }}</td>
            <td>核发机关机构</td>
            <td>{{ formData.issuingOrg }}</td>
          </tr>
          <tr>
            <td>经营范围</td>
            <td colspan="3">
              {{ formData.busyScope }}
            </td>
          </tr>
          <tr>
            <td>营业执照扫描件</td>
            <td colspan="3">
              <downloadFile :data="businessUpLoadData" />
            </td>
          </tr>
        </table>
      </template>
    </template>
    <!--自然人信息详情-->
    <naturalPersonDetail v-if="isRegisterType === '01'" :form-data="formData" />
  </div>
</template>

<script>
import { getDepartInfo } from '@/api/rolemanagment/organization'
import { organizationCommonMixin } from '../mixins/organizationCommonMixin'
import { organizationGroupMixin } from '../mixins/organizationGroupMixin'
import { filterDictText } from '@/assets/js/utils'// 常用方法
// 组件
import downloadFile from '@comp/common/updownload/downloadFile' // 获取附件信息 下载组件
import naturalPersonDetail from './naturalPerson-detail'

export default {
  name: 'CompanyInfo',
  components: {
    downloadFile, // 文件下载
    naturalPersonDetail // 查看自然人信息详情
  },
  mixins: [organizationCommonMixin, organizationGroupMixin],
  mounted() {
    const departId = this.$route.query.departId
    getDepartInfo({ departId }).then(response => {
      const { data: { info, departParent, depart, linkerlist, finance }} = response
      this.isRegisterType = info.registerType // 判断显示自然人模块或者机构模块
      this.businessUpLoadData.bizId = depart.id // 营业执照扫描件
      this.overseasUpLoadData.bizId = depart.id // 境外活动扫描件
      // registerType 00:机构,01:自然人
      if (info.registerType === '00') {
        this.formData = Object.assign(this.formData, info, departParent, depart)
        // 交易主体类型
        if (info.departRoleName) {
          this.formData.departRoleName = info.departRoleName
        }
      } else {
        this.formData.area = info.area
        this.formData.registerType = info.registerType
        if (linkerlist.length > 0) this.formData.linker = linkerlist[0]
        this.formData.finance = finance
      }
    }).catch(() => {
    })
  },
  methods: {
    filterDictText
  }
}
</script>

<style lang="less" scoped>
</style>
