Ver código fonte

职位管理:待发布职位可使用额度发布或删除该职位

Xiao_123 1 mês atrás
pai
commit
7ce50c8864

+ 16 - 0
src/api/enterprise.js

@@ -236,4 +236,20 @@ export const getEnterprisePackageList = async () => {
     url: '/app-api/menduner/system/enterprise-package/list',
     openEncryption: true
   })
+}
+
+// 使用可发布职位数将职位更新成招聘中状态
+export const updatePositionStatus = async (ids) => {
+  return await request.post({
+    url: `/app-api/menduner/system/recruit/job-advertised/publish/job/enable?ids=${ids}`,
+    openEncryption: true
+  })
+}
+
+// 删除待支付职位
+export const deletePosition = async (ids) => {
+  return await request.post({
+    url: `/app-api/menduner/system/recruit/job-advertised/del?ids=${ids}`,
+    openEncryption: true
+  })
 }

+ 18 - 90
src/views/recruit/enterprise/positionManagement/components/baseInfo.vue

@@ -1,25 +1,6 @@
 <template>
   <div>
     <CtForm ref="formPageRef" :items="items" style="width: 650px;">
-      <!-- <template #bizId="{ item }">
-        <div style="position: relative;">
-          <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 class="bizTips">
-            <div>* 该职位如需加入到招聘会中,请勾选上方选项并选择要加入的【招聘会】</div>
-            <div>* 未选择【招聘会】将会作为普通职位发布收费!</div>
-          </div>
-        </div>
-      </template> -->
       <template #positionId="{ item }">
         <v-menu :close-delay="1" :open-delay="0" v-bind="$attrs">
           <template v-slot:activator="{  props }">
@@ -63,7 +44,6 @@ import { getRecruitPositionDetails } from '@/api/recruit/enterprise/position'
 import Confirm from '@/plugins/confirm'
 import Snackbar from '@/plugins/snackbar'
 import { useI18n } from '@/hooks/web/useI18n';
-// import { getJobFairWhiteList } from '@/api/recruit/enterprise/jobFair'
 import { getJobAdvertised } from '@/api/enterprise'
 
 const { t } = useI18n()
@@ -83,20 +63,26 @@ const showTemplateBtn = ref(true)
 const formPageRef = ref()
 let query = reactive({})
 
+// 效验职位名称是否重复
+const handleValidName = async (item, val) => {
+  if (!val) return
+  try {
+    const data = await getJobAdvertised({ jobName: val })
+
+    if (data && data.length > 0) {
+      Confirm(
+        t('common.confirmTitle'), 
+        '该职位名称已在您的招聘职位列表中存在,是否继续发布?', 
+        { sureText: '查看已有职位', cancelText: '继续发布' }
+      ).then(() => {
+        // 弹窗查看已有职位
+      })
+    }
+  } catch {}
+}
+
 const items = ref({
   options: [
-    // {
-    //   slotName: 'bizId',
-    //   appendClass: 'pb-8',
-    //   type: 'autocomplete',
-    //   key: 'bizId',
-    //   value: null,
-    //   label: '招聘会',
-    //   itemText: 'title',
-    //   itemValue: 'id',
-    //   disabled: true,
-    //   items: [],
-    // },
     {
       slotName: 'positionId',
       key: 'positionId',
@@ -145,56 +131,6 @@ const items = ref({
   ]
 })
 
-// 获取企业已加入的招聘会列表
-// const jobFairLoaded = ref(false)
-// const jobFairWhiteList = ref([])
-// const getJobFairData = async () => {
-//   const data = await getJobFairWhiteList()
-//   jobFairWhiteList.value = data?.length ? data : []
-//   jobFairLoaded.value = true
-//   // 没有加入任何招聘会则不展示招聘会
-//   if (!jobFairWhiteList.value?.length) items.value.options = items.value.options.filter(e => e.key !== 'bizId')
-// }
-// getJobFairData()
-
-// const jobFairValid = async () => {
-//   if (props.isFair) {
-//     // 招聘会内编辑职位,不需要展示选择招聘会
-//     items.value.options = items.value.options.filter(e => e.key !== 'bizId')
-//     return
-//   }
-//   // 加载招聘会白名单列表
-//   if (!jobFairLoaded.value) await getJobFairData()
-//   const bizIdObj = items.value.options.find(e => e.key === 'bizId') // 招聘会下拉框
-//   if (!bizIdObj) return
-//   bizIdObj.items = jobFairWhiteList.value // 下拉框内容赋值
-//   if (bizIdObj.value) {
-//     const index = jobFairWhiteList.value.findIndex(e => e.id === props.itemData.bizId)
-//     if (index === -1) bizIdObj.value = null // 招聘会已经关闭 或者已被移除招聘会白名单
-//     jobFairCheckboxChange(Boolean(bizIdObj.value), bizIdObj) // 招聘会回显
-//   }
-// }
-// jobFairValid()
-
-// 设置为招聘会职位
-// 现有逻辑:设置为招聘会职位后,职位管理编辑再修改为去掉选中招聘会不会改变数据的jobFairIds字段(用于职位列表判断是否展示招聘会标识),只有去招聘会移除才会改变jobFairIds字段。
-// const jobFairCheckbox = ref(false)
-// const jobFairCheckboxChange = (bool, item) => {
-//   item.value = bool ? (item?.value || null) : null
-//   jobFairCheckbox.value = bool
-//   item.disabled = bool ? false : true
-//   item.label = bool ? '招聘会 *' : '招聘会'
-// }
-
-// 长期有效
-const soFar = ref(false)
-const handleSoFarChange = (bool, item) => {
-  soFar.value = bool
-  item.value = null
-  item.disabled = bool ? true : false
-  item.label = bool ? '到期时间' : '到期时间 *'
-}
-
 // 编辑回显
 watch(
   () => props.itemData,
@@ -207,7 +143,6 @@ watch(
         return
       }
       if (e.noParam) return
-      // if (e.key === 'bizId' && val.source === '0') return // 非招聘会职位
       e.value = val[e.key]
     })
   },
@@ -268,11 +203,6 @@ const getQuery = async () => {
     else obj[e.key] = e.value
   })
   
