|
|
@ -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 |
|
|
|