mirror of
https://github.com/yangzongzhuan/RuoYi-Vue3.git
synced 2025-09-27 23:02:41 +00:00
优化多角色数据权限匹配规则
This commit is contained in:
@@ -262,9 +262,8 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Role">
|
||||
import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole } from "@/api/system/role";
|
||||
import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role";
|
||||
import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu";
|
||||
import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
@@ -462,8 +461,8 @@ function getRoleMenuTreeselect(roleId) {
|
||||
});
|
||||
}
|
||||
/** 根据角色ID查询部门树结构 */
|
||||
function getRoleDeptTreeselect(roleId) {
|
||||
return roleDeptTreeselect(roleId).then(response => {
|
||||
function getDeptTree(roleId) {
|
||||
return deptTreeSelect(roleId).then(response => {
|
||||
deptOptions.value = response.depts;
|
||||
return response;
|
||||
});
|
||||
@@ -543,12 +542,12 @@ function dataScopeSelectChange(value) {
|
||||
/** 分配数据权限操作 */
|
||||
function handleDataScope(row) {
|
||||
reset();
|
||||
const roleDeptTreeselect = getRoleDeptTreeselect(row.roleId);
|
||||
const deptTreeSelect = getDeptTree(row.roleId);
|
||||
getRole(row.roleId).then(response => {
|
||||
form.value = response.data;
|
||||
openDataScope.value = true;
|
||||
nextTick(() => {
|
||||
roleDeptTreeselect.then(res => {
|
||||
deptTreeSelect.then(res => {
|
||||
nextTick(() => {
|
||||
if (deptRef.value) {
|
||||
deptRef.value.setCheckedKeys(res.checkedKeys);
|
||||
|
Reference in New Issue
Block a user