<!--
  @description:专家任职经历查看组件
  @Modifier: wxy
  @routerPath:
  @date:  2020-09-08 9:41:26
-->
<template>
  <div class="projectInfoDetail">
    <div class="page-title">
      2.任职经历
    </div>
    <section>
      <el-table ref="smallTable" :data="tableData" class="tableLimit" border>
        <el-table-column
          prop="comName"
          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>{{ $Moment(scope.row.startDate).format(momentDate) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="postName"
          label="职务"
          header-align="center"
          align="center"
          min-width="140"
        />
        <el-table-column
          prop="specialty"
          label="从事专业"
          header-align="center"
          align="center"
          min-width="140"
        />
        <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>
    <WorkExperienceDetailDialog v-if="dialogData.dialog" :dialog-data="dialogData" />
  </div>
</template>

<script>
import { commonMxin } from '@/mixins/commonMxin'
/* 接口*/
import { getExpertCareerById } from '@/api/expert/expertscloud'
import { queryAllTBExpertCareerHistoryForUpdate } from '@/api/expert/expertChange'//  完善基本信息提交接口
/* 组件 */
import WorkExperienceDetailDialog from '@/views/expert/expertInfo/expertWorkPerience/workExperienceDetail-dialog'
export default {
  components: {
    WorkExperienceDetailDialog
  },
  mixins: [commonMxin],
  data() {
    return {
      tableData: [], // 任职经历信息
      type: this.$route.query.type,
      dialogData: {
        dialog: false, // 展示状态
        id: '' // 编辑时才会有财务状况id
      }
    }
  },
  created() {
    // 获取任职经历信息
    this.initData()
  },
  methods: {
    initData() {
      const data = {
        expertId: this.$route.params.expertId
      } // 专家id
      if (this.type === 'declarationChange') {
        queryAllTBExpertCareerHistoryForUpdate(data).then(res => {
          this.tableData = res.data.records
        }).catch(() => {})
      } else {
        const expertId = this.$route.query.id
        if (expertId) {
          data.expertId = expertId
        }
        getExpertCareerById(data).then(res => {
          this.tableData = res.data.records
        }).catch(() => {})
      }
    },
    clickDetail(row) {
      this.dialogData = {
        dialog: true,
        id: row.id
      }
    }
  }
}
</script>

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