From bb6f7aed51b8f475e0ee1100412d9448e281518b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Tue, 14 Apr 2026 13:36:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(approve):=20=E4=BF=AE=E5=A4=8D=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E6=B5=81=E7=A8=8B=E4=B8=AD=E7=9A=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?ID=E8=8E=B7=E5=8F=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化审批流程中用户ID的获取方式,确保在加载待办列表时使用正确的用户ID。同时添加调试日志和调整toast显示时长。 --- pages/hrm/approve/approve.vue | 36 +++++++++++++++------------ pages/profile/index/index.vue | 1 + pages/workbench/hrm/detail/detail.vue | 5 +++- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/pages/hrm/approve/approve.vue b/pages/hrm/approve/approve.vue index c47373e..89d0569 100644 --- a/pages/hrm/approve/approve.vue +++ b/pages/hrm/approve/approve.vue @@ -33,7 +33,7 @@ - + 暂无待审批任务 @@ -128,12 +128,15 @@ actionForm: { remark: '' }, - actionSubmitting: false + actionSubmitting: false, + currentOaUserId: '' } }, onShow() { - this.loadEmployees(); - this.loadTodoList(); + this.fetchUserProfile().then(() => { + this.loadEmployees(); + this.loadTodoList(); + }); }, methods: { // 格式化员工信息展示(不展示各类ID) @@ -149,6 +152,7 @@ const user = response?.data?.user || {}; const roles = user.roles?.map(item => item.roleKey) || []; this.$store.commit('oa/SET_STATE', user); + this.currentOaUserId = user.userId || ''; this.roleGroup = roles; return user; } catch (error) { @@ -284,18 +288,18 @@ async loadTodoList() { this.loading = true; try { - const profileUser = await this.fetchUserProfile(); - const userId = this.resolveCurrentUserId(profileUser); - if (!userId) { - this.todoList = []; - this.todoCount = 0; - uni.showToast({ - title: '当前登录信息未就绪,请稍后重试', - icon: 'none' - }); - return; - } - const res = await listTodoFlowTask(userId); + // const profileUser = await this.fetchUserProfile(); + // const userId = this.resolveCurrentUserId(profileUser); + // if (!userId) { + // this.todoList = []; + // this.todoCount = 0; + // uni.showToast({ + // title: '当前登录信息未就绪,请稍后重试', + // icon: 'none' + // }); + // return; + // } + const res = await listTodoFlowTask(this.currentOaUserId); let list = res.data || []; // 前端过滤 bizType if (this.query.bizType) { diff --git a/pages/profile/index/index.vue b/pages/profile/index/index.vue index 431f070..3c0d977 100644 --- a/pages/profile/index/index.vue +++ b/pages/profile/index/index.vue @@ -206,6 +206,7 @@ export default { uni.showToast({ icon: "success", title: "缓存清除成功", + duration: 1500 }); } }, diff --git a/pages/workbench/hrm/detail/detail.vue b/pages/workbench/hrm/detail/detail.vue index 83f1ce5..3af940b 100644 --- a/pages/workbench/hrm/detail/detail.vue +++ b/pages/workbench/hrm/detail/detail.vue @@ -59,7 +59,10 @@ return this.bizTypeComponentMap[this.bizType] || ''; }, canApprove() { - return this.currentTask && this.currentTask.status === 'pending' && (this.currentTask?.assigneeUserName === this.$store.getters.storeOaName || this.currentTask?.assigneeUserId === this.$store.getters.storeOaId) + console.log(this.currentTask, this.$store.getters.storeOaName, this.$store.getters.storeOaId) + return this.currentTask && this.currentTask.status === 'pending' && + (this.currentTask?.assigneeUserName === this.$store.getters.storeOaName + || this.currentTask?.assigneeUserId === this.$store.getters.storeOaId) }, }, watch: {