-  // if (jobFairCheckbox.value && !obj.bizId && jobFairWhiteList.value?.length) {
-  //   Snackbar.warning('请选择招聘会')
-  //   return 'failed'
-  // }
-
   if (!obj.content) {
     Snackbar.warning('请填写岗位职责')
     return 'failed'
@@ -288,9 +218,7 @@ const getQuery = async () => {
     return 'failed'
   }
   
-  // obj.source = jobFairCheckbox.value ? '2' : '0' // 职位来源(0职位管理|1众聘职位|2招聘会)
   obj.source = props.isFair ? '2' : '0' // 职位来源(0职位管理|1众聘职位|2招聘会)
-  // if (obj.source === '0')  obj.bizId = null
 
   Object.assign(query, obj)
   return query

+ 38 - 9
src/views/recruit/enterprise/positionManagement/components/item.vue

@@ -63,8 +63,11 @@
               <span class="lines"></span>
               <span class="cursor-pointer actions" @click="handleAction(0, '', val)">{{ $t('common.close') }}</span>
             </div>
-            <!-- <div v-if="tab === 3" class="cursor-pointer actions" @click="handleUpdateExpireTime(val)">修改到期时间</div> -->
-            <span v-if="(val.status-0) === 99 && tab === 0" class="cursor-pointer color-primary" @click="toPay(val)">发布</span>
+            <span v-if="jobNum && +jobNum > 0 && (val.status-0) === 99 && tab === 0">
+              <span class="cursor-pointer color-primary" @click="handleRelease(val)">使用额度发布</span>
+              <span class="lines"></span>
+            </span>
+            <span v-if="(val.status-0) === 99 && tab === 0" class="cursor-pointer color-primary" @click="toPay(val)">支付发布</span>
             <span class="lines" v-if="tab !== 2 && tab !== 3"></span>
             <span v-if="tab === 2" class="cursor-pointer actions" @click="handleAction(1, '', val, val)">激活</span>
             <span class="lines" v-if="tab === 2"></span>
@@ -74,6 +77,10 @@
               <span class="cursor-pointer" :class="{'actions': val.edit}" :style="{'color': val.edit ? '#333' : '#999'}" @click="handleEdit(val)">{{ $t('common.edit') }}</span>
               <v-tooltip v-if="!val.edit" activator="parent" location="top">职位发布时间超过24小时的不支持编辑</v-tooltip>
             </div>
+            <span v-if="(val.status-0) === 99 && tab === 0">
+              <span class="lines"></span>
+              <span class="cursor-pointer actions color-error" @click="handleDelete(val)">删除</span>  
+            </span>
           </div>
         </div>
       </div>
@@ -113,6 +120,7 @@ import Confirm from '@/plugins/confirm'
 import { getUnpaidOrder } from '@/api/common'
 import { formatName } from '@/utils/getText'
 import { getUserAvatar } from '@/utils/avatar'
+import { updatePositionStatus, deletePosition } from '@/api/enterprise'
 
 const store = useUserStore()
 const { t } = useI18n()
@@ -122,7 +130,8 @@ const props = defineProps({
     type: Number,
     default: 1
   },
-  items: Array
+  items: Array,
+  jobNum: Number
 })
 
 // const showExpire = ref(false)
