public/components/frame/privilegeTree/privilegeTree.js
@@ -125,6 +125,52 @@
                        $that.deletePrivilege(_selectPrivileges);
                    }
                });
                // 在树加载完成后,为第三级节点添加"权限"按钮
                $('#jstree_privilege').on("ready.jstree", function (e, data) {
                    $that._addPermissionButtons();
                });
                // 当树节点展开时,为展开的第三级节点添加按钮
                $('#jstree_privilege').on("open_node.jstree", function (e, data) {
                    setTimeout(function () {
                        $that._addPermissionButtons();
                    }, 100);
                });
                // 当树刷新时,重新添加按钮
                $('#jstree_privilege').on("refresh.jstree", function (e, data) {
                    setTimeout(function () {
                        $that._addPermissionButtons();
                    }, 100);
                });
            },
            _addPermissionButtons: function () {
                // 获取所有第三级节点(id以p_开头)
                $('#jstree_privilege').find('li[id^="p_"]').each(function () {
                    let $node = $(this);
                    let $anchor = $node.find('> a.jstree-anchor');
                    // 检查是否已经添加过按钮
                    if ($anchor.next('.permission-btn').length === 0) {
                        // 创建权限按钮
                        let $btn = $('<button class="permission-btn" style="margin-left: 10px; padding: 2px 8px; font-size: 12px; border: 1px solid #ccc; border-radius: 3px; background: #fff; cursor: pointer; color: #333;">权限</button>');
                        // 获取权限ID
                        let nodeId = $node.attr('id');
                        let pId = nodeId.substring(2); // 去掉"p_"前缀
                        // 绑定点击事件
                        $btn.on('click', function (e) {
                            e.stopPropagation(); // 阻止事件冒泡,避免触发树节点的选择
                            // 获取当前页面的参数
                            let pgId = vc.component.privilegeTreeInfo._currentPgId;
                            let communityId = vc.getCurrentCommunity().communityId;
                            // 获取权限名称
                            let nodeData = $('#jstree_privilege').jstree('get_node', nodeId);
                            let pName = nodeData ? nodeData.text : '';
                            // 跳转到role-a页面,传递所有参数
                            let params = 'pId=' + pId + '&pgId=' + pgId + '&communityId=' + communityId + '&type=all&pName=' + encodeURIComponent(pName);
                            vc.jumpToPage('/#/pages/frame/role/role-a?' + params);
                        });
                        // 将按钮插入到节点后面
                        $anchor.after($btn);
                    }
                });
            },
            _doJsTreeData: function (_privileges) {
                let _mGroupTree = [];