<!--
  @description: 业务经办人信息-查看
  @Modifier: 肖文龙
  @routerPath:
  @date: 2020-5-23
-->
<template>
  <div>
    <el-button
      v-if="ChangeDetailBtn"
      type="primary"
      style="margin-bottom: 10px"
      @click="handleChangeDetail"
    >
      查看变更内容
    </el-button>
    <table v-for="(item,index) in listArray" :key="index" class="tableData">
      <tr>
        <td :style="{'border-top':index>0?'0px':''}" colspan="4" style="text-align: left;font-weight: bold;">
          业务经办人{{ index+1 }}
        </td>
      </tr>
      <tr>
        <td>姓名</td>
        <td>{{ item.linkname }}</td>
        <td>身份证号或护照号</td>
        <td>{{ item.linkerID }}</td>
      </tr>
      <tr>
        <td>手机</td>
        <td>{{ item.linktel }}</td>
        <td>邮箱</td>
        <td>{{ item.email }}</td>
      </tr>
      <tr>
        <td>身份证或护照扫描件</td>
        <td><downloadFile v-if="item.identityCardData.bizId" :data="item.identityCardData" /></td>
        <td>授权书扫描件</td>
        <td><downloadFile v-if="item.letterAttorneyData.bizId" :data="item.letterAttorneyData" /></td>
      </tr>
    </table>
    <!--审核信息-->
    <inforaMtionAuditDetail v-if="!judgePageData.detailType" />
    <!--查看变更内容弹框-->
    <businessManagerInfoDifferenceDialog :dialog-data="businessManagerInfoDifferenceDialog" />
  </div>
</template>

<script>
/* 接口*/
import { getUpdateLinker } from '@/api/supplier/supplierBaseInfo'// 获取
/* 混合开发*/
import { declareHegSupperMixins } from '@/views/supplier/editorDeclaration/mixins/declareHegSupperMixins'// 供应商-公用方法参数
import { supplierGroupMixin } from '@/views/supplier/mixins/supplierGroupMixin'
/* 组件 */
import downloadFile from '@comp/common/updownload/downloadFile'// 附件
import businessManagerInfoDifferenceDialog from '@/views/supplier/editorDeclaration/businessManagerInfo/businessManagerInfoDifference-dialog' // 查看变更内容-弹窗
import inforaMtionAuditDetail from '@/views/supplier/editorDeclaration/inforaMtionAudit/inforaMtionAudit-detail'// 审报材料-审核信息
export default {
  name: 'BusinessManagerInfoDetail',
  components: {
    businessManagerInfoDifferenceDialog, // 查看变更内容-弹窗
    downloadFile, // 附件
    inforaMtionAuditDetail // 审核信息
  },
  mixins: [declareHegSupperMixins, supplierGroupMixin],
  props: {
    judgePageData: {
      type: Object,
      default: function() {
        return {
          declarationId: '', // 申报id
          departId: '', // 供应商主键id
          isViewPage: '', // 查看基本信息
          departInfoId: '' // 变更提交携带参数
        }
      }
    }
  },
  data() {
    return {
      pageType: this.$route.meta.type,
      ChangeDetailBtn: false, // 查看变更内容
      bizType: this.$route.params.bizType,
      declarationId: this.$route.params.declarationId || this.judgePageData.declarationId || '', // 申报记录id
      isViewPage: this.judgePageData.isViewPage || '', // 是否是供应商本人登录
      departId: this.$route.params.departId || this.judgePageData.departId || '', // 供应商id
      businessManagerInfoDifferenceDialog: {
        dialog: false, // 变更查看
        id: this.judgePageData.departInfoId
      },
      tabType: '01' // 切换内容——业务经办人信息
    }
  },
  watch: {
    'judgePageData.isViewPage'(val) {
      this.isViewPage = val
      this.getUpdateLinker()
    }
  },
  created() {
    // 判断是否是变更审核
    this.bizType = this.$route.params.bizType || ''
    this.ChangeDetailBtn = this.bizType === '02' ? [] : false
    if (this.$route.meta.type === 'audit') {
      // 判断是否是申报审核
      this.reviewSource = this.bizType === '01' ? [] : false
      // 判断是否是变更审核页面
      this.isViewPage = this.bizType === '02' ? '' : '01'
      // 判断是否是申报审核页面
      this.declarationId = this.bizType === '01' ? this.$route.params.bizId : ''
    }
    // 判断是否为初审审核页面
    if (this.$route.meta.type === 'declarationFirst' || this.$route.meta.type === 'declarationChange' || this.$route.meta.type === 'audit' || this.judgePageData.detailType === 'dialog') {
      // declarationFirst 编辑申报材料查看 declarationChange 申报材料变更时 audit 初审审核时
      this.getUpdateLinker()// 获取编辑申报材料/初审业务经办人
    }
  },
  methods: {
    // 获取编辑申报材料/初审业务经办人
    getUpdateLinker() {
      const params = {
        departId: this.departId,
        declarationId: this.declarationId, // 申报id
        isViewPage: this.isViewPage // 判断是否为变更数据
      }
      getUpdateLinker(params).then((response) => {
        if (response.data.linkerlist && response.data.linkerlist.length > 0) {
          this.listArray = response.data.linkerlist
        }
      })
    },
    // 查看审核信息
    handleChangeDetail() {
      this.businessManagerInfoDifferenceDialog.dialog = true
    }
  }
}
</script>

<style lang="less" scoped>

</style>
