| | |
| | | /** |
| | | * @description 获取权限分配树 |
| | | */ |
| | | getTree = (parents, options) => { |
| | | getTree = (parents, options, addSelf) => { |
| | | parents.forEach(parent => { |
| | | parent.children = [] |
| | | |
| | |
| | | title: option.MenuName, |
| | | key: option.MenuID, |
| | | addSelf: option.OnlySelf === 'true', |
| | | tabs: option.Tabs |
| | | // tabs: option.Tabs |
| | | }) |
| | | } |
| | | }) |
| | |
| | | if (parent.children.length === 0) { |
| | | parent.children = null |
| | | // 针对标签,生成新的id,并保存关联关系(标签不唯一) |
| | | if (parent.tabs) { |
| | | let _uuid = Utils.getuuid() |
| | | linkMap.set(_uuid, parent.key) |
| | | // if (parent.tabs) { |
| | | // let _uuid = Utils.getuuid() |
| | | // linkMap.set(_uuid, parent.key) |
| | | |
| | | parent.originKey = parent.key |
| | | parent.key = _uuid |
| | | } |
| | | // parent.originKey = parent.key |
| | | // parent.key = _uuid |
| | | // } |
| | | } else { |
| | | // 三级菜单创建子项 |
| | | if (parent.addSelf) { |
| | |
| | | parent.children.unshift({ |
| | | title: parent.title + '(仅页面)', |
| | | key: _uuid, |
| | | isSubView: true |
| | | // isSubView: true |
| | | }) |
| | | } else if (addSelf) { |
| | | let _uuid = Utils.getuuid() |
| | | linkMap.set(_uuid, parent.key) |
| | | parent.subKey = _uuid |
| | | |
| | | parent.children.unshift({ |
| | | title: parent.title + '(表格)', |
| | | key: _uuid, |
| | | }) |
| | | } |
| | | |
| | | // 针对标签,生成新的id,并保存关联关系(标签不唯一) |
| | | if (parent.tabs) { |
| | | let _uuid = Utils.getuuid() |
| | | linkMap.set(_uuid, parent.key) |
| | | // if (parent.tabs) { |
| | | // let _uuid = Utils.getuuid() |
| | | // linkMap.set(_uuid, parent.key) |
| | | |
| | | parent.originKey = parent.key |
| | | parent.key = _uuid |
| | | } |
| | | // parent.originKey = parent.key |
| | | // parent.key = _uuid |
| | | // } |
| | | |
| | | parent.children = this.getTree(parent.children, options) |
| | | parent.children = this.getTree(parent.children, options, parent.addSelf) |
| | | } |
| | | }) |
| | | return parents |
| | |
| | | } |
| | | } |
| | | return true |
| | | } else if (parent.isSubView) { |
| | | return true |
| | | // } else if (parent.isSubView) { |
| | | // return true |
| | | } |
| | | return false |
| | | }) |