소스 검색

基本信息中加入招聘会下拉

lifanagju_citu 1 개월 전
부모
커밋
fe57fdba23

+ 1 - 0
components.d.ts

@@ -32,6 +32,7 @@ declare module 'vue' {
     DatePicker: typeof import('./src/components/DatePicker/index.vue')['default']
     Echarts: typeof import('./src/components/Echarts/index.vue')['default']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
+    ElTree: typeof import('element-plus/es')['ElTree']
     Empty: typeof import('./src/components/Empty/index.vue')['default']
     File: typeof import('./src/components/Upload/file.vue')['default']
     HeadSearch: typeof import('./src/components/headSearch/index.vue')['default']

+ 3 - 2
src/views/recruit/enterprise/positionManagement/components/add.vue

@@ -217,8 +217,9 @@ const handleSave = async () => {
     return
   }
   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招聘会
+  
+  // 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招聘会
+  submitParams = Object.assign(baseInfo, requirement, { currency_type: 0 }) // currency_type: 写死0(人民币)  source: 0职位管理|1招聘会
   if (route.query && route.query.id) submitParams.id = route.query.id // 有id则为编辑
   console.log('发布职位参数', submitParams)
   saveEmit()

+ 59 - 2
src/views/recruit/enterprise/positionManagement/components/baseInfo.vue

@@ -1,6 +1,21 @@
 <template>
   <div>
     <CtForm ref="formPageRef" :items="items" style="width: 650px;">
+      <template #bizId="{ item }">
+        <div>
+          <v-checkbox-btn
+            v-model="jobFairCheckbox"
+            color="primary"
+            label="设置为招聘会职位"
+            class="ml-2"
+            :disabled="false"
+            :style="`line-height: ${item.dense === 'default' ? 56 : item.dense === 'comfortable' ? 48 : 40 }px;`"
+            style="width: 174px;"
+            hide-details
+            @update:modelValue="v => jobFairCheckboxChange(v, item)"
+          ></v-checkbox-btn>
+        </div>
+      </template>
       <template #positionId="{ item }">
         <v-menu :close-delay="1" :open-delay="0" v-bind="$attrs">
           <template v-slot:activator="{  props }">
@@ -44,6 +59,7 @@ import { getRecruitPositionDetails } from '@/api/recruit/enterprise/position'
 import Confirm from '@/plugins/confirm'
 import Snackbar from '@/plugins/snackbar'
 import { useI18n } from '@/hooks/web/useI18n';
+import { getJobFairList } from '@/api/recruit/enterprise/jobFair'
 
 const { t } = useI18n()
 const props = defineProps({
@@ -60,6 +76,17 @@ let query = reactive({})
 
 const items = ref({
   options: [
+    {
+      slotName: 'bizId',
+      type: 'autocomplete',
+      key: 'bizId',
+      value: null,
+      label: '招聘会',
+      itemText: 'title',
+      itemValue: 'id',
+      disabled: true,
+      items: [],
+    },
     {
       slotName: 'positionId',
       key: 'positionId',
@@ -121,6 +148,8 @@ watch(
       }
       if (e.noParam) return
       if (e.key === 'expireTime' && !val[e.key]) return handleSoFarChange(true, e)
+      if (e.key === 'bizId' && val.source === '2') jobFairCheckboxChange(true, e) // 招聘会回显
+      if (e.key === 'bizId' && val.source === '0') val[e.key] = null // 招聘会回显
       e.value = val[e.key]
     })
   },
@@ -176,6 +205,24 @@ const handleSoFarChange = (bool, item) => {
   item.label = bool ? '到期时间' : '到期时间 *'
 }
 
+// 设置为招聘会职位
+const jobFairCheckbox = ref(false)
+const jobFairCheckboxChange = (bool, item) => {
+  jobFairCheckbox.value = bool
+  item.value = null
+  item.disabled = bool ? false : true
+  item.label = bool ? '招聘会 *' : '招聘会'
+}
+
+
+const getJobFairData = async () => {
+  const data = await getJobFairList()
+  const bizId = items.value.options.find(e => e.key === 'bizId')
+  if (!bizId) return
+  bizId.items = data
+}
+getJobFairData()
+
 const getQuery = async () => {
   const { valid } = await formPageRef.value.formRef.validate()
   if (!valid) return
@@ -188,10 +235,17 @@ const getQuery = async () => {
     if (e.noParam || e.value === null) return
     else obj[e.key] = e.value
   })
+  
+  if (jobFairCheckbox.value && !obj.bizId) {
+    Snackbar.warning('请选择招聘会')
+    return 'failed'
+  }
+
   if (!obj.content) {
     Snackbar.warning('请填写岗位职责')
     return 'failed'
   }
+
   if (!obj.requirement) {
     Snackbar.warning('请填写岗位要求')
     return 'failed'
@@ -202,9 +256,12 @@ const getQuery = async () => {
     return 'failed'
   }
   
-  // query = Object.assign(query, obj)
-  // query = {...obj, ...query}
+  obj.source = jobFairCheckbox.value ? '2' : '0' // 职位来源(0职位管理|1众聘职位|2招聘会)
+  if (obj.source === '0')  obj.bizId = null
+
   Object.assign(query, obj)
+  // console.log('obj:', obj)
+  console.log('query:', query)
   return query
 }