Переглянути джерело

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

Xiao_123 8 місяців тому
батько
коміт
3525240cde

+ 9 - 0
src/api/position.js

@@ -168,6 +168,15 @@ export const getJobAdvertisedList = async (params) => {
   })
 }
 
+// 招聘端-导出招聘职位 Excel
+export const getJobAdvertisedExport = async (params) => {
+  return await request.download({
+    url: '/app-api/menduner/system/recruit/job-advertised/export',
+    // responseType: 'blob',
+    params
+  })
+}
+
 // 招聘端-发布职位详情
 export const getJobDetails = async (params) => {
   return await request.get({

+ 3 - 5
src/layout/personal/navBar.vue

@@ -192,17 +192,15 @@ const changeLoginType = async () => {
   else getApplyInfo()
 }
 
-import Snackbar from '@/plugins/snackbar'
 // 切换为招聘者
 const toEnterprise = async (enterpriseId) => {
   await getUserBindEnterpriseList({ enterpriseId })
   // 获取企业账号令牌以及企业用户个人信息
   await userStore.changeRole(enterpriseId)
-  const check = await userStore.checkEnterpriseBaseInfo()
   // router.push({ path: '/recruit/enterprise' })
-  const href = check ? '/recruit/enterprise' : '/recruit/enterprise/informationManagement/informationSettings'
-  Snackbar.info('请完善企业信息设置!')
-  window.location.href = href
+
+  // 跳转企业路由 且验证是否已完善必填基本信息
+  window.location.href = '/enterpriseVerification'
 }
 
 // 查看用户是否有在申请中的数据

+ 1 - 0
src/locales/en.js

@@ -30,6 +30,7 @@ export default {
     refresh: 'Refresh',
     currentlyUnavailable: 'Currently unavailable',
     upload: 'Upload',
+    export: 'Export',
     home: 'Home',
     activation: 'Activation',
     activatePosition: 'Activate position',

+ 1 - 0
src/locales/zh-CN.js

@@ -30,6 +30,7 @@ export default {
     refresh: '刷新',
     currentlyUnavailable: '暂无',
     upload: '上传',
+    export: '导出',
     home: '首页',
     position: '职位',
     company: '公司',

+ 3 - 0
src/permission.js

@@ -3,16 +3,19 @@ import { useNProgress } from '@/hooks/web/useNProgress'
 import { useTitle } from '@/hooks/web/useTitle'
 import { getToken, getEnterpriseToken, removeToken } from '@/utils/auth'
 import { useDictStore } from '@/store/dict'
+import { useUserStore } from '@/store/user'
 
 const { start, done } = useNProgress()
 // loginType:1.enterprise: 企业路由
 //            2.personal: 个人路由
+//            3.common: 没有限制访问权限
 //            3.personalCommon: 无需登录也能访问的页面,但登录企业不能访问
 // 路由守卫
 router.beforeEach(async (to, from, next) => {
   start()
   // loadStart()
   if (getToken()) {
+    if (to.path === '/enterpriseVerification') useUserStore().checkEnterpriseBaseInfo() // 校验企业必填信息
     if (to.path === '/login') {
       if (getEnterpriseToken()) next({ path: '/enterprise' }) // 已登录企业
       else next({ path: '/recruitHome' }) // 已登录个人账号

+ 16 - 3
src/store/user.js

@@ -18,6 +18,7 @@ import Snackbar from '@/plugins/snackbar'
 import { timesTampChange } from '@/utils/date'
 import { updateEventList } from '@/utils/eventList'
 import { getBaseInfoDictOfName } from '@/utils/getText'
+import Confirm from '@/plugins/confirm'
 
 // import { useIMStore } from './im'
 
@@ -160,12 +161,24 @@ export const useUserStore = defineStore('user',
         localStorage.setItem('enterpriseUserAccount', JSON.stringify(data))
         return data // 方便直接获取
       },
+
       // 获取《企业基本信息》
       async checkEnterpriseBaseInfo () {
         const data = await getEnterpriseBaseInfo()
-        const keyArr = ['industryId', 'financingStatus', 'scale', 'introduce', 'logoUrl'] // 必填信息
-        const check = Object.keys(data).length && keyArr.every(e => data[e] && data[e] !== 0) // 校验必填人才信息
-        return check
+        // 检验必填信息
+        const keyArr = ['industryId', 'financingStatus', 'scale', 'introduce', 'logoUrl'] // 必填信息列表
+        let href = '/recruit/enterprise/informationManagement/informationSettings'
+        const valid = Object.keys(data).length && keyArr.every(e => {
+          const bool = data[e] && data[e] !== 0
+          if (!bool && e === 'logoUrl') href = '/recruit/enterprise/informationManagement/informationSettings?tabKey=2'
+          return bool
+        })
+        if (!valid) {
+          Confirm('系统提示', '企业信息设置未完善,是否前往完善?').then(() => {
+            window.location.href = href
+          })
+        }
+        // return valid
       },
 
       // 获取用户账户信息

+ 39 - 0
src/utils/download.js

@@ -0,0 +1,39 @@
+const download0 = (data, fileName, mineType) => {
+  if (!data || !fileName) return
+  // 创建 blob
+  const blob = new Blob([data], { type: mineType })
+  // 创建 href 超链接,点击进行下载
+  window.URL = window.URL || window.webkitURL
+  const href = URL.createObjectURL(blob)
+  const downA = document.createElement('a')
+  downA.href = href
+  downA.download = fileName
+  downA.click()
+  // 销毁超连接
+  window.URL.revokeObjectURL(href)
+}
+
+const download = {
+  // 下载 Excel 方法
+  excel: (data, fileName) => {
+    download0(data, fileName, 'application/vnd.ms-excel')
+  },
+  // 下载 Word 方法
+  word: (data, fileName) => {
+    download0(data, fileName, 'application/msword')
+  },
+  // 下载 Zip 方法
+  zip: (data, fileName) => {
+    download0(data, fileName, 'application/zip')
+  },
+  // 下载 Html 方法
+  html: (data, fileName) => {
+    download0(data, fileName, 'text/html')
+  },
+  // 下载 Markdown 方法
+  markdown: (data, fileName) => {
+    download0(data, fileName, 'text/markdown')
+  }
+}
+
+export default download

+ 3 - 1
src/views/recruit/enterprise/informationManagement/informationSettings.vue

@@ -46,8 +46,10 @@ const tabList = [
   { label: t('setting.realNameAuthentication'), value: 6, path: authentication },
 ]
 
+watch(() => route?.query?.tabKey, (newVal) => { // newQuery, oldQuery
+  if (newVal) tab.value = newVal - 0
+}, { deep: true, immediate: true })
 
-watch(() => route?.query?.tabKey, (newVal) => { if (newVal) tab.value = newVal - 0 })
 const handleTabClick = () => {
   // 基本信息-获取企业管理员实名认证信息
   if (tab.value === 1) {

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

@@ -6,6 +6,7 @@
       </div>
       <div class="text-end">
         <v-btn prepend-icon="mdi-plus" color="primary" @click="handleAdd">{{ $t('position.newPositionsAdded') }}</v-btn>
+        <v-btn prepend-icon="mdi-export-variant" color="primary" variant="tonal" class="ml-3" @click="handleExport">{{ $t('common.export') }}</v-btn>
       </div>
       
       <div class="mt-3">
@@ -37,10 +38,11 @@ import TextUI from '@/components/FormUI/TextInput'
 import PositionItem from './components/item.vue'
 import { useRoute } from 'vue-router'; const route = useRoute()
 import { useRouter } from 'vue-router'; const router = useRouter()
-import { getJobAdvertisedList } from '@/api/position'
+import { getJobAdvertisedList, getJobAdvertisedExport } from '@/api/position'
 import { dealDictArrayData } from '@/utils/position'
 import { useI18n } from '@/hooks/web/useI18n'
 import { useUserStore } from '@/store/user'
+import download from '@/utils/download'
 
 const store = useUserStore()
 
@@ -81,6 +83,13 @@ const handleAdd = async () => {
   await store.getEnterpriseUserAccountInfo()
 }
 
+const handleExport = async () => {
+  const data = await getJobAdvertisedExport(query.value)
+  const label = tabList.find(e => e.value === tab.value)?.label || ''
+  const txt = `职位列表${label? '(' + label + ')' : ''}`
+  download.excel(data, txt)
+}
+
 
 // 获取职位列表
 const getPositionList = async () => {