<template>
    <el-scrollbar >
        <el-row class="title_body">
            <el-col :span="20">
                <span class="cont_header_title"><i class="el-icon-s-order"></i>双职工</span>
            </el-col>
            <el-col :span="4" class="edit_buttion">
                <el-button
                icon="el-icon-plus"
                size="small"
                type="text"
                @click="showAddBase(userKey)"
                >新增</el-button>
            </el-col>
        </el-row>
        <el-divider style="margin:0"></el-divider>
        <el-row>
            <el-col :span="24" class="cont_body">
                <template>
                    <el-table
                      :data="emergencyContactList"
                      border
                      style="width: 100%">
                        <el-table-column
                            prop="name"
                            label="姓名"
                            width="180">
                        </el-table-column>
                        <el-table-column
                            prop="tel"
                            label="联系电话"
                            width="180">
                        </el-table-column>
                        <el-table-column
                            
                            label="部门">
                            <template #default="scope">
                                {{ scope.row.company }}<i v-if="scope.row.department"> / </i>{{ scope.row.department }}<i v-if="scope.row.position"> / </i>{{ scope.row.position }}
                            </template>
                        </el-table-column>
                        <el-table-column
                            width="130"
                            label="操作">
                            <template #default="scope">
                                <el-button
                                icon="el-icon-edit"
                                size="small"
                                type="text"
                                @click="showEditBase(scope.row)"
                                >编辑</el-button>
                                <el-button
                                icon="el-icon-delete"
                                size="small"
                                type="text"
                                @click="showDelBase(scope.row)"
                                >删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </template>
            </el-col>
        </el-row>
    </el-scrollbar>
</template>
<script>
import { getDoubleWorkerList } from "@/api/systemaccredit/systemhrapi"
export default {
    name:"emergencycontact",
    props:['userKey'],
    data() {
        return {
            emergencyContactList:[], //双职工
        }
    },
    created(){
        console.log("userKey---------->",this.userKey)  
        this.getEmergencyContact()
    },
    methods:{
        //编辑基本信息
        showAddBase(val){
            console.log("编辑基本信息--------->",val)  
        },
        //获取双职工信息
        async getEmergencyContact(){
            let sendData = {
                id:this.userKey
            }
            let res = await getDoubleWorkerList(sendData)
            this.emergencyContactList = res.data
            console.log("获取双职工信息--------->",res)  
        },
        //编辑
        async showEditBase(val){
            console.log("编辑--------->",val)  
        },
        //删除
        async showDelBase(val){
            console.log("删除--------->",val)  
        },
    }
}
</script>
<style>
.el-scrollbar {
    height: 100%;
    width: 100%;
}
.el-scrollbar__wrap {
    
    overflow: auto;
    overflow: scroll;
    overflow-x: hidden;
}
.el-tree-node.is-current>.el-tree-node__content {
    color:#2E89DE!important
}
.el-tree-node_black {
    background-color:red !important;
    color:#2E89DE!important
}
div::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
div::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    opacity: 0.2;
   
}
div::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    border-radius: 0;
}
.title_body{
    padding: 10px 0;
}
.cont_header_title{
    font-size: 20px;
    font-weight: bold;
    color: #388CFF;
}
.cont_header_title i{
    margin-right: 10px;
}
.edit_buttion{
    text-align: right; 
    padding-right: 5px;
}
.cont_body{
    margin-top: 20px;
}
</style>