lifanagju_citu 8 месяцев назад
Родитель
Сommit
e2d45c6f75

+ 4 - 0
src/api/menduner/common/useDictionaries.ts

@@ -6,4 +6,8 @@ export const dictApi = {
   getAreaListData: async (params: any) => {
     return await request.get({ url: `/menduner/system/area/list`, params })
   },
+  // 获取地区列表
+  getPositionData: async (params: any) => {
+    return await request.get({ url: `/menduner/system/position/list`, params })
+  },
 }

+ 5 - 0
src/api/menduner/system/analysis/statisticAnalysis.ts

@@ -12,6 +12,11 @@ export const statisticAnalysisApi = {
     return await request.get({ url: `/menduner/system/analysis/get/job/browse/num/page`, params })
   },
 
+  // 获取发布职位统计分析明细
+  getAnalysisJobNumPage: async (params: any) => {
+    return await request.get({ url: `/menduner/system/analysis/get/job/num/page`, params })
+  },
+
   // 获取新投递简历统计分析明细
   getAnalysisJobCvNewPage: async (params: any) => {
     return await request.get({ url: `/menduner/system/analysis/get/job/cv/new/page`, params })

+ 28 - 28
src/hooks/web/useDictionaries.js

@@ -12,34 +12,34 @@ const setDict = (type, val, cacheTime = 7200) => {
 }
 
 export const getDict = (type, params, apiType = 'dict') => {
-    if (!type) {
-      // console.error('type不存在', type, params, apiType)
-      return []
+  if (!type) {
+    // console.error('type不存在', type, params, apiType)
+    return []
+  }
+  return new Promise((resolve) => {
+    const item = localStorage.getItem(type)
+    const catchData = item ? JSON.parse(item) : null
+    if (catchData && catchData.expire && (Date.now() <= catchData.expire)) {
+      return resolve({ data: catchData.data })
     }
-    return new Promise((resolve) => {
-      const item = localStorage.getItem(type)
-      const catchData = item ? JSON.parse(item) : null
-      if (catchData && catchData.expire && (Date.now() <= catchData.expire)) {
-        return resolve({ data: catchData.data })
-      }
-      // 传参按照规范参数传
-      const query = params ? params : { type }
-      const apiFn = {
-        // dict: getDictData,
-        // positionTreeData: getPositionTreeData, // 职位tree
-        // areaTreeData: getAreaTreeData, // 区域tree
-        // industryTreeData: getIndustryTreeData, // 行业tree
-        // industryList: getIndustryListData,
-        // skillList: getSkillList,
-        areaList: dictApi.getAreaListData,
-        // areaMap: getAreaMapData,
-        // positionData: getPositionData
-      }
-      if (!apiFn[apiType]) return
-      
-      apiFn[apiType](query).then(data => {
-        setDict(type, data, Date.now())
-        resolve({ data })
-      })
+    // 传参按照规范参数传
+    const query = params ? params : { type }
+    const apiFn = {
+      // dict: getDictData,
+      // positionTreeData: getPositionTreeData, // 职位tree
+      // areaTreeData: getAreaTreeData, // 区域tree
+      // industryTreeData: getIndustryTreeData, // 行业tree
+      // industryList: getIndustryListData,
+      // skillList: getSkillList,
+      areaList: dictApi.getAreaListData,
+      // areaMap: getAreaMapData,
+      positionData: dictApi.getPositionData
+    }
+    if (!apiFn[apiType]) return
+    
+    apiFn[apiType](query).then(data => {
+      setDict(type, data, Date.now())
+      resolve({ data })
     })
+  })
 }

+ 6 - 6
src/utils/transform/getText.js

@@ -1,20 +1,23 @@
 import { getDict } from '@/hooks/web/useDictionaries'
 
+const query = {
+  areaList: { dictName: 'menduner_area_type', params: {}, itemText: 'name', itemValue: 'id' },
+  positionData: { dictName: 'positionData', params: {}, itemText: 'nameCn', itemValue: 'id' },
+}
+
 export const getText = (value, arr, itemText = 'label', itemValue = 'value') => { // 一维数组
   if (!arr?.length || !(value && value !== 0)) return
   const item = arr.find(formItem => formItem[itemValue] === value)
   if (!item) return
   return item[itemText]
 }
+
 export const getNameIdText = (value, arr) => {
   getText(value, arr, 'name', 'id')
 }
 
 export const getDictText = async (value, type) => {
   if (!type) return
-  const query = {
-    areaList: { dictName: 'menduner_area_type', params: {}, itemText: 'name', itemValue: 'id' },
-  }
   if (!query[type]) return
   const { data } = await getDict(query[type].dictName, query[type].params, type)
   const itemText = query[type].itemText || 'label'
@@ -24,9 +27,6 @@ export const getDictText = async (value, type) => {
 
 export const getDictOptions = async (type) => {
   if (!type) return
-  const query = {
-    areaList: { dictName: 'menduner_area_type', params: {}, itemText: 'name', itemValue: 'id' },
-  }
   if (!query[type]) return
   const { data } = await getDict(query[type].dictName, query[type].params, type)
   return data || []

+ 31 - 1
src/views/menduner/system/analysis/statisticAnalysis/index.vue

@@ -107,7 +107,7 @@
       </el-form>
     </ContentWrap>
     <div class="flex flex-col">
-      <!-- 数据对照 -->
+      <!-- 统计 -->
       <el-row :gutter="16" class="row">
         <el-col v-for="item in statisticList" :key="item.name" :md="4" :sm="12" :xs="24" :loading="loading">
           <ComparisonCard
@@ -118,6 +118,7 @@
           />
         </el-col>
       </el-row>
+      <!-- 图表 -->
       <el-row :gutter="16" class="row">
         <el-col :md="12">
           <SexDistribution :data="distribution.sexDistributionData" title="性别分布" />
@@ -209,6 +210,7 @@ const apiArr = reactive({
   pageViewsTotal: statisticAnalysisApi.getAnalysisJobBrowseNum, // 职位浏览量-总数据
   pageViews: statisticAnalysisApi.getAnalysisJobBrowseNumPage, // 职位浏览量-钻取
   resumeReceived: statisticAnalysisApi.getAnalysisJobCvNewPage, // 钻取
+  pushNum: statisticAnalysisApi.getAnalysisJobNumPage, // 钻取
   resumeViewed: statisticAnalysisApi.getAnalysisJobCvLookPage, // 钻取
   invitedInterviews: statisticAnalysisApi.getAnalysisInterviewWaitPage, // 钻取
   invitedCompleted: statisticAnalysisApi.getAnalysisInterviewCompletePage, // 钻取
@@ -221,6 +223,7 @@ const apiArr = reactive({
 
 // 统计
 const statisticList = [
+  { title: '发布职位数量', name: 'pushNum' },
   { title: '职位浏览量', name: 'pageViews' },
   { title: '收到的简历', name: 'resumeReceived' },
   { title: '已查看简历', name: 'resumeViewed' },
@@ -230,6 +233,7 @@ const statisticList = [
 // 统计
 const statistic = reactive({
   pageViews: 0,
+  pushNum: 0,
   resumeReceived: 0,
   resumeViewed: 0,
   invitedInterviews: 0,
@@ -336,6 +340,16 @@ const tableHeaders = {
     { name: '工作经验', prop: 'expName' },
     { name: '学历要求', prop: 'eduName' },
   ],
+  pushNum: [
+    { name: '职位名称', prop: 'name' },
+    { name: '职位类型', prop: 'positionName' },
+    { name: '薪酬', prop: 'salaryDisplay' },
+    { name: '工作地区', prop: 'areaName' },
+    { name: '工作经验', prop: 'expName' },
+    { name: '学历要求', prop: 'eduName' },
+    // { name: '职位标签', prop: 'tagList' },
+    { name: '众聘', prop: 'hire' },
+  ],
   resumeReceived: [
     { name: '投递人', prop: 'personName' },
     { name: '求职状态', prop: 'jobStatus' },
@@ -379,6 +393,22 @@ const dealTableData = async () => {
       return item
     })
   }
+  if (currentItem.value.name === 'pushNum') {
+    const areaList = await getDictOptions('areaList')
+    const positionData = await getDictOptions('positionData')
+    tableData.value = tableData.value.map(item => {
+      item.areaName = getText(item.areaId, areaList)
+      item.positionName = getText(item.positionId, positionData, 'nameCn', 'id')
+      console.log(item.positionId)
+      console.log(positionData)
+      item.salaryDisplay = `${item.payFrom}-${item.payTo}/${getDictLabel(DICT_TYPE.MENDUNER_PAY_UNIT, item.payUnit)}`
+      item.jobStatus = getDictLabel(DICT_TYPE.MENDUNER_JOB_STATUS, item.jobStatus)
+      item.expName = getDictLabel(DICT_TYPE.MENDUNER_EXP_TYPE, item.expType)
+      item.eduName = getDictLabel(DICT_TYPE.MENDUNER_EDUCATION_TYPE, item.eduType)
+      item.hire = item.hire ? '是' : '否'
+      return item
+    })
+  }
   if (currentItem.value.name === 'resumeReceived') {
     const areaList = await getDictOptions('areaList')
     tableData.value = tableData.value.map(item => {