修复发票管理界面管理员和普通操作人员的筛选规则

This commit is contained in:
叶锦涛
2025-11-27 13:36:17 +08:00
parent a0e52da437
commit d197f7555f
2 changed files with 11 additions and 8 deletions

View File

@@ -18,7 +18,8 @@ const useUserStore = defineStore(
fixmedinsCode: '', // 医疗机构编码
roles: [],
permissions: [],
tenantId: ''
tenantId: '',
status: '' // 用户状态0-启用(管理员), 1-禁用(普通人员)
}),
actions: {
// 登录
@@ -60,6 +61,7 @@ const useUserStore = defineStore(
this.practitionerId = res.practitionerId
this.fixmedinsCode = res.optionJson.fixmedinsCode
this.avatar = avatar
this.status = user.status // 保存用户状态
resolve(res)
}).catch(error => {
reject(error)

View File

@@ -180,7 +180,7 @@ export default {
name: '',
nickName: '',
employeeId: '',
role: '' // operator: 普通操作员, admin: 管理员
status: '' // 0: 启用(管理员), 1: 禁用(普通人员)
},
// 用户列表用于操作员下拉选择将在created中从后端获取
userList: [],
@@ -197,7 +197,8 @@ export default {
computed: {
// 计算属性:判断是否为管理员
isAdmin() {
return this.currentUser.role === 'admin';
// 管理员是指在用户管理界面中状态为启用的用户
return this.currentUser.status === '0';
}
},
created() {
@@ -209,7 +210,7 @@ export default {
name: userStore.nickName || userStore.name,
nickName: userStore.nickName,
employeeId: userStore.id || userStore.practitionerId,
role: userStore.roles && userStore.roles.length > 0 ? userStore.roles[0] : 'operator'
status: userStore.status || '' // 0: 启用(管理员), 1: 禁用(普通人员)
};
console.log('当前登录用户信息:', this.currentUser);
@@ -248,7 +249,7 @@ export default {
this.userList = res.data.records.map(user => ({
name: user.nickName || user.username || user.name, // 尝试多种可能的名称字段
employeeId: user.userId, // 使用用户ID作为员工工号
role: user.role || 'operator' // 默认为普通操作员
status: user.status // 0: 启用(管理员), 1: 禁用(普通人员)
}));
console.log('获取到的用户列表:', this.userList);
return Promise.resolve();
@@ -401,7 +402,7 @@ export default {
},
// 根据用户权限过滤数据
filterDataByPermission() {
console.log('开始过滤数据,当前用户角色:', this.currentUser.role);
console.log('开始过滤数据,当前用户状态:', this.currentUser.status);
console.log('过滤前数据总量:', this.invoiceData.length);
if (this.isAdmin) {
@@ -496,8 +497,8 @@ export default {
}
// 严格检查权限:只有管理员或记录所有者可以删除
if (this.currentUser.role !== 'admin' && record.employeeId !== this.currentUser.employeeId) {
alert('您没有权限删除此记录!操作员只能删除自己的记录。');
if (this.currentUser.status !== '0' && record.employeeId !== this.currentUser.employeeId) {
alert('您没有权限删除此记录!普通人员只能删除自己的记录。');
return;
}