<template>
  <div class="m-right-block fr mh576" style="position: relative;">
    <div class="right-block-bd">
      <div class="mb10 tc mt20">
        <span class="p-ico2 worm-ico-o"></span>
        注：<span class="txt-o"></span>考试通过一周内生成,若未看到，请联系管理员
      </div>

      <div  class="ng-scope">
        <el-table v-loading="listLoading" :data="list" border fit highlight-current-row>
          <el-table-column label="流水号" align="center"  prop="uuid"/>
          <el-table-column label="岗位类别" prop="courseName" align="center"/>

          <el-table-column label="所在企业" prop="company" align="center"/>

          <el-table-column label="发布时间" prop="publishDate" align="center"/>

          <el-table-column label="操作" fixed="right" align="center" width="100">
            <template slot-scope="{row}">
              <el-button  @click="printCert( row )" type="text" size="small">查看</el-button>
            </template>
          </el-table-column>
        </el-table>

        <el-pagination
            @current-change="handleCurrentChange"
            :current-page="page"
           :page-size="size"
           layout="total, prev,pager, next"
           :total="list.length">
        </el-pagination>

      </div>

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

<script>
  import {httpServer} from "@/components/httpServer/httpServer.js";
  import {formatTimeToStr} from "@/utils/date.js";
 import { mapGetters } from "vuex";
  export default {
    name: "Index",
    data() {
      return {
        page:1,
        size:10,
        total: 20,
        info:{},
        list: [],
        printCertDialog:false,
        listLoading: false
      };
    },
    beforeMount() {
      this.getData()
    },
    computed: {
    	...mapGetters("user", ["userInfo"])
    },
    methods: {
      getData() {
        this.listLoading = true
        httpServer('Course.GetSmCertificateList', {}).then( res=>{
            if( res.code == 200){
              this.list = res.data||[]
            }
            this.listLoading = false
        })
      },
      printCert( row  ){
        window.open(row.certUrl, '_blank')
      },
      handleCurrentChange: function(page) {
        this.page = page
        this.getData()
      }
    }
  }
</script>

<style>
  .previewDialog{
      text-align: center;
  }
  .previewDialog.el-dialog {
    .el-dialog__header {
      display: none;
    }
    .dj-dialog-content {
      padding: 0;
      overflow: unset;
    }
  }
</style>
