<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="tableDataSafe" 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 {SafeListListApi} from "@/api/staffApi.js"
export default {
    data(){
        return{
            params:{//搜索条件
                pageIndex:1,
                pageSize:10,
                id:'',
                keyword:'',             
                total:0
            },
            tableDataSafe:[],
            tableColumn:[
              {prop:"productName",label:"产品名称",width:"180",show:true},
              {prop:"policyNo",label:"保单号",width:"180",show:true},
              {prop:"buyMode",label:"购买方式",width:"180",show:true},
              {prop:"effectStartDate",label:"生效日期",width:"180",show:true},
              {prop:"effectEndDate",label:"失效日期",width:"",show:true},
          ],
        }
    },
    mounted(){
      this.SafeList()
      console.log('staffinfo',this.$parent.$parent.staffinfo)
    },
    methods:{
      SafeList(){
        //  let obj2={domainId:this.$route.query.domainId}
          let idCardNo=this.$parent.$parent.staffinfo.credentialNumber
          SafeListListApi(this.params,idCardNo).then(response=>{
               if(response.data){
                   this.tableDataSafe=response.data.data
                   this.params.total=response.data.total
               }
          })
      },
      handleCurrentChange(val){//分页切换页码
        console.log(val)
        this.params.pageIndex=val
        this.SafeList()
      },
      handleSizeChange(val){//切换每页条数
        console.log(val)
        this.params.pageSize=val
        this.SafeList()
     },
      Edit(row,flag){//编辑合同弹窗
        // this.showdialog=true         
        // this.$refs.popChildren.getTableRow(row, 1,flag);   
     }, 
     download(row){
        if(row.attachment){
            window.open(row.attachment)
        }
    },
    }
}
</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>