index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <ContentWrap>
  3. <!-- 搜索工作栏 -->
  4. <el-form
  5. class="-mb-15px"
  6. :model="queryParams"
  7. ref="queryFormRef"
  8. :inline="true"
  9. label-width="68px"
  10. @submit.prevent
  11. >
  12. <el-form-item label="企业名称" prop="name">
  13. <el-input
  14. v-model="queryParams.name"
  15. placeholder="请输入企业名称"
  16. clearable
  17. @keyup.enter="handleQuery"
  18. class="!w-240px"
  19. />
  20. </el-form-item>
  21. <el-form-item>
  22. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  23. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  24. <el-button type="primary" plain @click="handleAdd"><Icon icon="ep:plus" class="mr-5px" /> 新增</el-button>
  25. <el-button v-if="showExport" type="primary" plain @click="handleExport"><Icon icon="ep:download" class="mr-5px" /> 导出参加招聘会职位列表</el-button>
  26. </el-form-item>
  27. </el-form>
  28. </ContentWrap>
  29. <!-- 列表 -->
  30. <ContentWrap>
  31. <el-table v-loading="loading" :data="list" :stripe="true">
  32. <el-table-column label="招聘会标题" align="center" prop="jobFair.title">
  33. <template #default="scope">
  34. <div v-html="scope.row.jobFair.title"></div>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="企业名称" align="center" prop="name" />
  38. <el-table-column label="操作" align="center">
  39. <template #default="scope">
  40. <el-button
  41. link
  42. type="primary"
  43. @click="handleRemoveWhiteList(scope.row.name)"
  44. >
  45. 移出白名单
  46. </el-button>
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <Pagination
  51. :total="total"
  52. v-model:page="queryParams.pageNo"
  53. v-model:limit="queryParams.pageSize"
  54. @pagination="getList"
  55. />
  56. </ContentWrap>
  57. <!-- 表单弹窗:添加/修改 -->
  58. <JobFairForm ref="formRef" @success="getList" />
  59. </template>
  60. <script setup lang="ts">
  61. import { JobFairWhiteApi } from '@/api/menduner/system/jobFair/white'
  62. import JobFairForm from './jobFairForm.vue'
  63. import download from '@/utils/download'
  64. /** 招聘会 列表 */
  65. defineOptions({ name: 'JobFair' })
  66. const message = useMessage() // 消息弹窗
  67. const loading = ref(true) // 列表的加载中
  68. const list = ref([]) // 列表的数据
  69. const total = ref(0)
  70. const queryParams = ref({
  71. pageNo: 1,
  72. pageSize: 10,
  73. name: undefined
  74. })
  75. /** 查询列表 */
  76. const getList = async () => {
  77. loading.value = true
  78. try {
  79. const data = await JobFairWhiteApi.getJobFairWhiteList(queryParams.value)
  80. total.value = data.total
  81. list.value = data.list
  82. } finally {
  83. loading.value = false
  84. }
  85. }
  86. const handleQuery = () => {
  87. queryParams.value.pageNo = 1
  88. getList()
  89. }
  90. /** 重置按钮操作 */
  91. const queryFormRef = ref()
  92. const resetQuery = () => {
  93. queryFormRef.value.resetFields()
  94. handleQuery()
  95. }
  96. const formRef = ref()
  97. const handleAdd = () => {
  98. formRef.value.open()
  99. }
  100. // 移出白名单
  101. const handleRemoveWhiteList = async (enterpriseName: string) => {
  102. try {
  103. await message.confirm('确定要将该企业移出白名单吗?')
  104. await JobFairWhiteApi.removeJobFairWhiteList(enterpriseName)
  105. message.success('移出成功')
  106. getList()
  107. } catch (err) {}
  108. }
  109. const showExport = ref(true) // 导出参加招聘会职位列表
  110. const exportLoading = ref(false) // 导出的加载中
  111. /** 导出按钮操作 */
  112. const handleExport = async () => {
  113. try {
  114. // 导出的二次确认
  115. await message.exportConfirm()
  116. // 发起导出
  117. exportLoading.value = true
  118. const data = await JobFairWhiteApi.exportJobFairWhiteList()
  119. download.excel(data, '招聘会职位列表.xls')
  120. } catch {
  121. } finally {
  122. exportLoading.value = false
  123. }
  124. }
  125. /** 初始化 **/
  126. onMounted(() => {
  127. getList()
  128. })
  129. </script>