
<template>
  <HcCard>
    <template #header>
      <div class="w-36 ml-2">
                <el-select v-model="searchForm.peoplename" block clearable placeholder="员工姓名" size="large">
                    <el-option v-for="item in peopleoption" :label="item.name" :value="item.key"/>
                </el-select>
      </div>
      <div class="ml-4">
                <el-button type="primary" @click="searchClick" size="large">
                    <HcIcon name="search-2"/>
                    <span>搜索</span>
                </el-button>
       </div>
      <div class="ml-2">
                <el-button size="large" @click="resetClick">
                    <HcIcon name="close-circle"/>
                    <span>重置</span>
                </el-button>
        </div>
    </template>
    <HcTable :column="tableColumn" :datas="tableData" >
            <template #action="{row, index}">
       
                  <el-button hc-btn type="primary" size="small"  @click="editRowClick(row)">编辑</el-button>
                  <el-button hc-btn type="primary" size="small">删除</el-button>
           
            </template>
      </HcTable>
      <template #action>
            <HcPages :pages="searchForm" @change="pageChange"></HcPages>
      </template>
  </HcCard>
</template>

<script setup>
import {ref, watch} from  'vue'

import {useRouter} from 'vue-router'

const router = useRouter()


const tableColumn = [
    {key: 'name', name: '姓名'},
    {key: 'email', name: '邮箱'},
    {key: 'department', name: '部门'},
    {key: 'key4', name: '直属主管'},
    {key: 'key5', name: '职位'},
    {key: 'key6', name: '手机号'},
    {key: 'key7', name: '入职时间'},
    {key: 'key8', name: '司龄'},
    {key: 'action', name: '操作'}

]
const tableData = ref([
    {name: '名称1',id:1},
    {name: '名称2', },
    {name: '名称3', }
])
const searchForm = ref({
    name: '',
    current: 1, size: 20, total: 0
})
const peopleoption=ref([
    {name: '张三', key: '1'},
    {name: '李四', key: '2'},
])
//分页被点击
const pageChange = ({current, size}) => {
    searchForm.value.current = current
    searchForm.value.size = size
    getTableData()
}

const getTableData = () => {

}

//搜索
const searchClick = () => {
    searchForm.value.current = 1;
    getTableData()
}

//重置搜索表单
const resetClick = () => {
    searchForm.value = {current: 1, size: 20, total: 0}
}
//编辑档案信息
const editRowClick = (row) => {
    router.push({
        name: 'people-archive-info',
        query: {
            id: row.id,
            type: 'edit'
        }
    })
}

</script>
<style lang='scss' scoped>
</style>