<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true">
      <el-form-item label="职位">
        <el-input placeholder="请输入" v-model="queryParams.name" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="list" show-overflow-tooltip>
      <el-table-column label="报名时间" prop="updateTime" />
      <el-table-column label="报名企业" prop="orgName" />
      <el-table-column label="报名职位" prop="name" />
      <el-table-column label="姓名">
        <template #default="{row}">
          {{ row.person.name}}
        </template>
      </el-table-column>
      <el-table-column label="联系电话">
        <template #default="{row}">
          {{ row.person.phoneNumber}}
        </template>
      </el-table-column>
      <el-table-column label="性别" prop="sex">
        <template #default="{row}">
          {{ row.person.sex ? '男' : '女' }}
        </template>
      </el-table-column>
      <!-- <el-table-column label="操作" width="160" align="center">
        <template #default="{row}">
          <el-button link type="primary" icon="Delete" @click="del(row)">删除</el-button>
        </template>
      </el-table-column> -->
    </el-table>
    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize" @pagination="getList" />
  </div>
</template>

<script setup>

import { signRecordList,personDel } from "@/api/personnel";
import { ref } from "vue";
const { proxy } = getCurrentInstance();
const list = ref([]);
const loading = ref(false);
const total = ref(0);
const queryParams = ref({
  pageNum: 1,
  pageSize: 10,
})
/** 查询列表 */
function getList() {
  const form = { ...queryParams.value }
  loading.value = true;
  signRecordList(form).then(res => {
    list.value = res.data.list;
    total.value = res.data.total;
    loading.value = false;
  });
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  queryParams.value.pageSize = 10;
  getList();
}
/** 重置按钮操作 */
function resetQuery() {
  queryParams.value = {
    pageNum: 1,
    pageSize: 10,
  }
  handleQuery();
}
// function del(row) {
//     proxy.$modal.confirm('您确定要删除吗？').then(function() {
//       return personDel({
//         id: row.id,
//       });
//     }).then((res) => {
//       getList();
//       proxy.$modal.msgSuccess('删除成功');
//     }).catch(() => {});
// }
getList();
</script>
<style lang="scss" scoped>
.el-dialog .el-dialog__body {
  max-height: 650px;
}
</style>