<!--
  @description: 供应商申报材料-查看页面
  @Modifier:肖文龙
  @routerPath:/supplierDeclaration/editorDeclaration-detail
  @date: 2020/2/21-15:41
-->
<template>
  <div style="position:relative;">
    <el-tabs v-model="activeName" class="el-tabs-border-card-shadow-none" type="border-card">
      <el-tab-pane name="essentialInformation" label="基本信息">
        <essentialInformationDetail class="p0-16" @showStatuschage="showStatuschage" />
      </el-tab-pane>
      <el-tab-pane name="businessManagerInfo" label="业务经办人信息">
        <businessManagerInfoDetail class="p0-16" />
      </el-tab-pane>
      <el-tab-pane name="enterpriseQualification" label="企业资质">
        <enterpriseQualificationDetail class="p0-16" />
      </el-tab-pane>
      <el-tab-pane name="supplYrecord" label="供货记录">
        <supplYrecordDetail class="p0-16" />
      </el-tab-pane>
      <el-tab-pane name="financialSituation" label="财务状况">
        <financialSituationDetail class="p0-16" />
      </el-tab-pane>
      <!-- 审核信息 -->
      <!--      <inforaMtionAuditDetail />-->
    </el-tabs>
    <!--审核状态图片-->
    <div class="supper_auditStatus">
      <!-- 待审核 -->
      <img v-if="showStatus==='00' && type !== 'audit'" src="@assets/img/common/audit/auditWait.png" alt="">
      <!-- 审核通过 -->
      <img v-if="showStatus==='01' && type !== 'audit'" src="@assets/img/common/audit/auditOk.png" alt="">
      <!-- 审核不通过 -->
      <img v-if="showStatus==='02' && type !== 'audit'" src="@assets/img/common/audit/auditNo.png" alt="">
    </div>
  </div>
</template>
<script>
/* 接口*/
import { getUpdateDepartInfo } from '@/api/supplier/supplierBaseInfo'// 获取
import essentialInformationDetail from './../essentialInformation/essentialInformation-detail'// 审报材料-查看基本信息
import businessManagerInfoDetail from './../businessManagerInfo/businessManagerInfo-detail'// 审报材料-业务经办人信息
import enterpriseQualificationDetail from './../enterpriseQualification/enterpriseQualification-detail'// 审报材料-企业资质
import supplYrecordDetail from './../supplYrecord/supplYrecord-detail'// 审报材料-供货记录
import financialSituationDetail from './../financialSituation/financialSituation-detail'// 审报材料-财务状况
// import inforaMtionAuditDetail from './../inforaMtionAudit/inforaMtionAudit-detail'// 审报材料-审核信息
export default {
  name: 'EditorDeclarationDetail',
  components: {
    essentialInformationDetail, // 审报材料-查看基本信息
    businessManagerInfoDetail, // 审报材料-业务经办人信息
    enterpriseQualificationDetail, // 审报材料-企业资质
    supplYrecordDetail, // 审报材料-供货记录
    financialSituationDetail // 审报材料-供货记录
    // inforaMtionAuditDetail // 审报材料-审核信息
  },
  provide() {
    return {
      departId: this.$route.params.departId || ''
    }
  },
  props: {
    judgePageData: {
      type: Object,
      default: () => {
        return {
          departId: '', // 供应商id
          declarationId: '', // 申报id
          isViewPage: '', // 非变更查看页面传01 否则传空
          departInfoId: '' // 申报id
        }
      }
    }
  },
  data() {
    return {
      activeName: 'essentialInformation', // 索引
      showStatus: '', // 展示状态 00待审核 01审核通过 02审核不通过/驳回
      type: this.$route.params.type || '',
      departData: {
        departId: '',
        declarationId: '',
        isViewPage: ''
      }
    }
  },
  created() {
    this.initData()
  },
  methods: {
    // 获取基本信息-判断是否已提交
    initData() {
      this.departData.departId = this.$route.params.departId || this.departData.departId || ''
      this.departData.isViewPage = this.$route.params.isViewPage || this.$route.query.isViewPage || ''
      const params = {
        departId: this.judgePageData.departId,
        declarationId: this.judgePageData.declarationId, // 申报id
        isViewPage: this.judgePageData.isViewPage // 判断是否为变更数据
      }
      getUpdateDepartInfo(params).then((response) => {
        const { showStatus } = response.data
        this.showStatus = showStatus// 展示状态 00查看 01不可编辑 02可编辑
        this.departData.departId = response.data.info.departId
      })
    },
    // 接收基本信息传的参数-审核状态-审核图片展示
    showStatuschage(showStatus, declarationAuditStatus) {
      if (this.type === 'audit') {
        this.showStatus = declarationAuditStatus
      } else {
        this.showStatus = showStatus
      }
    }
  }
}
</script>

<style lang="less" scoped>
// 申报图片
.supper_auditStatus{
  position: absolute;
  top: 10px;
  right:100px;
}
</style>
