Bläddra i källkod

企业可发布职位数量

Xiao_123 7 månader sedan
förälder
incheckning
a6544dda31

+ 1 - 1
src/layout/company/side.vue

@@ -87,7 +87,7 @@ const getList = (arr, obj = []) => {
 
 <style scoped lang="scss">
 .side-box {
-  width: 250px;
+  width: 230px;
   height: 100%;
 }
 </style>

+ 1 - 1
src/layout/enterprise.vue

@@ -3,7 +3,7 @@
     <Headers class="headers"></Headers>
     <div class="content d-flex">
       <side class="content-sticky" v-if="!router.currentRoute.value?.meta?.hideSide"></side>
-      <div class="content-box d-flex flex-column" :style="`width: ${ !isInWhiteList(route.path, whiteList) ? 'calc(100vw - 250px)' : '100%'}`">
+      <div class="content-box d-flex flex-column" :style="`width: ${ !isInWhiteList(route.path, whiteList) ? 'calc(100vw - 230px)' : '100%'}`">
         <div v-if="!isInWhiteList(route.path, whiteList)" class="breadcrumbs_sticky">
           <div class=" d-flex align-center justify-space-between">
             <v-breadcrumbs :items="breadcrumbs" elevation="3">

+ 36 - 36
src/router/modules/components/recruit/enterprise.js

@@ -129,42 +129,42 @@ const enterprise = [
       },
     ]
   },
