<template>
  <div style="margin-top: 10px;">
    <el-table :data="props.list" border style="width: 100%">
      <el-table-column prop="account" align="center" label="用户名" />
      <el-table-column prop="nickName" align="center" label="昵称" />
      <el-table-column prop="gender" align="center" label="性别" />
      <el-table-column prop="phone" align="center" label="电话" />
      <el-table-column prop="email" align="center" label="邮箱" />
      <!-- <el-table-column prop="date" align="center" label="部门" /> -->
      <el-table-column prop="status" align="center" label="状态">
        <template #default="scope">
          <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" />
        </template>
      </el-table-column>
      <el-table-column prop="createTime" align="center" label="创建日期" />
      <el-table-column label="操作" align="center">
        <template #default="scope">
          <el-button size="small" type="primary" link icon="Edit" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button size="small" type="danger" link icon="Delete" style="color: #f89797;"
            @click="handleDelete(scope.$index, scope.row)"> 删除 </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
const emit = defineEmits(['handleDelete', 'handleEdit'])
const props = defineProps({
  list: {
    type: Array,
    default: () => []
  }
})

function handleEdit(row) {
  emit('handleEdit', row)
}
function handleDelete(index, row) {
  emit('handleDelete', row.id)
}

</script>
