|
|
@ -198,7 +198,7 @@ const handleAddRole = async function () { |
|
|
"menuIds": finalCheckedKeys, |
|
|
"menuIds": finalCheckedKeys, |
|
|
"fatherId": addRole.value.parentId, |
|
|
"fatherId": addRole.value.parentId, |
|
|
"market": addRole.value.market, |
|
|
"market": addRole.value.market, |
|
|
channel:addRole.value.channel |
|
|
|
|
|
|
|
|
channel: addRole.value.channel |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
if (res.code === 200) { |
|
|
if (res.code === 200) { |
|
|
@ -319,7 +319,7 @@ const handleEditRolePermissionCheck = (checkedNodes, checkedInfo) => { |
|
|
// 判断是否有选中的节点 |
|
|
// 判断是否有选中的节点 |
|
|
if (allCheckedNodes.length === 0) { |
|
|
if (allCheckedNodes.length === 0) { |
|
|
permissionEditRoleObj.value.checkedKeys = [] |
|
|
permissionEditRoleObj.value.checkedKeys = [] |
|
|
ifHasChannel.value = false |
|
|
|
|
|
|
|
|
ifHasChannel.value = false |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -329,7 +329,7 @@ const handleEditRolePermissionCheck = (checkedNodes, checkedInfo) => { |
|
|
|
|
|
|
|
|
console.log('编辑角色选中的权限ID:', checkedKeys) |
|
|
console.log('编辑角色选中的权限ID:', checkedKeys) |
|
|
console.log('选中的节点数量:', allCheckedNodes.length) |
|
|
console.log('选中的节点数量:', allCheckedNodes.length) |
|
|
if (checkedKeys.includes(124)||checkedKeys.includes(125)||checkedKeys.includes(126)||checkedKeys.includes(127)) { |
|
|
|
|
|
|
|
|
if (checkedKeys.includes(124) || checkedKeys.includes(125) || checkedKeys.includes(126) || checkedKeys.includes(127)) { |
|
|
ifHasChannel.value = true |
|
|
ifHasChannel.value = true |
|
|
} else { |
|
|
} else { |
|
|
ifHasChannel.value = false |
|
|
ifHasChannel.value = false |
|
|
@ -431,18 +431,38 @@ const collectIds2 = (tree) => { |
|
|
return ids |
|
|
return ids |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const collectIdsAll = (tree) => { |
|
|
|
|
|
let ids = [] |
|
|
|
|
|
tree.forEach((node) => { |
|
|
|
|
|
ids.push(node.id) |
|
|
|
|
|
// 如果当前节点没有 children 或 children 为空,说明是叶子节点 |
|
|
|
|
|
if (node.children || node.children.length === 0) { |
|
|
|
|
|
ids = ids.concat(collectIdsAll(node.children)) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
return ids |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 编辑角色初始化 |
|
|
// 编辑角色初始化 |
|
|
const permissionEditRoleInit = async function (row) { |
|
|
const permissionEditRoleInit = async function (row) { |
|
|
console.log('row', row) |
|
|
console.log('row', row) |
|
|
console.log('row.tree', row.tree) |
|
|
console.log('row.tree', row.tree) |
|
|
|
|
|
let EditIds = collectIdsAll(row.tree) |
|
|
|
|
|
console.log(EditIds); |
|
|
|
|
|
|
|
|
permissionEditRoleObj.value = {} |
|
|
permissionEditRoleObj.value = {} |
|
|
permissionEditRoleObj.value.id = row.id |
|
|
permissionEditRoleObj.value.id = row.id |
|
|
permissionEditRoleObj.value.roleName = row.roleName |
|
|
permissionEditRoleObj.value.roleName = row.roleName |
|
|
permissionEditRoleObj.value.market = row.market |
|
|
permissionEditRoleObj.value.market = row.market |
|
|
permissionEditRoleObj.value.parentId = row.fatherId |
|
|
permissionEditRoleObj.value.parentId = row.fatherId |
|
|
permissionEditRoleObj.value.parentName = row.fatherName |
|
|
permissionEditRoleObj.value.parentName = row.fatherName |
|
|
|
|
|
|
|
|
|
|
|
permissionEditRoleObj.value.channel = row.channel |
|
|
|
|
|
if (EditIds.includes(124)) { |
|
|
|
|
|
ifHasChannel.value = true |
|
|
|
|
|
} else { |
|
|
|
|
|
ifHasChannel.value = false |
|
|
|
|
|
} |
|
|
try { |
|
|
try { |
|
|
let roleId = permissionEditRoleObj.value.parentId; |
|
|
let roleId = permissionEditRoleObj.value.parentId; |
|
|
// 如果没有上级角色,设置为管理员的id |
|
|
// 如果没有上级角色,设置为管理员的id |
|
|
|