Browse Source

职位发布调整

Xiao_123 2 months ago
parent
commit
24fa360ff5

+ 13 - 8
src/views/recruit/enterprise/jobFair/details.vue

@@ -91,7 +91,7 @@
 <script setup>
 defineOptions({ name: 'jobFairJob'})
 import { ref } from 'vue'
-import { getJobFairPosition, getJobFair, getJobFairRights } from '@/api/recruit/enterprise/jobFair'
+import { getJobFairPosition, getJobFair, getJobFairRights, joinJobFairPosition } from '@/api/recruit/enterprise/jobFair'
 import { dealDictArrayData } from '@/utils/position.js'
 import JobItem from './job/item.vue'
 import { useRouter, useRoute } from 'vue-router'
@@ -136,11 +136,11 @@ const getJobList = async () => {
   jobList.value = dealDictArrayData([], data)
 }
 
-const handleAdd = async () => {
-  const data = await getEnterprisePubJobTypePermission()
-  if (!data || !data.length) return Snackbar.warning('没有该操作权限,请联系平台管理员升级后再试')
-  router.push(`/recruit/enterprise/jobFair/details/${id}/edit`)
-}
+// const handleAdd = async () => {
+//   const data = await getEnterprisePubJobTypePermission()
+//   if (!data || !data.length) return Snackbar.warning('没有该操作权限,请联系平台管理员升级后再试')
+//   router.push(`/recruit/enterprise/jobFair/details/${id}/edit`)
+// }
 
 const showDrawer = ref(false)
 const handleJoin = async () => {
@@ -153,8 +153,13 @@ const handleChangePage = (index) => {
   getPositionList()
 }
 
-const handleTo = (val) => {
-  router.push(`/recruit/enterprise/jobFair/details/${id}/edit?id=${val.id}`)
+// 添加至招聘会
+const handleTo = async (val) => {
+  await joinJobFairPosition({ jobFairId: id, jobId: val.id })
+  Snackbar.success('加入成功')
+  showDrawer.value = false
+  getJobNum()
+  getJobList()
 }
 
 // 获取职位列表

+ 7 - 23
src/views/recruit/enterprise/jobFair/editJob/index.vue

@@ -22,11 +22,7 @@ import CtForm from '@/components/CtForm'
 import Add from '@/views/recruit/enterprise/positionManagement/components/add.vue'
 import { useI18n } from '@/hooks/web/useI18n'
 import { schoolMajorByName, schoolMajorById } from '@/api/recruit/personal/resume'
-import {
-  saveJobAdvertisedExtend,
-  joinJobFairPosition,
-  getJobAdvertisedExtend
-} from '@/api/recruit/enterprise/jobFair'
+import { saveJobAdvertisedExtend, joinJobFairPosition, getJobAdvertisedExtend } from '@/api/recruit/enterprise/jobFair'
 import Snackbar from '@/plugins/snackbar'
 
 
@@ -42,8 +38,8 @@ const items = ref({
       type: 'text',
       key: 'dept',
       value: null,
+      col: 6,
       label: '招聘部门 ',
-      // rules: [v => !!v || '请选择招聘部门']
     },
     {
       type: 'autocomplete',
@@ -52,8 +48,9 @@ const items = ref({
       value: null,
       label: '专业要求 ',
       itemText: 'nameCn',
+      col: 6,
       itemValue: 'id',
-      // rules: [v => !!v || '专业要求'],
+      flexStyle: 'ml-3',
       noDataText: '请输入检索专业',
       items: []
     },
@@ -63,7 +60,6 @@ const items = ref({
       value: null,
       label: '工作频率 ',
       col: 6,
-      // rules: [v => !!v || '请选择工作频率'],
       items: [
         { label: '每周', value: 'week' },
         { label: '每月', value: 'month' },
@@ -77,23 +73,10 @@ const items = ref({
       flexStyle: 'ml-3',
       col: 6,
       label: '出勤天数 ',
-      // rules: [v => v > 0 || '请填写正确的出勤天数']
-    },
-    {
-      type: 'ifRadio',
-      key: 'hot',
-      value: 1,
-      label: '热门职位 ',
-      items: [
-        { label: '是', value: 1 },
-        { label: '否', value: 0 },
-      ],
-      // rules: [v => !!v || '请选择是否热门']
-    },
+    }
   ]
 })
 
-// console.log(route)
 if (route.query.id) {
   // 编辑
   initPosition(route.query.id)
@@ -150,8 +133,9 @@ const afterAdd = async (jobId) => {
       r[v.key] = v.type === 'number' ? +v.value : v.value
       return r
     }, { jobId })
+
+    console.log(query, 'query')
     await saveJobAdvertisedExtend(query)
-    console.log('招聘会职位扩展信息保存成功')
     await joinJobFairPosition({
       jobFairId: route.params.id,
       jobId

+ 125 - 13
src/views/recruit/enterprise/positionManagement/components/add.vue

@@ -11,7 +11,13 @@
           <div>
             <h2 class="mt-n1 headline font-weight-regular">{{ val.title }}</h2>
             <div class="mb-4 desc">{{ val.desc }}</div>
-            <component :is="val.path" :ref="val.ref" :itemData="itemData"></component>
+            <component :is="val.path" :ref="val.ref" :itemData="itemData" @changeType="handleChangeType"></component>
+          </div>
+        </v-timeline-item>
+        <v-timeline-item v-if="showExtend" dot-color="light-blue darken-1" icon="mdi-numeric-3">
+          <div>
+            <h2 class="mt-n1 headline font-weight-regular">其他</h2>
+            <CtForm ref="formPageRef" class="mt-3" :items="items" style="width: 650px;"></CtForm>
           </div>
         </v-timeline-item>
         <slot name="timeline"></slot>
@@ -49,6 +55,8 @@ import Snackbar from '@/plugins/snackbar'
 import { useI18n } from '@/hooks/web/useI18n'
 import { useUserStore } from '@/store/user'
 import { createTradeOrder } from '@/api/position'
+import { saveJobAdvertisedExtend, getJobAdvertisedExtend } from '@/api/recruit/enterprise/jobFair'
+import { schoolMajorByName, schoolMajorById } from '@/api/recruit/personal/resume'
 
 // 添加只为之后是否需要额外操作
 const props = defineProps({
@@ -87,6 +95,114 @@ const list = [
   }
 ]
 
+const formPageRef = ref()
+const items = ref({
+  options: [
+    {
+      type: 'text',
+      key: 'dept',
+      value: null,
+      col: 6,
+      label: '招聘部门 '
+    },
+    {
+      type: 'autocomplete',
+      key: 'majorId',
+      search: getMajorList,
+      value: null,
+      label: '专业要求 ',
+      itemText: 'nameCn',
+      col: 6,
+      itemValue: 'id',
+      flexStyle: 'ml-3',
+      noDataText: '请输入检索专业',
+      items: []
+    },
+    {
+      type: 'autocomplete',
+      key: 'frequency-dateType',
+      value: null,
+      label: '工作频率 ',
+      col: 6,
+      items: [
+        { label: '每周', value: 'week' },
+        { label: '每月', value: 'month' },
+        { label: '每年', value: 'year' }
+      ]
+    },
+    {
+      type: 'number',
+      key: 'frequency-day',
+      value: null,
+      flexStyle: 'ml-3',
+      col: 6,
+      label: '出勤天数 '
+    }
+  ]
+})
+
+// 是否展示扩展信息
+const showExtend = ref(false)
+const handleChangeType = (show) => {
+  console.log(show, '招聘类型是否为实习')
+  showExtend.value = show
+  if (!show) {
+    items.value.options.forEach(e => e.value = null)
+  }
+}
+
+async function initPosition (jobId) {
+  const res = await getJobAdvertisedExtend(jobId)
+  console.log(res, '获取扩展信息')
+  if (!res) return
+  items.value.options.forEach(e => {
+    if (e.key.includes('frequency') && res.frequency) {
+      const keys = e.key.split('-')
+      e.value = res[keys[0]][keys[1]]
+      return
+    }
+    if (e.key === 'majorId') {
+      getMajorById(res.majorId)
+    }
+    e.value = res[e.key]
+  })
+  showExtend.value = true
+}
+
+async function getMajorList (name) {
+  if (!name) {
+    return
+  }
+  const res = await schoolMajorByName({ name })
+  items.value.options.find(e => e.key === 'majorId').items = res
+}
+
+async function getMajorById (id) {
+  if (!id) return
+  const res = await schoolMajorById({ id })
+  items.value.options.find(e => e.key === 'majorId').items = [res]
+}
+
+// 保存扩展信息
+const handleSaveExtend = async (jobId) => {
+  const query = items.value.options.reduce((r, v) => {
+    if (v.key.includes('frequency')) {
+      const keys = v.key.split('-')
+      if (!r[keys[0]]) {
+        r[keys[0]] = {}
+      }
+      r[keys[0]][keys[1]] = v.type === 'number' ? +v.value : v.value
+      return r
+    }
+    if (v.key === 'majorId') {
+      r.major = v.items.find(e => e.id === v.value)?.nameCn || ''
+    }
+    r[v.key] = v.type === 'number' ? +v.value : v.value
+    return r
+  }, { jobId })
+  console.log(query, 'extendInfo')
+  await saveJobAdvertisedExtend(query)
+}
 
 let submitParams = {}
 // 发布
@@ -100,18 +216,11 @@ const handleSave = async () => {
     window.scrollTo({ top: 0, behavior: 'smooth' })
     return
   }
-  // if (!requirement?.areaId) return Snackbar.warning('请选择工作城市')
   if (!baseInfo || !requirement) return Snackbar.warning('请将信息填写完整')
   
   submitParams = Object.assign(baseInfo, requirement, { currency_type: 0, source: props.isFair ? '2' : '0', bizId: props.isFair ? route.params.id : null }) // currency_type: 写死0(人民币)  source: 0职位管理|1招聘会
-  console.log('submitParams', submitParams)
   if (route.query && route.query.id) submitParams.id = route.query.id // 有id则为编辑
-  if (props.valid) {
-    const { valid } = await props.valid()
-    if (!valid) {
-      return
-    }
-  }
+  console.log('发布职位参数', submitParams)
   saveEmit()
 }
 
@@ -130,10 +239,10 @@ const saveEmit = async () => {
       Snackbar.warning('当前可发布职位额度不足,请扫码支付')
       return
     }
-    if (props.afterAdd) {
-      await props.afterAdd(res)
-      return
-    }
+
+    // 保存扩展信息
+    if (showExtend.value) await handleSaveExtend(res)
+
     Snackbar.success(submitParams.id ? t('common.editSuccessMsg') : '发布成功')
     handleCancel()
   } catch (error) {
@@ -172,6 +281,9 @@ const getPositionDetail = async (id) => {
   const data = await getJobDetails({ id })
   if (!data && !Object.keys(data).length) return
   itemData.value = {...data, ...dealDictObjData({}, data)}
+
+  // 招聘类型为实习则获取扩展信息
+  if (data.type === '3') initPosition(id)
 }
 
 // 有id为编辑

+ 9 - 1
src/views/recruit/enterprise/positionManagement/components/jobRequirements.vue

@@ -73,6 +73,7 @@ import { getDict } from '@/hooks/web/useDictionaries'
 import { getTagTreeDataApi } from '@/api/enterprise'
 import { getEnterprisePubJobTypePermission } from '@/api/recruit/enterprise/position'
 
+const emits = defineEmits(['changeType'])
 const props = defineProps({
   itemData: Object
 })
@@ -112,6 +113,12 @@ const rules = {
   payUnit: [v => !!v || '请选择计薪时段'],
 }
 
+const handleChangeType = (val) => {
+  const type = items.value.options.find(e => e.key === 'type')
+  const obj = type.items.find(e => Number(e.value) === Number(val))
+  emits('changeType', obj[type.itemText] === '实习')
+}
+
 const formPageRef = ref()
 let query = reactive({})
 const items = ref({
@@ -125,7 +132,8 @@ const items = ref({
       itemValue: 'value',
       col: 4,
       rules: [v => !!v || '招聘类型'],
-      items: []
+      items: [],
+      change: handleChangeType
     },
     {
       type: 'autocomplete',