fix: restore strict column permission control

Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
dxc
2026-02-27 10:57:30 +08:00
parent 661ce4e5a0
commit a547d6b164

View File

@ -515,8 +515,8 @@ const permissionMap: Record<string, string> = {
type: 'material_list:type', type: 'material_list:type',
spec: 'material_list:spec', spec: 'material_list:spec',
unit: 'material_list:unit', unit: 'material_list:unit',
inventory: 'material_list:inventoryCount', // 前端变量是 inventory数据库Code是 inventoryCount inventory: 'material_list:inventoryCount',
available: 'material_list:availableCount', // 前端变量是 available数据库Code是 availableCount available: 'material_list:availableCount',
files: 'material_list:files', files: 'material_list:files',
isEnabled: 'material_list:isEnabled' isEnabled: 'material_list:isEnabled'
}; };
@ -528,16 +528,14 @@ const initColumnPermissions = () => {
return; return;
} }
// 普通用户:不再根据权限隐藏列,而是显示所有列,由后端控制字段值 // 普通用户:严格执行列级权限控制,没有权限的列必须隐藏
// 所以这里不做任何操作保持columns的默认visibletrue Object.keys(columns).forEach(key => {
// 但是,我们也可以选择性地根据权限隐藏列,但用户要求列显示,所以不隐藏 const code = permissionMap[key];
// 因此,注释掉下面的代码 if (code) {
// Object.keys(columns).forEach(key => { // 如果不具备该权限,必须设为 false
// const code = permissionMap[key]; columns[key].visible = !!userStore.hasPermission(code);
// if (code) { }
// columns[key].visible = !!userStore.hasPermission(code); });
// }
// });
}; };
const companyOptions = ref<string[]>([]); const companyOptions = ref<string[]>([]);