
<!--
  @description:专家职称信息查看组件
  @Modifier: wxy
  @routerPath:
  @date:  2020-09-08 10:10:43
-->
<template>
  <div class="projectInfoDetail">
    <div class="page-title">
      4.职称信息
    </div>
    <section>
      <el-table ref="smallTable" :data="tableData" class="tableLimit" border>
        <el-table-column
          prop="certificateName"
          label="证书名称"
          header-align="center"
          align="center"
          min-width="140"
        />
        <el-table-column
          prop="certificateNo"
          label="证书编号"
          header-align="center"
          align="center"
          min-width="140"
        />
        <el-table-column
          prop="titleLevel"
          label="职称等级"
          header-align="center"
          align="center"
          min-width="140"
        >
          <template slot-scope="scope">
            <span>{{ filterDictText(titleLevelList, scope.row.titleLevel) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="authorityName"
          label="颁发机构"
          header-align="center"
          align="center"
          min-width="140"
        />
        <el-table-column label="获得时间" align="center" width="150" header-align="center">
          <template slot-scope="scope">
            <span>{{ scope.row.acquisitionDate }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" min-width="150" fixed="right">
          <template slot-scope="scope">
            <el-link
              type="primary"
              @click.stop="clickDetail(scope.row)"
            >
              [查看]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
    </section>
    <ExpertTitltInfoDetailDialog v-if="dialogData.dialog" :dialog-data="dialogData" />
  </div>
</template>

<script>
/* 公共方法 */
import { filterDictText } from '@/assets/js/utils'
import { expertInfo } from '../../expertInfo/mixins/expertInfo'
/* 接口*/
import { getExpertTitlesById } from '@/api/expert/expertscloud'
import { queryexpertTitlesLisByApplyId } from '@/api/expert/expertChange'
/* 组件 */
import ExpertTitltInfoDetailDialog from '@/views/expert/experImprovetBaseInfo/expertTitleInfo/expertTitltInfoDetail-dialog.vue'
export default {
  components: {
    ExpertTitltInfoDetailDialog
  },
  mixins: [expertInfo],
  data() {
    return {
      tableData: [], // 职称信息
      type: this.$route.query.type, // 页面类型
      dialogData: {
        dialog: false, // 展示状态
        id: '' // 编辑时才会有财务状况id
      }
    }
  },
  created() {
    // 获取职称信息
    this.initData()
  },
  methods: {
    filterDictText, // 引入字典值替换文本通用方法
    initData() {
      const data = {
        expertId: this.$route.params.expertId
      } // 专家id
      if (this.type === 'declarationChange') {
        queryexpertTitlesLisByApplyId(data).then(res => {
          this.tableData = res.data.records // 职称信息
        })
      } else {
        const expertId = this.$route.query.id
        if (expertId) {
          data.expertId = expertId
        }
        getExpertTitlesById(data).then(res => {
          this.tableData = res.data.records // 职称信息
        })
      }
    },
    clickDetail(row) {
      this.dialogData = {
        dialog: true,
        id: row.id
      }
    }
  }
}
</script>

<style lang='less' scoped>
.baseInfo{
   font-weight: bolder;
}
</style>
