<template>
      <el-dialog
        v-model="centerDialogVisible"
        title="人员信息"
        width="60%"
        align-center
     >
        <el-table :data="tableData" stripe style="width: 100%" height="300">
            <el-table-column prop="lastname" label="姓名" />
            <el-table-column prop="workcode" label="编号"  />
            <el-table-column prop="sex" label="性别"  />
            <el-table-column prop="manager" label="直接上级" />
            <el-table-column prop="loginid" label="登录名" />
        </el-table>
        <template #footer>
        <span class="dialog-footer">
            <el-button type="primary" @click="centerDialogVisible = false">
            关闭
            </el-button>
        </span>
        </template>
    </el-dialog>
  </template>
  
  <script>
    import { ElDialog,ElButton,ElTable,ElMessage } from 'element-plus'
    import {selectPerson} from '@/api/chart'
  
  export default {
    name: 'ViewDialog',
    components: {
      ElDialog,
      ElButton,
      ElTable
    },
    data() {
      return {
        centerDialogVisible:false,
        tableData:[],
        params:{
            pid:'',
            id:''
        }
      };
    },
    created() {
       
    },
    methods: {
        openDialog(data){
            this.params.id = data.id;
            this.tableList(); 
        },
        tableList() {
            selectPerson(this.params).then(res=>{
                this.tableData = res.data.data;
                this.centerDialogVisible = true;
                })
            .catch(err=>{
                ElMessage.error(err.msg);
            })
        },
    }
  }
  </script>
  
  <style scoped>
    .dialog-footer button:first-child {
    margin-right: 10px;
    }
</style>
  