• jquery.util.easyui.dialog


    (function ($) {
    var $parent = parent.$;
    //获取弹出窗口数据集合
    function getDialogs() {
    var dialogs = $parent("#div_index_data").data("dialogs");
    dialogs = dialogs || [];
    if ($.util.isEmptyObjectOrNull(dialogs))
    return [];
    return dialogs;
    }

    //获取当前弹出窗口数据
    function getCurrentDialog() {
    var dialogs = getDialogs();
    return dialogs[dialogs.length - 1] || {};
    }

    //获取当前弹出窗口Id
    function getCurrentDialogId() {
    return getCurrentDialog().id;
    }

    //添加弹出窗口数据,包括弹出窗口Id和jQuery对象
    function addDialog(id) {
    var data = getDialogs();
    data.push({ id: id, caller: window });
    $parent("#div_index_data").data("dialogs", data);
    }

    //移除当前弹出窗口数据
    function removeCurrentDialog() {
    var dialogs = getDialogs();
    dialogs.pop();
    }

    //树形操作
    $.easyui.dialog = function () {
    return {
    //添加弹出框
    addDialog: function (id) {
    addDialog(id);
    return getCurrentDialog();
    },
    //获取原调用者window对象
    getCaller: function () {
    return getCurrentDialog().caller;
    },
    //获取原调用者jQuery对象
    getCaller$: function () {
    return getCurrentDialog().caller.$;
    },
    //获取弹出窗window对象
    getCurrent: function () {
    var dialogId = getCurrentDialogId();
    return top.frames[dialogId + "_iframe"] ? (!top.frames[dialogId + "_iframe"].contentWindow ? top.frames[dialogId + "_iframe"] : top.frames[dialogId + "_iframe"].contentWindow) : top.contentWindow;
    },
    //获取弹出窗jQuery对象
    getCurrent$: function () {
    var dialogId = getCurrentDialogId();
    return top.frames[dialogId + "_iframe"] ? (!top.frames[dialogId + "_iframe"].contentWindow ? top.frames[dialogId + "_iframe"].$ : top.frames[dialogId + "_iframe"].contentWindow.$) : top.contentWindow.$;
    },
    //打开弹出窗口
    open: function (options) {
    /// <summary>
    /// 弹出模态窗,解决在Iframe中无法全屏遮罩,
    /// 注意:仅支持url弹窗
    /// </summary>
    /// <param name="options" type="Object">
    /// 1. title:标题
    /// 2. url:网址
    /// 3. buttons:显示在窗口底部的按钮区域div的id
    /// 4. icon:图标class
    /// 5. 宽度
    /// 6. height:高度
    /// 7. onInit:初始化事件,返回false跳出执行
    /// </param>
    initOptions();
    if (!options.onInit(options))
    return;
    var dialog = createDialow();
    show();
    addDialog(options.id);

    //初始化参数
    function initOptions() {
    options = $.extend({
    id: $.util.newGuid(""),
    title: '',
    url: '',
    icon: 'icon-standard-common-window',
    600,
    height: 360,
    iframe: true,
    closed: false,
    maximizable: true,
    resizable: true,
    cache: false,
    modal: true,
    buttons: '',
    onInit: function () {
    return true;
    },
    closeCallback: function () { }
    }, options || {});
    }

    //创建窗口div
    function createDialow() {
    if (options.iframe) {
    return $parent("<div id='" + options.id + "' style='overflow:visible;'><iframe id='" + options.id + "_iframe' scrolling="auto" frameborder="0" style="100%;height:100%;" src='" + options.url + "' ></iframe></div>").appendTo('body');
    } else {
    return $parent("<div id='" + options.id + "'></div>").appendTo('body');
    }
    }

    //弹出窗口
    function show() {
    dialog.dialog({
    title: options.title,
    href: options.iframe ? "" : options.url,
    options.width,
    height: options.height,
    closed: options.closed,
    maximizable: options.maximizable,
    resizable: options.resizable,
    cache: options.cache,
    modal: options.modal,
    iconCls: options.icon,
    buttons: options.buttons,
    border: false,
    onLoad: function () {
    },
    onClose: function () {
    options.closeCallback();
    $parent("#" + getCurrentDialogId()).dialog('destroy');
    removeCurrentDialog();
    }
    });
    }
    },
    openCommon: function (url, title, width, height, callBack) {
    $.easyui.dialog.open({
    title: title,
    url: url,
    width,
    height: height,
    buttons: [{
    text: '确定',
    iconCls: 'icon-standard-common-ok',
    handler: function () {
    callBack(getCurrentDialogId());
    }
    }, {
    text: '取消',
    iconCls: 'icon-standard-common-cancel',
    handler: function () {
    $.easyui.dialog.close();
    }
    }]
    });
    },
    //关闭弹出窗口
    close: function () {
    var dialogId = getCurrentDialogId();
    if (!dialogId)
    return;
    $parent('#' + dialogId).dialog('close');
    },
    //打开Tab页面
    openTab: function (tabid, url, name, img) {
    addDialog("tabs_iframe_" + tabid);
    AddTabMenu(tabid, url, name, img, true, true, true);
    },
    //关闭当前Tab页面
    closeTab: function () {
    removeCurrentDialog();
    ThisCloseTab();
    }
    }
    }();
    })(jQuery);

  • 相关阅读:
    libtorch初体验
    libtorch 常用api函数示例(史上最全、最详细)
    VS2015,vs2019用正则表达式搜索删除空白行的方法
    CMake引入opencv3.1.0编译时includes non-existent path问题解决
    opencv编译的时候的注意事项------如果出现 target glog::glog 找不到的情况,可能是由于glog的版本过低导致的。通常与ceres有关
    ID3D11Multithread 未声明的标识符 opencv 411 opencv400 3411 opencv440 vs2015 都出现这个错误 但是opencv311没有出现这个问题
    错误 LNK2001 无法解析的外部符号 "__declspec(dllimport) bool cv::__termination" (__imp_?__termination@cv@@3_NA) opencv_cudev
    raw.githubusercontent.com无法连接
    编译opencv3.1.0时出现错误:error: ‘NppiGraphcutState’ has not been declared
    Ubuntu16.04 安装g++6
  • 原文地址:https://www.cnblogs.com/huangf714/p/5918712.html
Copyright © 2020-2023  润新知