fix(approve): 修复审批流程中的用户ID获取问题
优化审批流程中用户ID的获取方式,确保在加载待办列表时使用正确的用户ID。同时添加调试日志和调整toast显示时长。
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
<!-- 空数据 -->
|
||||
<view v-else-if="todoList.length === 0" class="empty-container">
|
||||
<uni-icons type="empty" size="60" color="#909399"></uni-icons>
|
||||
<uni-icons type="empty" size="60" color="#909399"></uni-icons>
|
||||
<view class="empty-text">暂无待审批任务</view>
|
||||
</view>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -206,6 +206,7 @@ export default {
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "缓存清除成功",
|
||||
duration: 1500
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user