功能变化:
1.优化对字段权限的处理
This commit is contained in:
@@ -7,3 +7,40 @@ export const columnPermission = (key: string, type: permissionType): boolean =>
|
||||
|
||||
return !!permissions.some((i) => i.field_name === key && i[type]);
|
||||
};
|
||||
|
||||
/**
|
||||
* 处理字段权限
|
||||
* @param crudOptions
|
||||
*/
|
||||
export const handleColumnPermission = async (crudOptions:any)=>{
|
||||
const res = await GetPermission();
|
||||
const columns = crudOptions.columns;
|
||||
for(let col in columns){
|
||||
if(columns[col].column){
|
||||
columns[col].column.show = false
|
||||
}else{
|
||||
columns[col]['column'] = {
|
||||
show:false
|
||||
}
|
||||
}
|
||||
columns[col].addForm = {
|
||||
show:false
|
||||
}
|
||||
columns[col].editForm = {
|
||||
show:false
|
||||
}
|
||||
for(let item of res.data){
|
||||
if(item.field_name === col){
|
||||
columns[col].column.show = item['is_query']
|
||||
columns[col].addForm = {
|
||||
show:item['is_create']
|
||||
}
|
||||
columns[col].editForm = {
|
||||
show:item['is_update']
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return columns
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user