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