apply-list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <PageShell>
  3. <div class="apply-page">
  4. <div class="apply-card">
  5. <div class="apply-header">
  6. <div class="apply-title">{{ pageTitle }}</div>
  7. <div class="apply-actions">
  8. <el-button @click="handleBack">返回</el-button>
  9. </div>
  10. </div>
  11. <el-form :model="queryParams" :inline="true" class="apply-search-form">
  12. <el-form-item class="apply-search-name-item">
  13. <el-input v-model="queryParams.keyword" placeholder="请输入姓名/手机号" clearable @keyup.enter="handleQuery">
  14. <template #prefix>
  15. <el-icon><Search /></el-icon>
  16. </template>
  17. </el-input>
  18. </el-form-item>
  19. <el-form-item class="apply-search-btn-item">
  20. <el-button type="primary" icon="Search" @click="handleQuery" />
  21. </el-form-item>
  22. <el-form-item class="apply-search-select-item">
  23. <el-select v-model="queryParams.status" placeholder="审核状态" clearable @change="handleQuery">
  24. <el-option v-for="item in applyStatusOptions" :key="item.value" :label="item.label" :value="item.value" />
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item class="apply-search-select-item" v-if="false">
  28. <el-select v-model="queryParams.ability" placeholder="测评能力" clearable>
  29. <el-option v-for="item in abilityOptions" :key="item" :label="item" :value="item" />
  30. </el-select>
  31. </el-form-item>
  32. <div class="apply-toolbar-actions">
  33. <el-button disabled>录用</el-button>
  34. <el-button type="primary" @click="handleExport">导出列表</el-button>
  35. </div>
  36. </el-form>
  37. <el-table v-loading="loading" :data="applyList" class="apply-list-table">
  38. <el-table-column label="姓名" prop="name" min-width="160">
  39. <template #default="scope">
  40. <el-button link type="primary" @click="handleOpenDetail(scope.row)">{{ scope.row.name }}</el-button>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="性别" prop="gender" width="100" align="center" />
  44. <el-table-column label="手机号" prop="phone" min-width="180" align="center" />
  45. <el-table-column label="状态" min-width="160" align="center">
  46. <template #default="scope">
  47. <span class="apply-status-text">
  48. <span class="apply-status-dot" :class="`is-${scope.row.statusType}`"></span>
  49. {{ scope.row.statusText }}
  50. </span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="测评时间" prop="evaluateTime" min-width="180" align="center" />
  54. <el-table-column label="操作" min-width="220" align="center">
  55. <template #default="scope">
  56. <template v-if="scope.row.status !== STATUS_CLOSED">
  57. <el-button link type="primary" @click="handleEvaluationDetail(scope.row)">测评详情</el-button>
  58. <el-button link type="primary">下载附件简历</el-button>
  59. <template v-if="scope.row.status === STATUS_PENDING">
  60. <el-button link type="primary" @click="handleHire(scope.row)">录用</el-button>
  61. <el-button link type="primary" @click="handleReject(scope.row)">不录用</el-button>
  62. </template>
  63. </template>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <pagination
  68. v-show="total > 0"
  69. v-model:page="queryParams.pageNum"
  70. v-model:limit="queryParams.pageSize"
  71. :total="total"
  72. @pagination="getList"
  73. />
  74. </div>
  75. <el-dialog v-model="hireDialog.visible" title="审核说明" width="680px" append-to-body>
  76. <div class="result-dialog-content">
  77. <div class="result-line"><span class="result-label">结果:</span><span class="result-value">录用</span></div>
  78. <div class="result-remark-row">
  79. <span class="result-label top">附件</span>
  80. <div class="result-upload-panel">
  81. <FileUpload
  82. v-model="hireDialog.offerAttachment"
  83. :limit="5"
  84. :file-type="['png', 'jpg', 'jpeg', 'doc', 'docx', 'xlsx', 'xls', 'ppt', 'pptx', 'txt', 'pdf']"
  85. :file-size="20"
  86. />
  87. </div>
  88. </div>
  89. <div class="result-remark-row">
  90. <span class="result-label top">说明</span>
  91. <el-input v-model="hireDialog.remark" type="textarea" :rows="5" placeholder="请输入" />
  92. </div>
  93. <el-checkbox v-model="hireDialog.agree">我已阅读并同意服务 offer 确认前免责协议</el-checkbox>
  94. </div>
  95. <template #footer>
  96. <div class="dialog-footer">
  97. <el-button @click="hireDialog.visible = false">返回</el-button>
  98. <el-button type="primary" :loading="hireDialog.submitting" @click="submitHire">确定</el-button>
  99. </div>
  100. </template>
  101. </el-dialog>
  102. <el-dialog v-model="rejectDialog.visible" title="审核说明" width="520px" append-to-body>
  103. <div class="result-dialog-content compact">
  104. <div class="result-line"><span class="result-label">结果:</span><span class="result-value">不录用</span></div>
  105. <div class="result-remark-row compact">
  106. <span class="result-label top">备注:</span>
  107. <el-input v-model="rejectDialog.remark" type="textarea" :rows="4" placeholder="说明" />
  108. </div>
  109. </div>
  110. <template #footer>
  111. <div class="dialog-footer">
  112. <el-button @click="rejectDialog.visible = false">取消</el-button>
  113. <el-button type="primary" :loading="rejectDialog.submitting" @click="submitReject">确定</el-button>
  114. </div>
  115. </template>
  116. </el-dialog>
  117. </div>
  118. </PageShell>
  119. </template>
  120. <script setup name="PostManageApplyList" lang="ts">
  121. import { computed, getCurrentInstance, onMounted, reactive, ref, type ComponentInternalInstance } from 'vue';
  122. import { useRoute, useRouter } from 'vue-router';
  123. import { hirePostCandidate, listPostCandidates, updatePostCandidateStatus, type PostCandidateVO } from '@/api/main/postManage/candidate';
  124. import PageShell from '@/components/PageShell/index.vue';
  125. import FileUpload from '@/components/FileUpload/index.vue';
  126. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  127. const router = useRouter();
  128. const route = useRoute();
  129. const modal = proxy?.$modal as any;
  130. const STATUS_ADOPTED = 'adopted';
  131. const STATUS_REJECTED = 'rejected';
  132. const STATUS_PENDING = 'pending';
  133. const STATUS_CLOSED = 'closed';
  134. const pageTitle = computed(() => {
  135. const postName = route.query.postName as string | undefined;
  136. return postName ? `${postName} 报名列表` : '报名列表';
  137. });
  138. const queryParams = reactive({
  139. pageNum: 1,
  140. pageSize: 10,
  141. keyword: '',
  142. status: '',
  143. ability: ''
  144. });
  145. const loading = ref(false);
  146. const total = ref(0);
  147. const applyStatusOptions = [
  148. { label: '录用', value: STATUS_ADOPTED },
  149. { label: '不录用', value: STATUS_REJECTED },
  150. { label: '待回复', value: STATUS_PENDING },
  151. { label: '学员已拒绝', value: STATUS_CLOSED }
  152. ];
  153. const abilityOptions = ['测评能力'];
  154. const applyList = ref<PostCandidateVO[]>([]);
  155. const hireDialog = reactive({
  156. visible: false,
  157. remark: '',
  158. agree: true,
  159. offerAttachment: '',
  160. currentId: '',
  161. submitting: false
  162. });
  163. const rejectDialog = reactive({
  164. visible: false,
  165. remark: '',
  166. currentId: '',
  167. submitting: false
  168. });
  169. const getList = async () => {
  170. const postId = route.query.postId as string | undefined;
  171. if (!postId) {
  172. applyList.value = [];
  173. total.value = 0;
  174. return;
  175. }
  176. loading.value = true;
  177. try {
  178. const res = await listPostCandidates({
  179. postId,
  180. pageNum: queryParams.pageNum,
  181. pageSize: queryParams.pageSize,
  182. keyword: queryParams.keyword,
  183. status: queryParams.status
  184. });
  185. applyList.value = res.rows || [];
  186. total.value = res.total || 0;
  187. } finally {
  188. loading.value = false;
  189. }
  190. };
  191. const handleQuery = () => {
  192. queryParams.pageNum = 1;
  193. getList();
  194. };
  195. const handleBack = () => {
  196. proxy?.$tab.closePage();
  197. router.push((route.query.backPath as string) || '/postManage');
  198. };
  199. const handleExport = () => {
  200. const postId = route.query.postId as string | undefined;
  201. if (!postId) {
  202. modal?.msgWarning('岗位ID不能为空');
  203. return;
  204. }
  205. proxy?.download(
  206. '/main/postCandidate/export',
  207. {
  208. postId,
  209. keyword: queryParams.keyword,
  210. status: queryParams.status
  211. },
  212. `post_candidate_${new Date().getTime()}.xlsx`
  213. );
  214. };
  215. const handleHire = (row: PostCandidateVO) => {
  216. hireDialog.currentId = String(row.id);
  217. hireDialog.remark = row.remark || '';
  218. hireDialog.offerAttachment = '';
  219. hireDialog.agree = true;
  220. hireDialog.visible = true;
  221. };
  222. const handleReject = (row: PostCandidateVO) => {
  223. rejectDialog.currentId = String(row.id);
  224. rejectDialog.remark = row.remark || '';
  225. rejectDialog.visible = true;
  226. };
  227. const submitHire = async () => {
  228. if (!hireDialog.currentId) return;
  229. if (!hireDialog.agree) {
  230. modal?.msgWarning('请先阅读并同意免责协议');
  231. return;
  232. }
  233. if (!hireDialog.offerAttachment) {
  234. modal?.msgWarning('请先上传录用附件');
  235. return;
  236. }
  237. hireDialog.submitting = true;
  238. try {
  239. await hirePostCandidate({
  240. id: hireDialog.currentId,
  241. remark: hireDialog.remark.trim(),
  242. offerAttachment: hireDialog.offerAttachment
  243. });
  244. hireDialog.visible = false;
  245. modal?.msgSuccess('录用成功');
  246. await getList();
  247. } finally {
  248. hireDialog.submitting = false;
  249. }
  250. };
  251. const submitReject = async () => {
  252. if (!rejectDialog.currentId) return;
  253. rejectDialog.submitting = true;
  254. try {
  255. await updatePostCandidateStatus({
  256. id: rejectDialog.currentId,
  257. status: STATUS_REJECTED,
  258. remark: rejectDialog.remark.trim()
  259. });
  260. rejectDialog.visible = false;
  261. modal?.msgSuccess('操作成功');
  262. await getList();
  263. } finally {
  264. rejectDialog.submitting = false;
  265. }
  266. };
  267. const handleOpenDetail = (row: { id: number; name: string }) => {
  268. router.push({
  269. path: '/postManage/apply-detail',
  270. query: {
  271. applyId: String(row.id),
  272. name: row.name,
  273. postId: String(route.query.postId || ''),
  274. studentId: String((row as PostCandidateVO).studentId || '')
  275. }
  276. });
  277. };
  278. const handleEvaluationDetail = (row: PostCandidateVO) => {
  279. router.push({
  280. path: '/postManage/evaluation-view',
  281. query: {
  282. applyId: String(row.id),
  283. name: row.name || '',
  284. postId: String(route.query.postId || ''),
  285. studentId: String(row.studentId || ''),
  286. evaluationId: String((row as any).evaluationId || route.query.postId || '')
  287. }
  288. });
  289. };
  290. onMounted(() => {
  291. getList();
  292. });
  293. </script>
  294. <style scoped>
  295. .apply-page {
  296. min-height: 100%;
  297. }
  298. .apply-card {
  299. min-height: calc(100vh - 180px);
  300. padding: 12px 16px 16px;
  301. background: #fff;
  302. border-radius: 4px;
  303. display: flex;
  304. flex-direction: column;
  305. }
  306. .apply-header {
  307. display: flex;
  308. align-items: center;
  309. justify-content: space-between;
  310. margin-bottom: 16px;
  311. }
  312. .apply-title {
  313. font-size: 16px;
  314. font-weight: 600;
  315. color: #303133;
  316. }
  317. .apply-search-form {
  318. display: flex;
  319. align-items: center;
  320. gap: 10px;
  321. flex-wrap: wrap;
  322. margin-bottom: 16px;
  323. }
  324. .apply-search-name-item {
  325. width: 280px;
  326. margin-bottom: 0;
  327. }
  328. .apply-search-btn-item {
  329. margin-left: -82px;
  330. }
  331. .apply-search-btn-item,
  332. .apply-search-select-item {
  333. margin-bottom: 0;
  334. }
  335. .apply-search-select-item {
  336. width: 140px;
  337. }
  338. .apply-toolbar-actions {
  339. display: flex;
  340. align-items: center;
  341. gap: 12px;
  342. margin-left: auto;
  343. }
  344. .apply-list-table :deep(.el-table__header th) {
  345. background: #eef4ff;
  346. }
  347. .apply-list-table {
  348. flex: 1;
  349. }
  350. .apply-status-text {
  351. display: inline-flex;
  352. align-items: center;
  353. gap: 6px;
  354. }
  355. .apply-status-dot {
  356. width: 6px;
  357. height: 6px;
  358. border-radius: 50%;
  359. background: #c0c4cc;
  360. }
  361. .apply-status-dot.is-success {
  362. background: #67c23a;
  363. }
  364. .apply-status-dot.is-danger {
  365. background: #f56c6c;
  366. }
  367. .apply-status-dot.is-warning {
  368. background: #e6a23c;
  369. }
  370. .apply-card :deep(.pagination-container) {
  371. display: flex;
  372. justify-content: flex-end;
  373. margin-top: auto;
  374. padding-top: 20px;
  375. padding: 0;
  376. }
  377. .dialog-footer {
  378. display: flex;
  379. justify-content: center;
  380. gap: 16px;
  381. }
  382. .result-dialog-content {
  383. display: flex;
  384. flex-direction: column;
  385. gap: 14px;
  386. padding: 8px 8px 0;
  387. }
  388. .result-dialog-content.compact {
  389. gap: 16px;
  390. }
  391. .result-line {
  392. display: flex;
  393. align-items: center;
  394. gap: 8px;
  395. }
  396. .result-label {
  397. width: 44px;
  398. color: #303133;
  399. flex-shrink: 0;
  400. }
  401. .result-label.top {
  402. padding-top: 8px;
  403. }
  404. .result-value {
  405. color: #303133;
  406. }
  407. .result-upload-row {
  408. padding-left: 44px;
  409. }
  410. .result-file-list {
  411. display: flex;
  412. flex-direction: column;
  413. gap: 8px;
  414. padding-left: 44px;
  415. }
  416. .result-file-item {
  417. color: #606266;
  418. font-size: 13px;
  419. }
  420. .result-remark-row {
  421. display: flex;
  422. align-items: flex-start;
  423. gap: 8px;
  424. }
  425. .result-remark-row.compact :deep(.el-textarea) {
  426. flex: 1;
  427. }
  428. .result-upload-panel {
  429. flex: 1;
  430. }
  431. </style>