@@ -192,6 +201,26 @@ store.$subscribe((mutation, state) => {
   if (Object.keys(state.entBaseInfo).length) baseInfo.value = state.entBaseInfo
 })
 
+// 使用额度发布职位
+const handleRelease = async (val) => {
+  if (!val.id) return
+  try {
+    await updatePositionStatus(val.id)
+    Snackbar.success('发布成功')
+    emit('refresh', 1)
+  } catch {}
+}
+
+// 删除待支付职位
+const handleDelete = async (val) => {
+  if (!val.id) return
+  try {
+    await deletePosition(val.id)
+    Snackbar.success('删除成功')
+    emit('refresh', 1)
+  } catch {}
+}
+
 const showConfirmPaymentDialog = ref(false)
 const spuId = ref('')
 const spuName = ref('')
@@ -199,12 +228,12 @@ const operateObj = ref({})
 // 支付
 const toPay = async (val) => {
   // 待发布且有额度的激活职位即可
-  if (baseInfo.value.entitlement?.publishJobCount > 0) {
-    await enableJobAdvertised([val.id])
-    Snackbar.success('发布成功')
-    emit('refresh', 1)
-    return
-  }
+  // if (baseInfo.value.entitlement?.publishJobCount > 0) {
+  //   await enableJobAdvertised([val.id])
+  //   Snackbar.success('发布成功')
+  //   emit('refresh', 1)
+  //   return
+  // }
 
   operateObj.value = val
   spuId.value = val.id || ''

+ 10 - 3
src/views/recruit/enterprise/positionManagement/index.vue

@@ -27,7 +27,13 @@
         </v-tabs>
         <v-window v-model="tab" class="mt-1">
           <v-window-item v-for="val in tabList" :key="val.value" :value="val.value">
-            <PositionItem v-if="items.length" :tab="val.value" :items="items" @refresh="handleRefresh"></PositionItem>
+            <PositionItem
+            v-if="items.length"
+            :tab="val.value"
+            :items="items"
+            :jobNum="baseInfo?.entitlement?.publishJobCount"
+            @refresh="handleRefresh"
+            />
           </v-window-item>
         </v-window>
         <Empty v-if="!items.length" :message="loading ? '加载中...' : tipsText" :elevation="false"></Empty>
@@ -67,7 +73,8 @@
           <div v-for="val in positionItems" :key="val.id" class="itemBox mb-3">
             <div>
               <div class="position" style="padding: 10px 20px;">
-                <div class="d-flex align-center justify-space-between">
+                <div class="d-flex align-center">
+                  <svg-icon v-if="val.jobFairIds?.length" class="mr-1" name="jobFair" size="20"></svg-icon>
                   <span class="position-name" v-ellipse-tooltip>{{ formatName(val.name) }}</span>
                 </div>
                 <div :class="['mt-1', 'other-info', 'ellipsis']">
@@ -94,7 +101,7 @@
                   </v-avatar>
                   <div class="ml-3" v-ellipse-tooltip style="max-width: calc(100% - 34px);">{{ val.hrName }}</div>
                 </div>
-                <v-btn size="small" color="primary" @click="handleTo(val)">克隆加入</v-btn>
+                <v-btn size="small" color="primary" @click="handleTo(val)">克隆发布</v-btn>
               </div>
             </div>
           </div>