fix: 简历投递增加提示,其他问题修复
This commit is contained in:
parent
c1cac36f05
commit
2c61901ca4
@ -1,129 +1,111 @@
|
||||
<template>
|
||||
<c-table :option="option">
|
||||
<template #menuLeft="{ record }">
|
||||
<button class="delivery-button" @click="handleClick">简历</button>
|
||||
<!-- 传递 record.id 给 handleClick 方法 -->
|
||||
<button class="delivery-button" @click="handleClick(record.id)">简历</button>
|
||||
</template>
|
||||
</c-table>
|
||||
<a-modal v-model:visible="visible" @ok="handleOk" @cancel="handleCancel" fullscreen>
|
||||
<template #title> 简历审核 </template>
|
||||
<div>
|
||||
<c-table :option="option"></c-table>
|
||||
</div>
|
||||
<a-table :data-source="resumes" :columns="columns" bordered>
|
||||
<template #status="{ record }">
|
||||
<a-select v-model="record.status" :disabled="!record.isAuditing" placeholder="请选择状态">
|
||||
<a-option value="待审核">待审核</a-option>
|
||||
<a-option value="审核通过">审核通过</a-option>
|
||||
<a-option value="审核未通过">审核未通过</a-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-button @click="handleAudit(record)">
|
||||
{{ record.isAuditing ? '保存审核结果' : '审核' }}
|
||||
</a-button>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import option from './option'
|
||||
// 引入封装的接口方法
|
||||
import {
|
||||
pageRes,
|
||||
getPositionList,
|
||||
addPosition,
|
||||
updatePosition,
|
||||
deletePosition,
|
||||
getResumesByPositionId
|
||||
} from '@/api/upms/position'
|
||||
import { getResumesByPositionId } from '@/api/upms/position'
|
||||
|
||||
// 模拟分页对象
|
||||
const page = {
|
||||
current: 1,
|
||||
size: 10
|
||||
}
|
||||
// 控制模态框显示隐藏的逻辑
|
||||
const visible = ref(false)
|
||||
|
||||
// 模拟职位实体类对象,修改和删除是根据id
|
||||
const entity = {
|
||||
id: '165646957334757381',
|
||||
jobName: '测试岗6666',
|
||||
jobContent: '岗位描述166666'
|
||||
}
|
||||
// 初始写死的简历数据
|
||||
const resumes = ref([])
|
||||
|
||||
// 查询岗位下的id
|
||||
const getResumeById = async () => {
|
||||
// 表格列配置
|
||||
const columns = [
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'id',
|
||||
key: 'id'
|
||||
},
|
||||
{
|
||||
title: '简历来源',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
slots: { customRender: 'status' }
|
||||
},
|
||||
{
|
||||
title: '附件',
|
||||
key: 'action',
|
||||
slots: { customRender: 'action' }
|
||||
},
|
||||
{
|
||||
title: '审核状态'
|
||||
},
|
||||
{
|
||||
title: '操作'
|
||||
}
|
||||
]
|
||||
|
||||
// 查询岗位下的简历,接收 id 作为参数
|
||||
const getResumeById = async (id: string) => {
|
||||
try {
|
||||
console.log('接收到的岗位id', id)
|
||||
const response = await getResumesByPositionId(id)
|
||||
console.log('岗位下的简历查询结果:', response.data)
|
||||
console.log('岗位下的简历查询结果:', response)
|
||||
// 检查 response 是否为数组
|
||||
if (Array.isArray(response)) {
|
||||
resumes.value = response.map((item) => ({
|
||||
...item,
|
||||
isAuditing: false,
|
||||
status: item.status || '待审核' // 确保有状态字段,默认待审核
|
||||
}))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('岗位下的简历查询失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 测试分页查询,第二个参数的条件不传就是查全部
|
||||
const testPageRes = async () => {
|
||||
try {
|
||||
const response = await pageRes(page, null)
|
||||
console.log('分页查询结果:', response.data)
|
||||
} catch (error) {
|
||||
console.error('分页查询失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 测试获取职位列表
|
||||
const testGetPositionList = async () => {
|
||||
try {
|
||||
const response = await getPositionList(entity)
|
||||
console.log('获取职位列表结果:', response.data)
|
||||
} catch (error) {
|
||||
console.error('获取职位列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 测试新增职位
|
||||
const testAddPosition = async () => {
|
||||
try {
|
||||
const response = await addPosition(entity)
|
||||
console.log('新增职位结果:', response.data)
|
||||
} catch (error) {
|
||||
console.error('新增职位失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 测试修改职位
|
||||
const testUpdatePosition = async () => {
|
||||
try {
|
||||
const response = await updatePosition(entity)
|
||||
console.log('修改职位结果:', response.data)
|
||||
} catch (error) {
|
||||
console.error('修改职位失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 测试删除职位
|
||||
const testDeletePosition = async () => {
|
||||
try {
|
||||
const response = await deletePosition({ id: '53734efd-ef77-11ef-be44-0242c0a81002' }) // id
|
||||
console.log('删除职位结果:', response.data)
|
||||
} catch (error) {
|
||||
console.error('删除职位失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 在组件挂载时进行测试
|
||||
onMounted(async () => {
|
||||
// await testPageRes()
|
||||
// await testGetPositionList()
|
||||
// await testAddPosition()
|
||||
// await testUpdatePosition()
|
||||
// await testDeletePosition()
|
||||
})
|
||||
|
||||
const openDialog = () => {
|
||||
// 投递按钮点击事件逻辑
|
||||
console.log('投递按钮被点击')
|
||||
}
|
||||
|
||||
// 新增代码:控制模态框显示隐藏的逻辑
|
||||
const visible = ref(false)
|
||||
|
||||
const handleClick = () => {
|
||||
// 接收 id 作为参数
|
||||
const handleClick = async (id: string) => {
|
||||
visible.value = true
|
||||
// 调用 getResumeById 方法并传递 id
|
||||
await getResumeById(id)
|
||||
}
|
||||
|
||||
const handleOk = () => {
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
const handleCancel = () => {
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
// 审核按钮点击事件
|
||||
const handleAudit = (record) => {
|
||||
if (record.isAuditing) {
|
||||
console.log(`简历 ${record.id} 已审核,状态为:${record.status}`)
|
||||
|
||||
record.isAuditing = false
|
||||
} else {
|
||||
record.isAuditing = true
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { Message } from '@arco-design/web-vue'
|
||||
import option from './option'
|
||||
import { addDelivery, getPositionList } from '@/api/upms/position'
|
||||
|
||||
@ -72,7 +73,7 @@ const getDeliverys = async () => {
|
||||
const addDeliverys = async () => {
|
||||
try {
|
||||
// 根据当前选中行的记录和表单选择的职位构建请求体
|
||||
console.log(`获取到的当前行是${JSON.stringify(currentRecord.value)}`)
|
||||
// console.log(`获取到的当前行是${JSON.stringify(currentRecord.value)}`)
|
||||
const entity = {
|
||||
fullName: currentRecord.value?.fullName || '',
|
||||
resumeSource: currentRecord.value?.resumeSource || '',
|
||||
@ -80,9 +81,14 @@ const addDeliverys = async () => {
|
||||
id: currentRecord.value.id
|
||||
}
|
||||
const response = await addDelivery(entity)
|
||||
console.log('投递结果:', response.data)
|
||||
// 如果成功,基本什么都不会返回,结果undefined
|
||||
if (response === undefined) {
|
||||
// 弹出消息提示
|
||||
Message.success('投递成功')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('投递失败:', error)
|
||||
Message.error('投递失败,请稍后重试')
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user