<template>
  <div>
    <div class="app-container">
      <div class="level-title">
        <h1>证书信息</h1>
      </div>
      <table class="table-ui">
        <tr>
          <td class="tbg">资质类型</td>
          <td>{{ pd.QUALIFICATION_TYPE_NAME }}</td>
          <td class="tbg">职业证书编号</td>
          <td>{{ pd.VOCATIONAL_CERTIFICATE_NUMBER }}</td>
        </tr>
        <tr>
          <td class="tbg">是否永久有效</td>
          <td>{{ pd.IS_PERMANENT_VALID == '1' ? '是' : '否' }}</td>
          <td class="tbg">证书有效期</td>
          <td>{{ pd.CERTIFICATE_DATE_BEGIN }} -- {{ pd.IS_PERMANENT_VALID == '1' ? '永久' : pd.CERTIFICATE_DATE_END }}</td>
        </tr>
        <tr>
          <td class="tbg">证书照片</td>
          <td colspan="3">
            <div v-if="pd.CERTIFICATE_FILEPATH" class="demo-image__preview">
              <el-image
                :src="config.fileUrl + pd.CERTIFICATE_FILEPATH"
                :preview-src-list="new Array( config.fileUrl + pd.CERTIFICATE_FILEPATH )"
                style="width: 100px; height: 100px"/>
            </div>
          </td>
        </tr>
      </table>
    </div>
    <div class="ui-height" />
    <div class="ui-foot">
      <el-button plain type="info" @click="goBack">返 回</el-button>
    </div>
  </div>
</template>

<script>
import { requestFN } from '@/utils/request'
export default {
  data() {
    return {
      config: config,
      pd: {
        NAME: '', // 教师姓名
        PHONE: '', // 手机号
        IDENTITY_NUMBER: '', // 身份证号
        EDUCATION_LEVEL_NAME: '', // 文化程度
        PROFESSION_NAME: '', // 专业
        IDENTITY_FILEPATH_FRONT: '', // 身份证照片（正面）
        IDENTITY_FILEPATH_REVERSE: '', // 身份证照片（反面）
        DIPLOMA_FILEPATH: '', // 毕业证照片
        CERTIFICATE_FILEPATH: '', // 资格证照片
        certificateList: [] // 证书信息
      }
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      requestFN(
        '/teachercertificate/goEdit',
        {
          TEACHERCERTIFICATE_ID: this.$parent.TEACHERCERTIFICATE_ID
        }
      ).then((data) => {
        this.pd = Object.assign({}, data.pd) // copy obj
      }).catch((e) => {
      })
    },
    goBack() {
      this.$parent.TEACHERCERTIFICATE_ID = ''
      this.$parent.activeName = 'CertificateList'
    }
  }
}
</script>

<style scoped>
</style>
