Browse Source

feat(employeeProfile): add qualification certificate time display

1. add getQualificationLevelTime api to fetch qualification time by user id
2. add logic to display corresponding certificate time based on qualification level
3. include new api call in page data loading flow
huoyi 6 days ago
parent
commit
d6be05a25e
2 changed files with 35 additions and 2 deletions
  1. 4 0
      src/api/ledger/index.js
  2. 31 2
      src/views/portraitManagement/employeeProfile/index.vue

+ 4 - 0
src/api/ledger/index.js

@@ -294,3 +294,7 @@ export function listQualificationCertificateStatus(query) {
294
 export function importQualificationLevel(data) {
294
 export function importQualificationLevel(data) {
295
   return request({ url: '/ledger/import/qualificationLevel', method: 'post', data })
295
   return request({ url: '/ledger/import/qualificationLevel', method: 'post', data })
296
 }
296
 }
297
+//通过用户id获取职业资格等级获取时间信息
298
+export function getQualificationLevelTime(query) {
299
+  return request({ url: '/ledger/qualificationLevel/user', method: 'get',params: query })
300
+}

+ 31 - 2
src/views/portraitManagement/employeeProfile/index.vue

@@ -131,7 +131,10 @@
131
               </div>
131
               </div>
132
             </Card>
132
             </Card>
133
             <Card title="职业资格证书情况">
133
             <Card title="职业资格证书情况">
134
-              证书名称:一级~五级;时间:年月日
134
+              <div class="cert-info">
135
+                <span class="cert-name">证书名称:{{ portrait?.qualificationLevelText || '-' }} 时间:{{ getQualificationTime|| '-' }}</span>
136
+              
137
+              </div>
135
             </Card>
138
             </Card>
136
           </div>
139
           </div>
137
           <div class="content-bottom-center">
140
           <div class="content-bottom-center">
@@ -238,6 +241,7 @@ import { getEmployeePortrait } from '@/api/score/index'
238
 import { countTagScore } from '@/api/portraitManagement/portraitManagement'
241
 import { countTagScore } from '@/api/portraitManagement/portraitManagement'
239
 import { onMounted, onUnmounted, reactive, ref, computed, watch } from 'vue'
242
 import { onMounted, onUnmounted, reactive, ref, computed, watch } from 'vue'
240
 import { useDict } from '@/utils/dict'
243
 import { useDict } from '@/utils/dict'
244
+import { getQualificationLevelTime } from '@/api/ledger/index'
241
 import { useECharts } from '@/hooks/useEcharts'
245
 import { useECharts } from '@/hooks/useEcharts'
242
 import useUserStore from '@/store/modules/user'
246
 import useUserStore from '@/store/modules/user'
243
 import { useRouter } from 'vue-router'
247
 import { useRouter } from 'vue-router'
@@ -256,6 +260,7 @@ const abilityChart = ref(null)
256
 const activeDimName = ref(null)
260
 const activeDimName = ref(null)
257
 const tagScoreData = ref(null)
261
 const tagScoreData = ref(null)
258
 const currentQuery = ref(null)
262
 const currentQuery = ref(null)
263
+const qualificationData = ref(null)
259
 
264
 
260
 const scoreDetails = computed(() => portrait.value?.scoreDetails || [])
265
 const scoreDetails = computed(() => portrait.value?.scoreDetails || [])
261
 
266
 
@@ -292,6 +297,25 @@ const deductTotal = computed(() => {
292
   return s.toFixed(2)
297
   return s.toFixed(2)
293
 })
298
 })
294
 
299
 
300
+// 职业资格等级枚举
301
+const qualificationLevelMap = [
302
+  { label: '一级', field: 'levelOneTime' },
303
+  { label: '二级', field: 'levelTwoTime' },
304
+  { label: '三级', field: 'levelThreeTime' },
305
+  { label: '四级', field: 'levelFourTime' },
306
+  { label: '五级', field: 'levelFiveTime' }
307
+]
308
+
309
+const getQualificationTime = computed(() => {
310
+  const certName = portrait.value?.qualificationLevelText || '-';
311
+  
312
+  const item = qualificationLevelMap.find(l => l.label === certName)
313
+  if (item) {
314
+    return qualificationData.value?.[item.field] || '-'
315
+  }
316
+  return '-'
317
+})
318
+
295
 
319
 
296
 const getSchooling = (schooling) => {
320
 const getSchooling = (schooling) => {
297
   const result = (sys_user_schooling.value || []).find(item => item.value === schooling) || { label: schooling }
321
   const result = (sys_user_schooling.value || []).find(item => item.value === schooling) || { label: schooling }
@@ -358,7 +382,12 @@ const invokerEmployeePortrait = (query) => {
358
       tagScoreData.value = data
382
       tagScoreData.value = data
359
     }
383
     }
360
   })
384
   })
361
-  return Promise.all([portraitPromise, tagPromise]).finally(() => {
385
+  const qualificationPromise = getQualificationLevelTime({ userId }).then(res => {
386
+    qualificationData.value = res.data || null
387
+  }).catch(() => {
388
+    qualificationData.value = null
389
+  })
390
+  return Promise.all([portraitPromise, tagPromise, qualificationPromise]).finally(() => {
362
     loading.value = false
391
     loading.value = false
363
   })
392
   })
364
 }
393
 }