<template>
  <div class="app-warp">
    <div class="detail-structure">
      <el-page-header content="详情页面" @back="goBack"/>
      <div class="detail-container">
        <div class="level-title">
          <h1>教师信息</h1>
        </div>
        <div class="detail_view">
          <table class="table-ui">
            <tr>
              <td class="tbg">教师姓名</td>
              <td>{{ pd.NAME }}</td>
              <td class="tbg">身份证号</td>
              <td>{{ pd.IDENTITY_NUMBER }}</td>
            </tr>
            <tr>
              <td class="tbg">文化程度</td>
              <td>{{ pd.EDUCATION_LEVEL_NAME }}</td>
              <td class="tbg">专业</td>
              <td>{{ pd.PROFESSION }}</td>
            </tr>
            <tr>
              <td class="tbg">工作年限</td>
              <td>{{ pd.WORKYEAR }}</td>
              <td class="tbg">考核部门</td>
              <td>{{ pd.ASSESSMENTDEPARTMENT }}</td>
            </tr>
            <tr>
              <td class="tbg">考核时间</td>
              <td>{{ pd.ASSESSMENTTIME }}</td>
              <td class="tbg">考核结果</td>
              <td>{{ pd.ASSESSMENTRESULT }}</td>
            </tr>
          </table>
        </div>
        <div class="level-title">
          <h1>证书信息</h1>
        </div>
        <div class="detail_view">
          <table v-for="item in pd.certificateList" :key="item.TEACHERCERTIFICATE_ID" class="table-ui">
            <tr>
              <td class="tbg">资质类型</td>
              <td>{{ item.QUALIFICATION_TYPE_NAME }}</td>
              <td class="tbg">职业证书编号</td>
              <td>{{ item.VOCATIONAL_CERTIFICATE_NUMBER }}</td>
            </tr>
            <tr>
              <td class="tbg">是否永久有效</td>
              <td>{{ item.IS_PERMANENT_VALID == '1' ? '是' : '否' }}</td>
              <td class="tbg">证书有效期</td>
              <td>{{ item.CERTIFICATE_DATE_BEGIN }} -- {{ item.IS_PERMANENT_VALID == '1' ? '永久' : item.CERTIFICATE_DATE_END }}</td>
            </tr>
            <tr>
              <td class="tbg">证书照片</td>
              <td colspan="3">
                <div class="demo-image__preview">
                  <el-image
                    :src="config.fileUrl + item.CERTIFICATE_FILEPATH"
                    :preview-src-list="new Array( config.fileUrl + item.CERTIFICATE_FILEPATH )"
                    style="width: 210px; height: 132px"/>
                </div>
              </td>
            </tr>
          </table>
        </div>
        <div class="detail_foot">
          <el-button icon="el-icon-arrow-left" @click="goBack">返回</el-button>
        </div>
      </div>

    </div>
  </div>
</template>

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

<style scoped>
</style>
