Bläddra i källkod

feat(api): 添加通过用户ID获取职业资格等级时间接口

- 新增 getQualificationLevelTime 方法
- 使用 GET 请求获取职业资格等级时间信息
- 参数通过 query 传递
- 接口路径为 /ledger/qualificationLevel/user
huoyi 14 timmar sedan
förälder
incheckning
53cc65123f
2 ändrade filer med 62 tillägg och 1 borttagningar
  1. 7 0
      src/api/ledger/index.js
  2. 55 1
      src/pages/employeeProfile/index.vue

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

@@ -0,0 +1,7 @@
1
+import request from '@/utils/request'
2
+
3
+
4
+//通过用户id获取职业资格等级获取时间信息
5
+export function getQualificationLevelTime(query) {
6
+  return request({ url: '/ledger/qualificationLevel/user', method: 'get',params: query })
7
+}

+ 55 - 1
src/pages/employeeProfile/index.vue

@@ -146,6 +146,14 @@
146 146
                     </view>
147 147
                 </SectionTitle>
148 148
 
149
+                <SectionTitle v-if="activeTab === 'profile' && displayQualificationLevels.length > 0" title="职业资格证书获取时间">
150
+                    <view class="cert-info">
151
+                        <view class="cert-item" v-for="level in displayQualificationLevels" :key="level.field">
152
+                            <text class="cert-name">{{ level.label }}:{{ (qualificationData && qualificationData[level.field]) || '-' }}</text>
153
+                        </view>
154
+                    </view>
155
+                </SectionTitle>
156
+
149 157
                 <SectionTitle v-if="activeTab === 'profile'" title="个人能力">
150 158
                     <div class="chart-legend">
151 159
                         <div class="legend-item legend-warning"><span></span>预警线(低于75分)</div>
@@ -324,6 +332,7 @@
324 332
 <script>
325 333
 import * as echarts from 'echarts'
326 334
 import { getEmployeePortrait, countTagScore } from '@/api/portraitManagement/portraitManagement'
335
+import { getQualificationLevelTime } from '@/api/ledger/index'
327 336
 import { listAllUser, getDeptUserTree } from '@/api/system/user'
328 337
 import SectionTitle from '@/components/SectionTitle.vue'
329 338
 import EmployeeTreeNode from '@/pages/components/EmployeeTreeNode.vue'
@@ -363,6 +372,7 @@ export default {
363 372
             searchKeyword: '',
364 373
             portrait: { dimensions: [], awards: [] },
365 374
             tagScoreData: null,
375
+            qualificationData: null,
366 376
             scoreDetails: [],
367 377
             showWarning: false,
368 378
             radarChartInstance: null,
@@ -392,6 +402,22 @@ export default {
392 402
         }
393 403
     },
394 404
     computed: {
405
+        qualificationLevelMap() {
406
+            return [
407
+                { label: '五级', field: 'levelFiveTime' },
408
+                { label: '四级', field: 'levelFourTime' },
409
+                { label: '三级', field: 'levelThreeTime' },
410
+                { label: '二级', field: 'levelTwoTime' },
411
+                { label: '一级', field: 'levelOneTime' }
412
+            ]
413
+        },
414
+        displayQualificationLevels() {
415
+            const currentLevel = this.portrait?.qualificationLevelText
416
+            if (!currentLevel) return []
417
+            const currentIndex = this.qualificationLevelMap.findIndex(l => l.label === currentLevel)
418
+            if (currentIndex === -1) return []
419
+            return this.qualificationLevelMap.slice(currentIndex)
420
+        },
395 421
         schoolingText() {
396 422
             if (!this.portrait.schooling) return '-'
397 423
             return schoolingMap[this.portrait.schooling] || this.portrait.schooling
@@ -769,7 +795,13 @@ export default {
769 795
                 }
770 796
             }).catch(() => { })
771 797
 
772
-            Promise.all([portraitPromise, tagPromise]).finally(() => {
798
+            const qualificationPromise = getQualificationLevelTime({ userId: this.selectedEmployeeId }).then(res => {
799
+                this.qualificationData = res.data || null
800
+            }).catch(() => {
801
+                this.qualificationData = null
802
+            })
803
+
804
+            Promise.all([portraitPromise, tagPromise, qualificationPromise]).finally(() => {
773 805
                 this.$nextTick(() => {
774 806
 
775 807
                     this.initRadarChart()
@@ -1355,6 +1387,28 @@ export default {
1355 1387
     }
1356 1388
 }
1357 1389
 
1390
+.cert-info {
1391
+    display: flex;
1392
+    flex-direction: column;
1393
+    gap: 16rpx;
1394
+}
1395
+
1396
+.cert-item {
1397
+    display: flex;
1398
+    align-items: center;
1399
+    padding: 12rpx 0;
1400
+    border-bottom: 1rpx solid #f0f0f0;
1401
+
1402
+    &:last-child {
1403
+        border-bottom: none;
1404
+    }
1405
+}
1406
+
1407
+.cert-name {
1408
+    font-size: 28rpx;
1409
+    color: #333;
1410
+}
1411
+
1358 1412
 .chart-container {
1359 1413
     width: 100%;
1360 1414
     height: 500rpx;