fix: 角色分配菜单勾选父子级联转出子节点关联根节点数组
This commit is contained in:
@@ -23,7 +23,11 @@ import { saveAs } from 'file-saver';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import { DataNode } from 'ant-design-vue/es/tree';
|
||||
import { parseTreeKeys, parseTreeNodeKeys } from '@/utils/parse-tree-utils';
|
||||
import {
|
||||
parseTreeKeys,
|
||||
parseTreeNodeKeys,
|
||||
parseTreeNodeKeysByChecked,
|
||||
} from '@/utils/parse-tree-utils';
|
||||
import { hasPermissions } from '@/plugins/auth-user';
|
||||
import { MENU_PATH_INLINE } from '@/constants/menu-constants';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
@@ -328,7 +332,12 @@ function fnModalVisibleByVive(roleId: string | number) {
|
||||
menuTree.treeData = menus;
|
||||
modalState.menuTree.treeData = menus;
|
||||
modalState.menuTree.checkedKeys = checkedKeys;
|
||||
modalState.from.menuIds = checkedKeys;
|
||||
if (modalState.from.menuCheckStrictly === '1') {
|
||||
const ids = parseTreeNodeKeysByChecked(menus, checkedKeys, 'id');
|
||||
modalState.from.menuIds = ids.concat(checkedKeys);
|
||||
} else {
|
||||
modalState.from.menuIds = checkedKeys;
|
||||
}
|
||||
}
|
||||
modalState.title = t('views.system.role.roleInfo');
|
||||
modalState.openByView = true;
|
||||
@@ -385,7 +394,12 @@ function fnModalVisibleByEdit(roleId?: string | number) {
|
||||
menuTree.treeData = menus;
|
||||
modalState.menuTree.treeData = menus;
|
||||
modalState.menuTree.checkedKeys = checkedKeys;
|
||||
modalState.from.menuIds = checkedKeys;
|
||||
if (modalState.from.menuCheckStrictly === '1') {
|
||||
const ids = parseTreeNodeKeysByChecked(menus, checkedKeys, 'id');
|
||||
modalState.from.menuIds = ids.concat(checkedKeys);
|
||||
} else {
|
||||
modalState.from.menuIds = checkedKeys;
|
||||
}
|
||||
}
|
||||
modalState.title =
|
||||
t('common.editText') + t('views.system.role.roleInfo');
|
||||
@@ -567,7 +581,12 @@ function fnRecordDataScope(roleId: string | number) {
|
||||
deptTree.treeData = depts;
|
||||
modalState.deptTree.treeData = depts;
|
||||
modalState.deptTree.checkedKeys = checkedKeys;
|
||||
modalState.from.deptIds = checkedKeys;
|
||||
if (modalState.from.deptCheckStrictly === '1') {
|
||||
const ids = parseTreeNodeKeysByChecked(depts, checkedKeys, 'id');
|
||||
modalState.from.deptIds = ids.concat(checkedKeys);
|
||||
} else {
|
||||
modalState.from.deptIds = checkedKeys;
|
||||
}
|
||||
}
|
||||
modalState.title = t('views.system.role.distribute');
|
||||
modalState.openByDataScope = true;
|
||||
|
||||
Reference in New Issue
Block a user