haha
This commit is contained in:
@@ -77,3 +77,11 @@ export const ApiAccountsDelete = (id: string) => {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取招聘筛选项(来自网站同步快照)
|
||||
export const ApiRecruitFilterOptions = (accountId: string) => {
|
||||
return request({
|
||||
url: `/api/filters/options?account_id=${accountId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,7 +27,12 @@ export const ApiTasksAdd = (data: any) => {
|
||||
// formData.append('worker_id', data.worker_id)
|
||||
// formData.append('account_name', data.account_name)
|
||||
formData.append('id', data.boss_id)
|
||||
formData.append('params', data.params)
|
||||
const rawParams = data?.params
|
||||
if (typeof rawParams === 'string') {
|
||||
formData.append('params', rawParams)
|
||||
} else {
|
||||
formData.append('params', JSON.stringify(rawParams || {}))
|
||||
}
|
||||
return request({
|
||||
url: `/api/tasks`,
|
||||
method: 'post',
|
||||
|
||||
133
src/views/BoosAccountManagement/components/RecruitTaskForm.vue
Normal file
133
src/views/BoosAccountManagement/components/RecruitTaskForm.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<div class="recruit-task-form">
|
||||
<el-alert
|
||||
v-if="syncedAt"
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
style="margin-bottom: 12px"
|
||||
:title="`筛选项同步时间:${syncedAt}`"
|
||||
/>
|
||||
<el-alert
|
||||
v-else
|
||||
type="warning"
|
||||
:closable="false"
|
||||
show-icon
|
||||
style="margin-bottom: 12px"
|
||||
title="当前账号暂无筛选项,请先启动客户端同步筛选项"
|
||||
/>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="auto" label-position="top">
|
||||
<el-form-item label="筛选条件(可多选)" prop="selected_filters">
|
||||
<el-select
|
||||
v-model="formData.selected_filters"
|
||||
multiple
|
||||
filterable
|
||||
clearable
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
:loading="optionsLoading"
|
||||
placeholder="请选择筛选条件"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in filterOptions"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="招聘人数" prop="greet_target">
|
||||
<el-input-number
|
||||
v-model="formData.greet_target"
|
||||
:min="1"
|
||||
:max="500"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ApiRecruitFilterOptions } from '@/api/BoosAccountManagement'
|
||||
|
||||
const props = defineProps({
|
||||
accountId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
const formRef = ref()
|
||||
const optionsLoading = ref(false)
|
||||
const filterOptions = ref<string[]>([])
|
||||
const syncedAt = ref('')
|
||||
|
||||
const formData = reactive({
|
||||
selected_filters: [] as string[],
|
||||
greet_target: 20
|
||||
})
|
||||
|
||||
const formRules = reactive<any>({
|
||||
selected_filters: [{ required: true, message: '请至少选择一个筛选条件', trigger: 'change' }],
|
||||
greet_target: [{ required: true, message: '请输入招聘人数', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const fetchOptions = () => {
|
||||
if (!props.accountId) return
|
||||
optionsLoading.value = true
|
||||
ApiRecruitFilterOptions(props.accountId)
|
||||
.then((res: any) => {
|
||||
filterOptions.value = (res.data?.flat_options || []) as string[]
|
||||
syncedAt.value = res.data?.synced_at || ''
|
||||
})
|
||||
.finally(() => {
|
||||
optionsLoading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchOptions()
|
||||
})
|
||||
|
||||
const getForm = () => {
|
||||
return {
|
||||
selected_filters: [...formData.selected_filters],
|
||||
greet_target: Number(formData.greet_target) || 20
|
||||
}
|
||||
}
|
||||
|
||||
const submit = (): Promise<boolean> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (filterOptions.value.length === 0) {
|
||||
ElMessage.error('暂无可选筛选项,请先启动客户端同步筛选项')
|
||||
reject(false)
|
||||
return
|
||||
}
|
||||
formRef.value?.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
resolve(true)
|
||||
} else {
|
||||
ElMessage.error('请完善招聘参数')
|
||||
reject(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
submit,
|
||||
getForm
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.recruit-task-form {
|
||||
width: 100%;
|
||||
padding-right: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
>
|
||||
<el-table-column label="任务类型" prop="task_type">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.task_type === 'check_login' ? '检查登录' : '招聘' }}</span>
|
||||
<span>{{ taskTypeLabel(scope.row.task_type) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="指定电脑" prop="worker_id" />
|
||||
@@ -32,8 +32,8 @@
|
||||
<el-tag v-else-if="scope.row.status === 'failed'" type="danger">失败</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 'pending'" type="primary">已创建</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 'dispatched'" type="primary">已派发</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 'running'" type="primary">正在执行</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 'cancelled'" type="info">任务已取消</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 'running'" type="primary">执行中</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 'cancelled'" type="info">已取消</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="created_at">
|
||||
@@ -58,7 +58,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// 表格数据
|
||||
import { ApiTasks } from '@/api/TaskManagement'
|
||||
import { formatISOToDateTime } from '@/utils/auxiliaryFunction'
|
||||
import { createTimer } from '@/utils/TimerManager'
|
||||
@@ -76,22 +75,33 @@ const queryParams = reactive<any>({
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
// 获取数据
|
||||
|
||||
const taskTypeLabel = (taskType: string) => {
|
||||
if (taskType === 'check_login') return '检查登录'
|
||||
if (taskType === 'boss_recruit') return '招聘'
|
||||
if (taskType === 'boss_reply') return '回复'
|
||||
return taskType || '--'
|
||||
}
|
||||
|
||||
function fetchData() {
|
||||
ApiTasks(props.bossId, queryParams.pageNum, queryParams.pageSize).then((res: any) => {
|
||||
roleList.value = res.data.results
|
||||
total.value = res.data.total
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
fetchData
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
startTimer(fetchData, 5000)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
stopTimer()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
|
||||
@@ -139,6 +139,13 @@
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="300">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="onApiTasksAdd(scope.row.id, 'boss_reply', {})"
|
||||
>
|
||||
回复
|
||||
</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- size="small"-->
|
||||
@@ -160,14 +167,14 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="onApiTasksAdd(scope.row.id, 'check_login', '')"
|
||||
@click="onApiTasksAdd(scope.row.id, 'check_login', {})"
|
||||
>
|
||||
检查登录
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
@click="onApiTasksAdd(scope.row.id, 'boss_recruit', '')"
|
||||
@click="openRecruitDialog(scope.row.id)"
|
||||
>
|
||||
招聘
|
||||
</el-button>
|
||||
@@ -217,6 +224,7 @@
|
||||
import { RolePageVO } from '@/api/system/role-api'
|
||||
import { functionDialogBox } from '@/utils/functionDialogBox'
|
||||
import BoosAccountForm from './components/BoosAccountForm.vue'
|
||||
import RecruitTaskForm from './components/RecruitTaskForm.vue'
|
||||
import { BusinessEditApplication } from '@/api/calibration/applicationForSealApproval'
|
||||
import { ApiAccounts, ApiAccountsAdd, ApiAccountsDelete } from '@/api/BoosAccountManagement'
|
||||
import ViewTheTaskListDetails from './components/ViewTheTaskListDetails.vue'
|
||||
@@ -370,7 +378,23 @@ const onUserDeleteDepartment = (id: string) => {
|
||||
// )
|
||||
// }
|
||||
|
||||
const onApiTasksAdd = (id: string, task_type: string, params: string) => {
|
||||
const openRecruitDialog = (id: string) => {
|
||||
functionDialogBox(
|
||||
RecruitTaskForm,
|
||||
{
|
||||
accountId: id
|
||||
},
|
||||
{
|
||||
title: '招聘参数',
|
||||
width: '620',
|
||||
ok(value: any) {
|
||||
onApiTasksAdd(id, 'boss_recruit', value || {})
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const onApiTasksAdd = (id: string, task_type: string, params: any = {}) => {
|
||||
// functionDialogBox(
|
||||
// TaskForm,
|
||||
// {},
|
||||
@@ -387,7 +411,7 @@ const onApiTasksAdd = (id: string, task_type: string, params: string) => {
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
|
||||
loading.value = true
|
||||
ApiTasksAdd({ params, task_type, boss_id: id })
|
||||
.then((res: any) => {
|
||||
ElMessage.success(res.msg)
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
label-position="top"
|
||||
>
|
||||
<el-form-item label="任务类型" prop="task_type">
|
||||
<!-- <el-input v-model="formData.task_type" placeholder="请输入" />-->
|
||||
<el-select v-model="formData.task_type" placeholder="请选择">
|
||||
<el-option label="检查登录" value="check_login" />
|
||||
<el-option label="招聘" value="boss_recruit" />
|
||||
<el-option label="回复" value="boss_reply" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务参数" prop="params">
|
||||
@@ -33,7 +33,6 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const formRef = ref()
|
||||
// 表单数据
|
||||
const formData = reactive<any>({
|
||||
task_type: '',
|
||||
worker_id: '',
|
||||
@@ -56,7 +55,6 @@ const getForm = () => {
|
||||
const setFormData = (data: any) => {
|
||||
if (data && Object.keys(data).length > 0) {
|
||||
const data1 = deepCloneByJSON(data)
|
||||
|
||||
Object.assign(formData, data1)
|
||||
}
|
||||
}
|
||||
@@ -73,6 +71,7 @@ const submit = (): Promise<boolean> => {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
submit,
|
||||
getForm
|
||||
@@ -108,3 +107,4 @@ defineExpose({
|
||||
gap: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
label-position="top"
|
||||
>
|
||||
<el-form-item label="任务类型" prop="task_type">
|
||||
<!-- <el-input v-model="formData.task_type" placeholder="请输入" />-->
|
||||
<el-select v-model="formData.task_type" placeholder="请选择">
|
||||
<el-option label="检查登录" value="check_login" />
|
||||
<el-option label="招聘" value="boss_recruit" />
|
||||
<el-option label="回复" value="boss_reply" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务参数" prop="params">
|
||||
@@ -33,7 +33,6 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const formRef = ref()
|
||||
// 表单数据
|
||||
const formData = reactive<any>({
|
||||
task_type: '',
|
||||
worker_id: '',
|
||||
@@ -56,7 +55,6 @@ const getForm = () => {
|
||||
const setFormData = (data: any) => {
|
||||
if (data && Object.keys(data).length > 0) {
|
||||
const data1 = deepCloneByJSON(data)
|
||||
|
||||
Object.assign(formData, data1)
|
||||
}
|
||||
}
|
||||
@@ -73,6 +71,7 @@ const submit = (): Promise<boolean> => {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
submit,
|
||||
getForm
|
||||
@@ -108,3 +107,4 @@ defineExpose({
|
||||
gap: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
label-position="top"
|
||||
>
|
||||
<el-form-item label="任务类型" prop="task_type">
|
||||
<!-- <el-input v-model="formData.task_type" placeholder="请输入" />-->
|
||||
<el-select v-model="formData.task_type" placeholder="请选择">
|
||||
<el-option label="检查登录" value="check_login" />
|
||||
<el-option label="招聘" value="boss_recruit" />
|
||||
<el-option label="回复" value="boss_reply" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务参数" prop="params">
|
||||
@@ -33,7 +33,6 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const formRef = ref()
|
||||
// 表单数据
|
||||
const formData = reactive<any>({
|
||||
task_type: '',
|
||||
worker_id: '',
|
||||
@@ -56,7 +55,6 @@ const getForm = () => {
|
||||
const setFormData = (data: any) => {
|
||||
if (data && Object.keys(data).length > 0) {
|
||||
const data1 = deepCloneByJSON(data)
|
||||
|
||||
Object.assign(formData, data1)
|
||||
}
|
||||
}
|
||||
@@ -73,6 +71,7 @@ const submit = (): Promise<boolean> => {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
submit,
|
||||
getForm
|
||||
@@ -108,3 +107,4 @@ defineExpose({
|
||||
gap: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user