-  {
-    path: '/recruit/enterprise/hirePosition',
-    component: Layout,
-    name: 'crowdSourcing',
-    meta: {
-      title: '全员猎聘',
-      enName: 'Crowd Sourcing',
-      icon: 'mdi-account-star-outline'
-    },
-    children: [
-      {
-        path: '/recruit/enterprise/hirePosition',
-        show: true,
-        meta: {
-          title: '全员猎聘'
-        },
-        component: () => import('@/views/recruit/enterprise/hirePosition/index.vue')
-      },
-      {
-        path: '/recruit/enterprise/hirePosition/add',
-        show: true,
-        meta: {
-          title: '新增职位'
-        },
-        component: () => import('@/views/recruit/enterprise/hirePosition/components/add.vue')
-      },
-      {
-        path: '/recruit/enterprise/hirePosition/edit',
-        show: true,
-        meta: {
-          title: '职位编辑'
-        },
-        component: () => import('@/views/recruit/enterprise/hirePosition/components/add.vue')
-      }
-    ]
-  },
+  // {
+  //   path: '/recruit/enterprise/hirePosition',
+  //   component: Layout,
+  //   name: 'crowdSourcing',
+  //   meta: {
+  //     title: '全员猎聘',
+  //     enName: 'Crowd Sourcing',
+  //     icon: 'mdi-account-star-outline'
+  //   },
+  //   children: [
+  //     {
+  //       path: '/recruit/enterprise/hirePosition',
+  //       show: true,
+  //       meta: {
+  //         title: '全员猎聘'
+  //       },
+  //       component: () => import('@/views/recruit/enterprise/hirePosition/index.vue')
+  //     },
+  //     {
+  //       path: '/recruit/enterprise/hirePosition/add',
+  //       show: true,
+  //       meta: {
+  //         title: '新增职位'
+  //       },
+  //       component: () => import('@/views/recruit/enterprise/hirePosition/components/add.vue')
+  //     },
+  //     {
+  //       path: '/recruit/enterprise/hirePosition/edit',
+  //       show: true,
+  //       meta: {
+  //         title: '职位编辑'
+  //       },
+  //       component: () => import('@/views/recruit/enterprise/hirePosition/components/add.vue')
+  //     }
+  //   ]
+  // },
   {
     path: '/recruit/enterprise/talentMap',
     component: Layout,

+ 16 - 6
src/views/recruit/enterprise/positionManagement/components/item.vue

@@ -8,7 +8,7 @@
         <v-btn class="mr-3" :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(4, 'top', {})">取消置顶</v-btn>
         <v-btn :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(0, 'close', {})">{{ $t('common.close') }}</v-btn>
       </div>
-      <v-btn v-if="tab === 2" class="ml-8" :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(1, 'activation', {})">{{ $t('common.activation') }}</v-btn>
+      <v-btn v-if="tab === 2" class="ml-8" :disabled="!selectAll" color="primary" variant="tonal" size="small" @click="handleAction(1, 'activation', {})">一键激活</v-btn>
     </div>
     <div v-for="val in items" :key="val.id" class="itemBox mb-3" style="height: 134px;">
       <div v-if="val.top && tab === 1" style="position: absolute;">
@@ -36,14 +36,14 @@
             <span>{{ val.positionName }}</span>
           </div>
         </div>
-        <div class="d-flex align-center">
-          <!-- <v-btn v-if="tab === 1" class="ml-3" color="primary" @click="handleAction(2, '', val)">
+        <!-- <div class="d-flex align-center">
+          <v-btn v-if="tab === 1" class="ml-3" color="primary" @click="handleAction(2, '', val)">
             <span>{{ $t('common.refresh') + $t('common.position') }}</span>
             <v-icon class="ml-2">mdi-help-circle-outline</v-icon>
             <v-tooltip activator="parent" location="top">刷新职位后,发布时间为最新的</v-tooltip>
-          </v-btn> -->
+          </v-btn>
           <v-btn v-if="tab === 2" color="primary" @click="handleAction(1, '', val)">{{ $t('common.activatePosition') }}</v-btn>
-        </div>
+        </div> -->
       </div>
       <div class="bottom pa-5 d-flex justify-space-between align-center">
         <div>
@@ -85,7 +85,9 @@ import { useI18n } from '@/hooks/web/useI18n'
 import { getEnterprisePubJobTypePermission } from '@/api/recruit/enterprise/position'
 import { closeJobAdvertised, enableJobAdvertised, refreshJobAdvertised, topJobAdvertised, updatePositionExpireTime, topJobAdvertisedCancel } from '@/api/position'
 import Snackbar from '@/plugins/snackbar'
+import { useUserStore } from '@/store/user'
 
+const store = useUserStore()
 const { t } = useI18n()
 const emit = defineEmits(['refresh'])
 const props = defineProps({
@@ -157,10 +159,18 @@ watch(
   { deep: true }
 )
 
+let baseInfo = ref(JSON.parse(localStorage.getItem('entBaseInfo')) || {})
+store.$subscribe((mutation, state) => {
+  if (Object.keys(state.entBaseInfo).length) baseInfo.value = state.entBaseInfo
+})
 const apiList = [closeJobAdvertised, enableJobAdvertised, refreshJobAdvertised, topJobAdvertised, topJobAdvertisedCancel]
-
 // 职位关闭、激活、刷新、置顶
 const handleAction = async (index, type, { id }) => {
+  // 激活职位时查询是否有可发布职位数
+  if (index === 1) {
+    await store.getEnterpriseInfo()
+    if (baseInfo.value?.entitlement.publishJobCount <= 0) return Snackbar.warning('可发布职位数不足,请联系平台管理员')
+  }
   const ids = type ? props.items.filter(e => e.select).map(k => k.id) : [id]
   if (!ids.length && !index) return
   loading.value = true

+ 25 - 14
src/views/recruit/enterprise/positionManagement/index.vue

@@ -4,16 +4,23 @@
       <div class="d-flex justify-center mt-3">
         <TextUI :item="textItem" @enter="handleEnter" @appendInnerClick="handleEnter"></TextUI>
       </div>
-      <div class="text-end">
-        <v-btn prepend-icon="mdi-plus" color="primary" @click="handleAdd">{{ $t('position.newPositionsAdded') }}</v-btn>
-        <span>
-          <v-btn :loading="uploadLoading" prepend-icon="mdi-download-box-outline" color="primary" variant="tonal" class="ml-3" @click="handleUploadBefore">
-            批量上传职位
-          </v-btn>
-          <File ref="uploadFile" :custom="true" customName="multipartFile" accept=".xlsx, .xls" @success="handleUploadPosition"></File>
-        </span>
-        <v-btn :loading="templateLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleDownloadTemplate">批量上传模版下载</v-btn>
-        <v-btn :loading="exportLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleExport">职位列表下载</v-btn>
+      <div style="height: 40px">
+        <div class="float-left color-666 font-size-14" style="line-height: 52px;">
+          <span>共可发布职位数 <strong class="color-primary">50</strong> 个 </span>|
+          <span> 已发布 <strong class="color-primary">{{ baseInfo?.entitlement?.publishJobCount ? (50 - baseInfo?.entitlement?.publishJobCount) : 0 }}</strong> 个 </span>|
+          <span> 剩余 <strong class="color-primary">{{ baseInfo?.entitlement?.publishJobCount || 0 }}</strong> 个</span>
+        </div>
+        <div class="float-right">
+          <v-btn prepend-icon="mdi-plus" color="primary" @click="handleAdd">新增</v-btn>
+          <span>
+            <v-btn :loading="uploadLoading" prepend-icon="mdi-download-box-outline" color="primary" variant="tonal" class="ml-3" @click="handleUploadBefore">
+              职位批量导入
+            </v-btn>
+            <File ref="uploadFile" :custom="true" customName="multipartFile" accept=".xlsx, .xls" @success="handleUploadPosition"></File>
+          </span>
+          <v-btn :loading="templateLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleDownloadTemplate">批量导入模版下载</v-btn>
+          <v-btn :loading="exportLoading" prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleExport">职位导出</v-btn>
+        </div>
       </div>
       
       <div class="mt-3">
@@ -69,14 +76,16 @@ const templateLoading = ref(false)
 const uploadLoading = ref(false)
 const exportLoading = ref(false)
 const uploadFile = ref()
-
 const tab = ref(1)
-
 const tabList = [
   { label: t('position.recruitmentInProgress'), value: 1 },
   { label: t('position.closed'), value: 2 },
   { label: t('position.expiredPosition'), value: 3 }
 ]
+let baseInfo = ref(JSON.parse(localStorage.getItem('entBaseInfo')) || {})
+store.$subscribe((mutation, state) => {
+  if (Object.keys(state.entBaseInfo).length) baseInfo.value = state.entBaseInfo
+})
 
 const items = ref([])
 const textItem = ref({
@@ -91,6 +100,9 @@ const textItem = ref({
 const handleAdd = async () => {
   const data = await getEnterprisePubJobTypePermission()
   if (!data || !data.length) return Snackbar.warning('没有该操作权限,请联系平台管理员升级后再试')
+  // 新增职位时查询是否有可发布职位数
+  await store.getEnterpriseInfo()
+  if (baseInfo.value?.entitlement.publishJobCount <= 0) return Snackbar.warning('可发布职位数不足,请联系平台管理员')
   router.push('/recruit/enterprise/position/add')
   await store.getEnterpriseUserAccountInfo()
 }
@@ -98,6 +110,7 @@ const handleAdd = async () => {
 const loading = ref(false)
 // 获取职位列表
 const getPositionList = async () => {
+  await store.getEnterpriseInfo()
   items.value = []; total.value = 0
   loading.value = true
   if (tab.value !== 3) {
@@ -147,9 +160,7 @@ const handleUploadBefore = () => {
     otherBtnText: '去下载模板',
     sureText: '继续上传',
   }
-  // debugger
   Confirm(t('common.confirmTitle'), '如还未下载过批量上传的模板,请先下载,并且使用模板格式上传职位', option).then((obj) => {
-    // debugger
     if (obj?.otherClick) {
       Snackbar.info('开始下载!')
       handleDownloadTemplate()