<template>
  <section class="staffBoxFlex">
      <div class="staffTitle">
          <strong>就职记录</strong>
          <!-- <em><i>编辑</i><i>保存</i></em> -->
      </div>
      <div class="staffContext staffContract">
            <!-- 内容区域 -->
           <section class="contentBox">
               <el-table :data="tableData" ref="districtTable"  max-height="500" default-expand-all  row-key="id">
                   <el-table-column v-for="(item,index) in tableColumn" :key="index" :prop="item.prop" :label="item.label" :width="item.width" v-if="item.show">
                       <template slot-scope="scope">                            
                           <span>{{scope.row[item.prop]}}</span>
                       </template>
                   </el-table-column>                    
               </el-table>
               <!-- 分页页签 -->
               <pages
               :total='params.total'
               :currentPage.sync='params.pageIndex'
               :pageSize='params.pageSize'
               @handleCurrentChangeSub="handleCurrentChange"
               @handleSizeChangeSub="handleSizeChange"
               ></pages>
           </section>
      </div>
  </section>
</template>
<script>
import {employeeRecordsListApi} from "@/api/staffApi.js"
export default {
   data(){
       return{
           params:{//搜索条件
               pageIndex:1,
               pageSize:10,
               ignorePermission: true,
               employeeId:'',             
               total:0
           },
           tableData:[],
           tableColumn:[
             {prop:"name",label:"姓名",width:"100",show:true},
             {prop:"credentialType",label:"证件类型",width:"180",show:true},
             {prop:"credentialNumber",label:"证件号",width:"180",show:true},
             {prop:"occupationType",label:"职业类型",width:"100",show:true},
             {prop:"status",label:"入/离职",width:"100",show:true},
             {prop:"actionTime",label:"入/离职时间",width:"120",show:true},
             {prop:"actionNode",label:"备注",width:"100",show:true},
             {prop:"operatorName",label:"操作人",width:"180",show:true},
             {prop:"operatorTime",label:"操作时间",width:"",show:true},
         ],
       }
   },
   mounted(){
     this.params.employeeId=this.$parent.$parent.staffinfo.id//获取职员id==>employeeId
     this.List()
     console.log('staffinfo',this.$parent.$parent.staffinfo)
   },
   methods:{
    List(){
       //  let obj2={domainId:this.$route.query.domainId}
         employeeRecordsListApi(this.params).then(response=>{
              if(response.data){
                  this.tableData=response.data.data
                  this.params.total=response.data.total
              }
         })
     },
     handleCurrentChange(val){//分页切换页码
       console.log(val)
       this.params.pageIndex=val
       this.List()
     },
     handleSizeChange(val){//切换每页条数
       console.log(val)
       this.params.pageSize=val
       this.List()
    }     
    
   }
}
</script>
<style lang="scss">
.staffBoxFlex{
    display: flex;
    flex-direction: column;
    .staffTitle{
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #ebebeb;
        padding: 5px 0;
        margin-bottom: 10px;
        strong{
            color: #000;
            font-weight: normal;
        }
        em{
            margin-right:20px;
            i{color: #2e8ad7;margin-right:20px;cursor: pointer;}
        }
    }
   
}   
</style>