<template>
  <div>
    <el-table :data="tableData"  border stripe >
      <el-table-column label="姓名"  prop="nickname" >
      </el-table-column>
	  <el-table-column label="性别"  prop="gender" >
	  </el-table-column>
	  <el-table-column label="身份证"  prop="cardId" >
	  </el-table-column>
	  <el-table-column label="手机"  prop="phone">
	  </el-table-column>
	  
	  <el-table-column label="学历"  prop="education" >
	  </el-table-column>
	  <el-table-column label="工作单位"  prop="company">
	  </el-table-column>
	  <el-table-column label="施工现场实践年份"  prop="years">
	  </el-table-column>
	  
	  <el-table-column label="报考岗位"  prop="courseName">
	  </el-table-column>
	  <el-table-column label="考试培训时间"  prop="startDate">
	  </el-table-column>
	  <el-table-column label="结束培训时间"  prop="endDate">
	  </el-table-column>
	  <el-table-column label="学时"  prop="xs">
		<template v-slot="{row}">
			<span> {{row.getXs/10}} / {{row.totalXs/10}}</span>
		</template>
	  </el-table-column>
    </el-table>
	
	<el-pagination
	    @current-change="handleCurrentChange"
	    :current-page="page"
	   :page-size="size"
	   layout="total, prev,pager, next"
	   :total="total">
	</el-pagination>

  </div>
</template>

<script>
import { postData, getUserApplyConfirmList} from "@/api/xinpei";
import {toDatetime} from "@/utils/date"

export default {
  name: "Api",
  data() {
    return {
      total:0,
	  size:10,
	  page:1,
	  tableData:[],
	  listApi: getUserApplyConfirmList
    };
  },
  props:['planId'],
  watch:{
	planId(){
		console.log("change", this.planId)
		this.getTableData()
	}
  },
  methods: {
    //条件搜索前端看此方法
    onSubmit() {
      this.page = 1;
      this.pageSize = 10;
      this.getTableData();
    },
	getTableData( ){
		let param = {planId: +this.planId}
		getUserApplyConfirmList( param).then( res=>{
			if( res.code ==200){
				this.tableData = res.data.list||[];
				this.total = res.data.total;
			}
		})
	},
	handleCurrentChange(page){
		this.page = page
		this.getTableData()
	}
  },
  beforeMount() {
	if( this.planId >0){
		this.getTableData();
	}
  }
};
</script>
<style scoped lang="scss">
.button-box {
  padding: 10px 20px;
  .el-button {
    float: right;
  }
}
.el-tag--mini {
  margin-left: 5px;
}
.warning {
  color: #dc143c;
}
</style>
