筛选管理页面接口对接
This commit is contained in:
@@ -40,7 +40,7 @@ export const ApiFollowupConfigsAdd = (data: any) => {
|
||||
// 更新复聊配置
|
||||
export const ApiFollowupConfigsEditor = (data: any) => {
|
||||
const formData = new FormData()
|
||||
formData.append('followup_days', data.followup_days)
|
||||
if (data.followup_days) formData.append('followup_days', data.followup_days)
|
||||
formData.append('is_active', data.is_active)
|
||||
return request({
|
||||
url: `/api/followup-configs/${data.id}`,
|
||||
|
||||
71
src/api/ScreeningManagement/index.ts
Normal file
71
src/api/ScreeningManagement/index.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/*
|
||||
* 筛选管理
|
||||
* */
|
||||
|
||||
// 获取筛选配置列表
|
||||
export const ApiFilters = () => {
|
||||
return request({
|
||||
url: `/api/filters`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取单个复聊配置
|
||||
export const ApiFiltersId = (id: string) => {
|
||||
return request({
|
||||
url: `/api/filters/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 创建筛选配置
|
||||
export const ApiFiltersAdd = (data: any) => {
|
||||
const formData = new FormData()
|
||||
formData.append('name', data.name)
|
||||
formData.append('position_keywords', data.position_keywords)
|
||||
formData.append('city', data.city)
|
||||
formData.append('salary_min', data.salary_min)
|
||||
formData.append('salary_max', data.salary_max)
|
||||
formData.append('experience', data.experience)
|
||||
formData.append('education', data.education)
|
||||
formData.append('is_active', data.is_active)
|
||||
return request({
|
||||
url: `/api/filters`,
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 更新筛选配置
|
||||
export const ApiFiltersEditor = (data: any) => {
|
||||
const formData = new FormData()
|
||||
if (data.name) formData.append('name', data.name)
|
||||
if (data.position_keywords) formData.append('position_keywords', data.position_keywords)
|
||||
if (data.city) formData.append('city', data.city)
|
||||
if (data.salary_min) formData.append('salary_min', data.salary_min)
|
||||
if (data.salary_max) formData.append('salary_max', data.salary_max)
|
||||
if (data.experience) formData.append('experience', data.experience)
|
||||
if (data.education) formData.append('education', data.education)
|
||||
formData.append('is_active', data.is_active)
|
||||
return request({
|
||||
url: `/api/filters/${data.id}`,
|
||||
method: 'put',
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除筛选配置
|
||||
export const ApiFiltersDelete = (id: string) => {
|
||||
return request({
|
||||
url: `/api/filters/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -362,6 +362,25 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/screening',
|
||||
name: 'Screening',
|
||||
component: Layout,
|
||||
meta: {
|
||||
title: '筛选管理',
|
||||
icon: 'setting'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'screeningManagement',
|
||||
name: 'ScreeningManagement',
|
||||
component: () => import('@/views/ScreeningManagement/index.vue'),
|
||||
meta: {
|
||||
title: '筛选管理'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
// 注册平台登记
|
||||
// {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<el-table-column label="复聊间隔" prop="followup_days" />
|
||||
<el-table-column label="启用状态" prop="is_active">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.is_active" disabled />
|
||||
<el-switch v-model="scope.row.is_active" @change="onStatusModification(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="created_at">
|
||||
@@ -236,6 +236,30 @@ const handleExpandTask = (rowId: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onStatusModification = (data: any) => {
|
||||
ElMessageBox.confirm(
|
||||
data.is_active ? '确认启用已选中的数据项?' : '确认禁用已选中的数据项?',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
loading.value = true
|
||||
ApiFollowupConfigsEditor({ is_active: data.is_active, id: data.id })
|
||||
.then(() => {
|
||||
ElMessage.success('修改成功')
|
||||
handleResetQuery()
|
||||
})
|
||||
.finally(() => (loading.value = false))
|
||||
})
|
||||
.catch(() => {
|
||||
handleResetQuery()
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
handleQuery()
|
||||
})
|
||||
|
||||
137
src/views/ScreeningManagement/components/FilterSettingsForm.vue
Normal file
137
src/views/ScreeningManagement/components/FilterSettingsForm.vue
Normal file
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<div class="pre-registration-form">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="auto"
|
||||
label-position="top"
|
||||
>
|
||||
<el-form-item label="配置名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入" />
|
||||
<!-- <el-select v-model="formData.task_type" placeholder="请选择">-->
|
||||
<!-- <el-option label="检查登录" value="check_login" />-->
|
||||
<!-- <el-option label="招聘" value="boss_recruit" />-->
|
||||
<!-- </el-select>-->
|
||||
</el-form-item>
|
||||
<el-form-item label="岗位关键词" prop="position_keywords">
|
||||
<el-input v-model="formData.position_keywords" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="城市" prop="city">
|
||||
<el-input v-model="formData.city" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最低薪资(k)" prop="salary_min">
|
||||
<el-input v-model="formData.salary_min" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最高薪资(k)" prop="salary_max">
|
||||
<el-input v-model="formData.salary_max" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工作经验" prop="experience">
|
||||
<el-input v-model="formData.experience" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学历要求" prop="education">
|
||||
<el-input v-model="formData.education" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="is_active">
|
||||
<el-switch v-model="formData.is_active" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { deepCloneByJSON } from '@/utils/auxiliaryFunction'
|
||||
|
||||
const props = defineProps({
|
||||
newData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const formRef = ref()
|
||||
// 表单数据
|
||||
const formData = reactive<any>({
|
||||
name: '',
|
||||
position_keywords: '',
|
||||
city: '',
|
||||
salary_min: '',
|
||||
salary_max: '',
|
||||
experience: '',
|
||||
education: '',
|
||||
is_active: false
|
||||
})
|
||||
const formRules = reactive<any>({
|
||||
name: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
position_keywords: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
city: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
salary_min: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
experience: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
education: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
is_active: [{ required: true, message: '请输入', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
setFormData(props.newData)
|
||||
})
|
||||
|
||||
const getForm = () => {
|
||||
return formData
|
||||
}
|
||||
|
||||
const setFormData = (data: any) => {
|
||||
if (data && Object.keys(data).length > 0) {
|
||||
const data1 = deepCloneByJSON(data)
|
||||
|
||||
Object.assign(formData, data1)
|
||||
}
|
||||
}
|
||||
|
||||
const submit = (): Promise<boolean> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
formRef.value?.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
resolve(true)
|
||||
} else {
|
||||
ElMessage.error('请完善必填信息')
|
||||
reject(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
submit,
|
||||
getForm
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pre-registration-form {
|
||||
width: 100%;
|
||||
padding-right: 20px;
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
}
|
||||
.section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
</style>
|
||||
239
src/views/ScreeningManagement/index.vue
Normal file
239
src/views/ScreeningManagement/index.vue
Normal file
@@ -0,0 +1,239 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card shadow="hover" class="data-table">
|
||||
<div class="data-table__toolbar">
|
||||
<div class="data-table__toolbar--actions">
|
||||
<el-button type="success" icon="plus" @click="handleOpenDialog()">新增</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
ref="dataTableRef"
|
||||
v-loading="loading"
|
||||
:data="roleList"
|
||||
highlight-current-row
|
||||
row-key="id"
|
||||
border
|
||||
class="data-table__content"
|
||||
>
|
||||
<el-table-column label="配置名称" prop="name" />
|
||||
<el-table-column label="岗位关键词" prop="position_keywords" />
|
||||
<el-table-column label="城市" prop="city" />
|
||||
<el-table-column label="薪资范围(单位:k)" prop="salary_min">
|
||||
<template #default="scope">
|
||||
{{ scope.row.salary_min || 0 }} - {{ scope.row.salary_max || 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="复聊间隔" prop="salary_max" />-->
|
||||
<el-table-column label="工作经验" prop="experience" />
|
||||
<el-table-column label="学历要求" prop="education" />
|
||||
<el-table-column label="启用状态" prop="is_active">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.is_active" @change="onStatusModification(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="created_at">
|
||||
<template #default="scope">
|
||||
{{ formatISOToDateTime(scope.row?.created_at || '') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="220">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
link
|
||||
icon="edit"
|
||||
@click="handleOpenDialog(scope.row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
link
|
||||
icon="delete"
|
||||
@click="onUserDeleteDepartment(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-if="total > 0"
|
||||
v-model:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="fetchData"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RolePageVO } from '@/api/system/role-api'
|
||||
import { functionDialogBox } from '@/utils/functionDialogBox'
|
||||
import FilterSettingsForm from './components/FilterSettingsForm.vue'
|
||||
import { formatISOToDateTime } from '@/utils/auxiliaryFunction'
|
||||
import {
|
||||
ApiFilters,
|
||||
ApiFiltersAdd,
|
||||
ApiFiltersDelete,
|
||||
ApiFiltersEditor
|
||||
} from '@/api/ScreeningManagement'
|
||||
|
||||
defineOptions({
|
||||
name: 'Role',
|
||||
inheritAttrs: false
|
||||
})
|
||||
|
||||
const queryFormRef = ref()
|
||||
const dataTableRef = ref()
|
||||
const loading = ref(false)
|
||||
const total = ref(0)
|
||||
|
||||
const queryParams = reactive<any>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
times: [],
|
||||
seal_type: '',
|
||||
CaseNumber: ''
|
||||
})
|
||||
|
||||
// 表格数据
|
||||
const roleList = ref<RolePageVO[]>()
|
||||
|
||||
// 弹窗
|
||||
const dialog = reactive({
|
||||
title: '',
|
||||
visible: false
|
||||
})
|
||||
|
||||
// 获取数据
|
||||
function fetchData() {
|
||||
loading.value = true
|
||||
ApiFilters()
|
||||
.then((res: any) => {
|
||||
roleList.value = res.data
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 查询(重置页码后获取数据)
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
// 重置查询
|
||||
function handleResetQuery() {
|
||||
if (queryFormRef.value) queryFormRef.value.resetFields()
|
||||
queryParams.pageNum = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
// 打开角色弹窗
|
||||
function handleOpenDialog(data: any = null) {
|
||||
dialog.visible = true
|
||||
if (data) {
|
||||
functionDialogBox(
|
||||
FilterSettingsForm,
|
||||
{
|
||||
newData: data
|
||||
},
|
||||
{
|
||||
title: '编辑筛选配置',
|
||||
width: '900',
|
||||
ok(value: any) {
|
||||
handleSubmit({ id: data.id, ...value })
|
||||
}
|
||||
}
|
||||
)
|
||||
} else {
|
||||
functionDialogBox(
|
||||
FilterSettingsForm,
|
||||
{},
|
||||
{
|
||||
title: '创建筛选配置',
|
||||
width: '900',
|
||||
ok(value: any) {
|
||||
handleSubmit(value)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交角色表单
|
||||
function handleSubmit(data: any) {
|
||||
loading.value = true
|
||||
const roleId = data.id
|
||||
if (roleId) {
|
||||
ApiFiltersEditor(data)
|
||||
.then(() => {
|
||||
ElMessage.success('修改成功')
|
||||
handleResetQuery()
|
||||
})
|
||||
.finally(() => (loading.value = false))
|
||||
} else {
|
||||
ApiFiltersAdd(data)
|
||||
.then(() => {
|
||||
ElMessage.success('新增成功')
|
||||
handleResetQuery()
|
||||
})
|
||||
.finally(() => (loading.value = false))
|
||||
}
|
||||
}
|
||||
|
||||
const onUserDeleteDepartment = (id: string) => {
|
||||
ElMessageBox.confirm('确认删除已选中的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(
|
||||
() => {
|
||||
loading.value = true
|
||||
ApiFiltersDelete(id)
|
||||
.then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
handleResetQuery()
|
||||
})
|
||||
.finally(() => (loading.value = false))
|
||||
},
|
||||
() => {
|
||||
ElMessage.info('已取消删除')
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const onStatusModification = (data: any) => {
|
||||
ElMessageBox.confirm(
|
||||
data.is_active ? '确认启用已选中的数据项?' : '确认禁用已选中的数据项?',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
loading.value = true
|
||||
ApiFiltersEditor({ is_active: data.is_active, id: data.id })
|
||||
.then(() => {
|
||||
ElMessage.success('修改成功')
|
||||
handleResetQuery()
|
||||
})
|
||||
.finally(() => (loading.value = false))
|
||||
})
|
||||
.catch(() => {
|
||||
handleResetQuery()
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
handleQuery()
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user