huoyi дней назад: 5
Родитель
Сommit
09c6d89b38
2 измененных файлов с 35 добавлено и 4 удалено
  1. 26 4
      src/pages/employeeProfile/index.vue
  2. 9 0
      src/pages/organizationStruct/index.vue

+ 26 - 4
src/pages/employeeProfile/index.vue

@@ -33,11 +33,11 @@
33
             </view>
33
             </view>
34
 
34
 
35
             <view class="search-selector">
35
             <view class="search-selector">
36
-                <view class="search-select-trigger" :class="{ 'search-select-trigger-disabled': isSecurityCheck }"
37
-                    @click="!isSecurityCheck && (showEmployeePicker = true)">
36
+                <view class="search-select-trigger" :class="{ 'search-select-trigger-disabled': isSecurityCheck || routeUserId }"
37
+                    @click="!isSecurityCheck && !routeUserId && (showEmployeePicker = true)">
38
                     <u-icon name="list" color="#A78BFA" size="16"></u-icon>
38
                     <u-icon name="list" color="#A78BFA" size="16"></u-icon>
39
                     <text class="search-name-text">{{ selectedEmployeeName || '请选择员工' }}</text>
39
                     <text class="search-name-text">{{ selectedEmployeeName || '请选择员工' }}</text>
40
-                    <u-icon v-if="!isSecurityCheck" name="arrow-down" color="#A78BFA" size="14"></u-icon>
40
+                    <u-icon v-if="!isSecurityCheck && !routeUserId" name="arrow-down" color="#A78BFA" size="14"></u-icon>
41
                 </view>
41
                 </view>
42
             </view>
42
             </view>
43
 
43
 
@@ -379,6 +379,9 @@ export default {
379
             expandedDeptIds: [],
379
             expandedDeptIds: [],
380
             isSecurityCheck: false,
380
             isSecurityCheck: false,
381
             userInfo: null,
381
             userInfo: null,
382
+            // 路由跳转参数
383
+            routeUserId: null,
384
+            routeUserName: '',
382
             // 雷达图tooltip相关
385
             // 雷达图tooltip相关
383
             activeDimName: null,
386
             activeDimName: null,
384
             radarTooltipPosition: { x: 0, y: 0 },
387
             radarTooltipPosition: { x: 0, y: 0 },
@@ -463,6 +466,13 @@ export default {
463
             return s.toFixed(2)
466
             return s.toFixed(2)
464
         }
467
         }
465
     },
468
     },
469
+    // uni-app 页面生命周期:接收路由参数
470
+    onLoad(options) {
471
+        if (options.userId) {
472
+            this.routeUserId = options.userId
473
+            this.routeUserName = decodeURIComponent(options.userName || '')
474
+        }
475
+    },
466
     mounted() {
476
     mounted() {
467
         this.updateTime()
477
         this.updateTime()
468
         this.timer = setInterval(() => {
478
         this.timer = setInterval(() => {
@@ -470,7 +480,19 @@ export default {
470
         }, 1000)
480
         }, 1000)
471
         // 默认计算时间范围(近一年)
481
         // 默认计算时间范围(近一年)
472
         this.onTimeTagClick(this.selectedTimeTag)
482
         this.onTimeTagClick(this.selectedTimeTag)
473
-        this.fetchEmployeeList()
483
+
484
+        if (this.routeUserId) {
485
+            // 来自组织架构跳转,直接加载指定人员
486
+            this.selectedEmployeeId = this.routeUserId
487
+            this.selectedEmployeeName = this.routeUserName
488
+            this.searchKeyword = this.routeUserName
489
+            this.employeeLoading = false
490
+            this.$nextTick(() => {
491
+                this.fetchEmployeePortrait()
492
+            })
493
+        } else {
494
+            this.fetchEmployeeList()
495
+        }
474
     },
496
     },
475
     beforeDestroy() {
497
     beforeDestroy() {
476
         if (this.timer) {
498
         if (this.timer) {

+ 9 - 0
src/pages/organizationStruct/index.vue

@@ -82,6 +82,7 @@
82
                     v-for="item in displayUsers" 
82
                     v-for="item in displayUsers" 
83
                     :key="item.userId"
83
                     :key="item.userId"
84
                     class="user-item"
84
                     class="user-item"
85
+                    @click="navigateToEmployee(item)"
85
                 >
86
                 >
86
                     <view class="user-avatar">
87
                     <view class="user-avatar">
87
                         <image v-if="item.avatar" :src="item.avatar" mode="aspectFill" class="avatar-img" />
88
                         <image v-if="item.avatar" :src="item.avatar" mode="aspectFill" class="avatar-img" />
@@ -247,6 +248,9 @@ export default {
247
                 if (targetNode) {
248
                 if (targetNode) {
248
                     this.navigateToNodeFromRoot(targetNode)
249
                     this.navigateToNodeFromRoot(targetNode)
249
                 }
250
                 }
251
+            } else {
252
+                // 搜索结果是人员,跳转到员工画像
253
+                this.navigateToEmployee(item)
250
             }
254
             }
251
         },
255
         },
252
         navigateToNodeFromRoot(targetNode) {
256
         navigateToNodeFromRoot(targetNode) {
@@ -277,6 +281,11 @@ export default {
277
         clearSearch() {
281
         clearSearch() {
278
             this.searchKeyword = ''
282
             this.searchKeyword = ''
279
             this.searchResults = []
283
             this.searchResults = []
284
+        },
285
+        navigateToEmployee(item) {
286
+            const userId = item.userId
287
+            const userName = encodeURIComponent(item.label || item.nickName || item.userName || '')
288
+            this.$tab.navigateTo(`/pages/employeeProfile/index?userId=${userId}&userName=${userName}`)
280
         }
289
         }
281
     }
290
     }
282
 }
291
 }