| | |
| | | this.getTypeList(); |
| | | }, |
| | | methods: { |
| | | |
| | | getTreeList() { |
| | | const loading = this.$loading({}); |
| | | gridRoles().then(res => { |
| | |
| | | if (obj.checked === true) { |
| | | result.push(obj.oid); |
| | | } |
| | | |
| | | // 如果有 children,则继续遍历 |
| | | if (obj.children && obj.children.length > 0) { |
| | | obj.children.forEach(child => { |
| | | this.findCheckedOids(child, result); |
| | | }); |
| | | } |
| | | |
| | | return result; |
| | | }, |
| | | |
| | |
| | | processChildren(item) { |
| | | if (item.children && item.children.length > 0) { |
| | | item.children = item.children.map(child => { |
| | | if (child.level < 2) { |
| | | if (child.level < 3) { |
| | | // 默认树节点展开两层效果 |
| | | this.defaultExpandKeys.push(child.oid) |
| | | } |
| | |
| | | |
| | | saveHandler() { |
| | | const selectTreeList = this.$refs.uiTree.getCheckedNodes(); |
| | | const selectParentList = this.$refs.uiTree.getHalfCheckedNodes(); |
| | | if (selectTreeList.length == 0) { |
| | | this.$message.error("请选择功能模块"); |
| | | return; |
| | | } |
| | | const selectTreeData = selectTreeList.map(item => { |
| | | return { |
| | | checked: true, |
| | | expanded: true, |
| | | data:item.data, |
| | | level: item.level, |
| | | oid: item.oid, |
| | | text: item.text |
| | | } |
| | | }) |
| | | |
| | | // const parentData = selectParentList.map(item => { |
| | | // return { |
| | | // checked: false, |
| | | // expanded: true, |
| | | // data:item.data, |
| | | // level: item.level, |
| | | // oid: item.oid, |
| | | // text: item.text |
| | | // } |
| | | // }) |
| | | // // 在半选状态中过滤掉顶级节点 oid 为 root |
| | | // const filterSelectTreeData = parentData.filter(item => item.oid !== 'root'); |
| | | |
| | | const data = [...selectTreeData]; |
| | | const formData = { |
| | | roleId: this.nodeRow.oid, |
| | | type: this.type, |