Skip to main content

部门管理

部门管理中功能有:部门的新增,删除,修改以及设置部门关联角色,编辑用户的角色。

tsx文件

import { systemStore, systemStoreNames, Department } from 'mlog-service';
<Department store={systemStore.get(systemStoreNames.departmentStore)} />

设置视图类型

部门管理有两种展现形式,一个是扁平形式(table),一个是树形结构(tree),通古参数allowedViewTypes设置,如果配置了两种展现形式,页面上会有切换试图类型的按钮,如果只设置一种,则没有切换试图类型的按钮。

systemStore.set(systemStoreNames.departmentStore, new DepartmentStore({
  allowedViewTypes: ['tree', 'table'], // 允许的视图类型,第一个为默认类型
}));

设置部门关联角色

设置部门关联角色的意思是配置某个部门下的用户所能设置的角色列表,没做特别限制的话,部门下的用户能设置为所有角色类型。比如设置了一个部门的关联角色有超级管理员和注册用户,那么后面这个部门下所有用户只能修改角色为这两种类型。

systemStore.set(systemStoreNames.departmentStore, new DepartmentStore({
  showDepartmentRole: true, // 是否展示当前部门关联角色模块
}));

设置树视图下是否可拖动节点

这个配置是指在树视图下,可以通过拖动节点的方式更改用户所属部门或者移动部门,如果只是更改同一层级的顺序,拖动无效,因为目前没有存顺序字段到表中。

systemStore.set(systemStoreNames.departmentStore, new DepartmentStore({
  draggable: true, // 树视图下是否可拖动节点
}));

设置部门中文名称

部门管理中涉及到部门两个字的,可通过departmentName这个参数来更改。

systemStore.set(systemStoreNames.departmentStore, new DepartmentStore({
  departmentName: '单位' // 部门的中文名称,默认为部门
}));