Easyui Window窗口

l35740623 2017-12-05 09:31:42

我在框架的主页上封装了一个window窗口js方法,其他页面窗口都是调用这个js方法,打开第一个窗口正常,如图我在“部门信息添加”的window窗口中的上级单位按钮打开窗口的时候,就会把“部门信息添加”的窗口给关闭了。
...全文
214 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
l35740623 2017-12-06
  • 打赏
  • 举报
回复
引用 3 楼 zhang_kang_user 的回复:
看你的js上,你的打开window的id名字就是#Pagewindow这个,好像是一样的,这个id会不会冲突啊,你要不加入一个随机数,让id不相同试试。
谢谢老哥,随机数不管用,我根据你的思路,每次调用通过参数的方式提供id名称就可以,总之ID不能相同
zk_Kang 2017-12-06
  • 打赏
  • 举报
回复
看你的js上,你的打开window的id名字就是#Pagewindow这个,好像是一样的,这个id会不会冲突啊,你要不加入一个随机数,让id不相同试试。
l35740623 2017-12-06
  • 打赏
  • 举报
回复
引用 1 楼 zhang_kang_user 的回复:
能发一下你写的那个js么,可能是因为,你的那个是根据父窗口建立的window页面,父窗口是固定的,再到子窗口上打开window窗口,可能会在父窗口上建立的,
 function OpenTopWindow(url, title, iwidth, iheight, icon) {
            //计算弹窗位置
            var iframeWidth = $(this).width();
            var iframeHeight = $(this).height();
            var setWidth = (iframeWidth - iwidth) / 2;
            var setHeight = (iframeHeight - iheight) / 2;

            title = title == undefined ? ' ' : title;
            iwidth = iwidth == undefined ? 800 : iwidth;
            iheight = iheight == undefined ? 300 : iheight;
            if (url != undefined) {
                var content = '<iframe name="windowIframe" src="' + url + '" width="100%" height="99%" frameborder="0"></iframe>';
                var boarddiv = '<div id="Pagewindow" title="' + title + '" ></div>'//style="overflow:hidden;"可以去掉滚动条
                $(document.body).append(boarddiv);
                var win = $("#Pagewindow").window({
                    title: title,
                    iconCls: icon,
                    content: content,
                    width: iwidth,
                    height: iheight,
                    left: setWidth,  //弹窗左边距
                    top: setHeight, //弹窗上边距
                    minimizable: false,
                    modal: true,
                    onMove: function (left, top) { // popwindow拖动时触发,限制弹出框拖动范围
                        var parentObj = $(this).panel('panel').parent();
                        var width = $(this).panel('options').width;
                        var height = $(this).panel('options').height;
                        var parentWidth = $("body").width();
                        var parentHeight = $("body").height();
                        var scrollLeft = document.body.scrollLeft;
                        var scrollTop = document.body.scrollTop;
                        // 当弹出框尺寸大于浏览器大小时,弹出框自动缩小为浏览器当前尺寸
                        if (width > parentWidth)
                            $(this).window('resize', {
                                width: parentWidth - 1
                            });
                        if (height > parentHeight)
                            $(this).window('resize', {
                                height: parentHeight - 1
                            });
                        // 当弹出框被拖动到浏览器外时,将弹出框定位至浏览器边缘
                        if (left < scrollLeft) {
                            $(this).window('move', {
                                left: scrollLeft
                            });
                        }
                        if (top < scrollTop) {
                            $(this).window('move', {
                                top: scrollTop
                            });
                        }
                        if (left > scrollLeft && left > parentWidth - width + scrollLeft) {
                            $(this).window('move', {
                                left: parentWidth - width + scrollLeft
                            });
                        }
                        if (top > scrollTop && top > parentHeight - height + scrollTop) {
                            $(this).window('move', {
                                top: parentHeight - height + scrollTop
                            });
                        }
                    }
                });
            }
            win.window("open");
        }
这个JS方法我是写在框架主页Index里的,因为我项目所有的弹窗需要在框架之上,所以所有的页面弹出都是调用这个js方法
zk_Kang 2017-12-05
  • 打赏
  • 举报
回复
能发一下你写的那个js么,可能是因为,你的那个是根据父窗口建立的window页面,父窗口是固定的,再到子窗口上打开window窗口,可能会在父窗口上建立的,

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