easyui各种dialog

var dynamicLoading = {
    js : function(src) {
        $.ajax({
            url : src,
            dataType : "script",
            async : false
        /* 同步操作 */
        });
    },
    css : function(path) {
        if (!path || path.length == 0) {
            throw new Error('argument "path" is required !');
        }
        var head = document.getElementsByTagName('head')[0];
        var link = document.createElement('link');
        link.href = path;
        link.rel = 'stylesheet';
        link.type = 'text/css';
        head.appendChild(link);
    }
}
/*******************************************************************************
 * 弹出层
 ******************************************************************************/
var dialog = {
    
    // 确认删除
    confirmDelete : function(pWidth, pHeight, pTitle, pContent) {
        var html = '<div class="dialog" id="dlg2">'
                + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:20px;">'
                + pContent + '  </div>' + '</div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog(
                {
                    title : pTitle,
                    modal : true,
                    // top :$("#center").offset().top+50,
                    iconCls : "icon-edit",
                    width : pWidth,
                    height : pHeight,
                    buttons : [
                            {
                                text : '确定',
                                id : 'delSure',
                                iconCls : 'icon-ok',
                                handler : function() {
                                    $("#form1").attr(
                                            "action",
                                            $("#form1").attr("action")
                                                    + "/delete");
                                    $("#form1").submit();
                                }
                            }, {
                                text : '取消',
                                iconCls : 'icon-cancel',
                                handler : function() {
                                    $("#dlg2").dialog("close");
                                    $("#dlg2").dialog("destroy");
                                }
                            } ],
                    close : function(event, ui) {
                        $(this).dialog("destroy"); // 关闭时销毁
                    }
                });
    },
    // 确认删除
    confirmcalc : function(pTitle, pContent,url) {
        var html = '<div class="dialog" id="dlg2">'    + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:20px;">'    + pContent + '  </div>' + '</div>';
        $(html).dialog({
            title :pTitle,
            modal : false
            width : 300,
            height : 150,
            buttons : [{
                text : '确定',
                id : 'delSure',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                    $.ajax({
                        async : true,
                        type : "POST",
                        contentType : "application/json; charset=utf-8",
                        url : url,
                        dataType : 'text',
                        success : function(result) {
                            dialog.autoCloss(300, 110, "系统提醒", result);
                            $(".datagrid-mask,.datagrid-mask-msg").hide(); 
                            $('#tbList').datagrid('uncheckAll');
                        },
                        beforeSend:function(){
                            dialog.loadding(320, 120, "正在批量计算,请勿关闭或刷新窗口!");
                        }
                    });        
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            }],
            close : function(event, ui) {
                $(this).dialog("destroy"); // 关闭时销毁
            }
        });
    },
    // 确认删除
    confirmAjax : function(pTitle, pContent,pUrl,ajaxType) {
        var html = '<div class="dialog" id="dlg2">'    + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:20px;">'    + pContent + '  </div>' + '</div>';
        $(html).dialog({
            title :pTitle,
            modal : false
            width : 300,
            height : 150,
            buttons : [{
                text : '确定',
                id : 'delSure',
                handler : function() {{
                    $.ajax({
                        type :ajaxType,
                        url : pUrl,
                        dataType : 'text',
                        success : function(data) {
                            $("#dlg2").dialog("close");
                            $("#dlg2").dialog("destroy");    
                            //dialog.autoCloss(300, 110, "操作提醒", data);
                            if(data.indexOf("成功")>-1){
                                $("#tbList").datagrid('reload');
                            }
                        }
                    });
                }                
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("destroy"); // 关闭时销毁
            }
        });
    },
    confirmCopy : function(pWidth, pHeight, pTitle, pContent) {
        var html = '<div class="dialog" id="dlg2">'
            + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:20px;">'
            + pContent + '  </div>' + '</div>';
    $("#dlg2").dialog("close");
    $("#dlg2").dialog("destroy");
    $(html).dialog(
            {
                title : pTitle,
                modal : true,
                iconCls : "icon-edit",
                width : pWidth,
                height : pHeight,
                buttons : [
                        {
                            text : '确定',
                            id : 'delSure',
                            iconCls : 'icon-ok',
                            handler : function() {
                                $("#form1").attr("action","/flood/copy");
                                $("#form1").submit();
                            }
                        }, {
                            text : '取消',
                            iconCls : 'icon-cancel',
                            handler : function() {
                                $("#dlg2").dialog("close");
                                $("#dlg2").dialog("destroy");
                            }
                        } ],
                close : function(event, ui) {
                    $(this).dialog("destroy"); // 关闭时销毁
                }
            });
},
    // 相关数据确认删除
    confirmlinkDelete : function(pWidth, pHeight, pTitle, pContent) {
        var html = '<div class="dialog" id="dlg2">'
                + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:10px;">'
                + pContent + '  </div>' + '</div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog(
                {
                    title : pTitle,
                    modal : true,
                    top : $("#center").offset().top + 50,
                    iconCls : "icon-edit",
                    width : pWidth,
                    buttons : [
                            {
                                text : '确定',
                                id : 'delSure',
                                iconCls : 'icon-ok',
                                handler : function() {
                                    $("#form1").attr(
                                            "action",
                                            $("#form1").attr("action")+ "/delete");
                                    $("#form1").submit();
                                }
                            }, {
                                text : '取消',
                                iconCls : 'icon-cancel',
                                handler : function() {
                                    $("#dlg2").dialog("close");
                                    $("#dlg2").dialog("destroy");
                                }
                            } ],
                    close : function(event, ui) {
                        $(this).dialog("destroy"); // 关闭时销毁
                    }
                });
    },
    // 确认删除
    doubleconfirmDelete : function(pWidth, pHeight, pTitle, pContent) {
        var html = '<div class="dialog" id="dlg2">'
                + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:60px;">'
                + pContent + '  </div>' + '</div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            top : $("#center").offset().top + 50,
            iconCls : "icon-edit",
            width : pWidth,
            buttons : [ {
                text : '确定',
                id : 'delSure',
                iconCls : 'icon-ok',
                handler : function() {
                    text = '请再次确认是否要删除?谨慎操作!';
                    dialog.confirmDelete(pWidth, pHeight, "再次确认", text);
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("destroy"); // 关闭时销毁
            }
        });
    },
    // 单个删除
    singleDelete : function(pWidth, pHeight, pTitle, pContent, id) {
        var html = '<div class="dialog" id="dlg2">'
                + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:60px;">'
                + pContent + '  </div>' + '</div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog(
                {
                    title : pTitle,
                    modal : true,
                    top : $("#center").offset().top + 50,
                    iconCls : "icon-edit",
                    width : pWidth,
                    buttons : [
                            {
                                text : '确定',
                                id : 'delSure',
                                iconCls : 'icon-ok',
                                handler : function() {
                                    window.location.href = $("#form1").attr(
                                            "action")
                                            + "/delete?ckId=" + id;
                                }
                            }, {
                                text : '取消',
                                iconCls : 'icon-cancel',
                                handler : function() {
                                    $("#dlg2").dialog("close");
                                    $("#dlg2").dialog("destroy");
                                }
                            } ],
                    close : function(event, ui) {
                        $(this).dialog("destroy"); // 关闭时销毁
                    }
                });
    },
    /***************************************************************************
     * 确认操作 pWidth:对话框宽度 pHeight:对话框高度 pTitle:显示的标题 pContent:显示的内容
     * pAction:操作的action(全称)
     **************************************************************************/
    confirm : function(pWidth, pHeight, pTitle, pContent, pAction) {
        var html = '<div class="dialog" id="dlg2">'
                + '  <div class="ui-icon ui-icon-alert" style="margin-top:20px;margin-left:60px;margin-bottom:10px;">'
                + pContent + '  </div>' + '</div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            top : $("#center").offset().top + 50,
            iconCls : "icon-edit",
            width : pWidth,
            buttons : [ {
                text : '确定',
                id : 'delSure',
                iconCls : 'icon-ok',
                handler : function() {
                    $("#form1").attr("action", pAction);
                    $("#form1").submit();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("destroy"); // 关闭时销毁
            }
        });
    },prompt : function (pContent,formAction,action1,action2) {
        var html = '<div class="dialog" id="prompt">'
            + '  <div class="ui-icon ui-icon-alert" style="margin-top:20px;margin-left:20px;margin-bottom:10px;">'
            + pContent + '  </div>' + '</div>';
        $("#prompt").dialog("close");
        $("#prompt").dialog("destroy");
        $(html).dialog({
            title : "操作提示",
            modal : true,
            iconCls : "icon-edit",
            width : 320,
            height: 130,
            buttons : [ {
                text : '确定',
                id : 'delSure',
                iconCls : 'icon-ok',
                handler : function() {
                    if(formAction != "")
                        $("#form1").attr("action",formAction);
                    $("#form1").ajaxSubmit(function(data) {
                        if (data != "")
                            dialog.autoCloss1(300,120,"操作提示",data,true,action1);
                         else
                            window.location.href = action2;
                    });
                    $("#prompt").dialog("close");
                    $("#prompt").dialog("destroy");
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#prompt").dialog("close");
                    $("#prompt").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("destroy"); // 关闭时销毁
            }
        });
    },
    /**
     * 弹出层选择框 pWidth:对话框宽度 pHeight:对话框高度 pTitle:显示的标题 id:按钮id pUrl:显示的页面地址
     */
    selectDialog : function(pWidth, pHeight, pTitle, id, pUrl) {
        var html = '<div id="dlgselect" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlgselect").dialog("close");
        $("#dlgselect").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [{
                text : '确定',
                id : 'select',
                handler : function() {
                    $('#' + id).click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlgselect").dialog("close");
                    $("#dlgselect").dialog("destroy");
                }
            }]
        });
    },
    /**
     * 弹出层选择框 pWidth:对话框宽度 pHeight:对话框高度 pTitle:显示的标题 id:按钮id pUrl:显示的页面地址
     */
    selectDialogForZone : function(pWidth, pHeight, pTitle, id, pUrl) {
        var html = '<div id="dlgselect" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlgselect").dialog("close");
        $("#dlgselect").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [{
                text:"<span id=\"spremark\" style=\"color:red;font-weight: bold;float:left;margin-top:4px;\">注:修改选择的分区信息,会覆盖机组下的分区信息,请谨慎修改!</span>"
            }, {
                text : '确定',
                id : 'select',
                handler : function() {
                    $('#' + id).click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlgselect").dialog("close");
                    $("#dlgselect").dialog("destroy");
                }
            }]
        });
    },
    //离顶部高度与上一个selectDialog不一样
    selectDialog2 : function(pWidth, pHeight, pTitle, id, pUrl) {
        var html = '<div id="dlgselect" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlgselect").dialog("close");
        $("#dlgselect").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top+50,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '确定',
                id : 'select',
                handler : function() {
                    $('#' + id).click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlgselect").dialog("close");
                    $("#dlgselect").dialog("destroy");
                }
            } ]
        });
    },
    selectDialog3 : function(pWidth, pHeight, pTitle, id, pUrl) {
        var html = '<div id="dlgselect" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlgselect").dialog("close");
        $("#dlgselect").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top+50,
            iconCls : "icon-save",
            width : pWidth,
            height : pHeight,
            buttons : [ {
                text : '确定',
                id : 'select',
                handler : function() {
                    $('#' + id).click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlgselect").dialog("close");
                    $("#dlgselect").dialog("destroy");
                }
            } ]
        });
    },
    /**
     * 全屏弹出层选择框 pTitle:显示的标题 id:按钮id pUrl:显示的页面地址
     */
    noButtonDialog : function(pTitle, width, height, pUrl) {
        var html = '<div id="dlgselect" class="easyui-dialog" style="padding: 10px;"></div>';
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            iconCls : "icon-save",
            width : width != 0 ? width : $(window).width(),
            height : height != 0 ? height : $(window).height(),
            onBeforeClose : function() {
                return false;
            }
        });
    },
    DialogWin : function(width,height,pTitle, pUrl) {
        var html = '<div id="dlgselect" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlgselect").dialog("close");
        $("#dlgselect").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            iconCls : "icon-save",
            width : width != 0 ? width : $(window).width(),
            height : height != 0 ? height : $(window).height(),
            buttons : [ {
                text : '确定',
                id : 'submit1',
                handler : function() {
                    $('#submit').click();
                    $("#dlgselect").dialog("close");
                    $("#dlgselect").dialog("destroy");
                }
            },
            {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlgselect").dialog("close");
                    $("#dlgselect").dialog("destroy");
                }
            }],
            close : function(event, ui) {
                $("#dlgselect").dialog("close");
                $("#dlgselect").dialog("destroy");
            }
        });
    },
    /**
     * 新增、编辑表单 pWidth:对话框宽度 pHeight:对话框高度 pTitle:显示的标题 pUrl:显示的页面地址
     * pCloseLocation: 关闭后跳转的地址
     */
    addDialog : function(pWidth, pHeight, pTitle, pUrl, pCloseLocation) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top + 50,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '提交',
                id : 'submit1',
                handler : function() {
                    $('#submittype').val('0');
                    $('#submit').click();
                }
            }, {
                text : '提交并继续',
                id : 'submit2',
                handler : function() {
                    $('#submittype').val(2 + parseInt($('#submittype').val()));
                    $('#submit').click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                    if ($('#submittype').val() >= 2) {
                        location.href = pCloseLocation;
                        $('#submittype').val('0');
                    }
                }
            } ],
            onClose : function() {
                if ($('#submittype').val() >= 2) {
                    location.href = pCloseLocation;
                    $('#submittype').val('0');
                }
            }
        });
    },
    roleditDialog : function(pWidth, pHeight, pTitle, pUrl, pCloseLocation) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            iconCls : "icon-save",
            width : pWidth,
            height : pHeight,
            buttons : [ {
                text : '提交',
                id : 'submit1',
                handler : function() {
                    $('#submittype').val('0');
                    $('#submit').click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                    if ($('#submittype').val() >= 2) {
                        location.href = pCloseLocation;
                        $('#submittype').val('0');
                    }
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    editDialog : function(pWidth, pHeight, pTitle, pUrl, pCloseLocation) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top + 50,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '提交',
                id : 'submit1',
                handler : function() {
                    $('#submittype').val('0');
                    $('#submit').click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                    if ($('#submittype').val() >= 2) {
                        location.href = pCloseLocation;
                        $('#submittype').val('0');
                    }
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    editDialog3 : function(pWidth, pHeight, pTitle, pUrl, pCloseLocation) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top + 50,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '提交',
                id : 'submit1',
                handler : function() {
                     $('#btnSubmit').click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    // 首次登录弹出密码修改框
    pwdDialog : function(pWidth, pHeight, pTitle, pUrl, pCloseLocation) {
        var html = '<div id="dlg3"  class="easyui-dialog" style="padding: 10px;"></div>';
        $(html).dialog({
            title : pTitle,
            modal : true,
            closeOnEscape : false,
            href : pUrl,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '提交',
                id : 'submit1',
                handler : function() {
                    $('#submittype').val('0');
                    $('#submit').click();
                }
            } ]
        });
    },
    viewDialog : function(pWidth, pHeight, pTitle, pUrl, pCloseLocation) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            height:pHeight,
            top : $("#center").offset().top + 50,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    viewDialog2 : function(pWidth, pHeight, pTitle, pUrl, pCloseLocation) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            iconCls : "icon-save",
            width : pWidth,
            height : pHeight,
            buttons : [ {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    viewDialog1 : function(pWidth, pTitle, pUrl) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : 10,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    viewDialog3 : function(pWidth,pHeight,  pTitle, pUrl) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            top : $("#center").offset().top + 50,
            href : pUrl,
            iconCls : "icon-save",
            width : pWidth,
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    // 弹出层显示查看消息
    alertDialog : function(pWidth, pHeight, pTitle, pContent, pCloseLocation,
            isClose) {
        var html = '<div class="dialog" id="dlg">'
                + '  <div class="ui-icon ui-icon-alert" style="margin-top:10px;margin-left:40px;margin-bottom:10px;">'
                + pContent + '  </div>' + '</div>';
        $("#dlg").dialog("close");
        $("#dlg").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            top : $("#center").offset().top + 50,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '关闭',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg").dialog("close");
                    $("#dlg").dialog("destroy");
                    if (isClose || typeof (isClose) == "undefined") {
                        if ($('#submittype').val() == 0) {
                            location.href = pCloseLocation;
                            $('#submittype').val('');
                        }
                    }
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    // 弹出层自动消失
    autoCloss : function(pWidth, pHeight, pTitle, pContent) {
//        var html = '<div class="dialog" id="dlg">'
//                + '  <div class="ui-icon ui-icon-alert" style="margin-top:20px;margin-left:40px;margin-bottom:10px;">'
//                + pContent + '  </div>' + '</div>';
//        $(html).dialog({
//            title : pTitle,
//            modal : true,
//            iconCls : "icon-edit",
//            width : pWidth,
//            height : pHeight,
//            // top :$("#center").offset().top+50,
//            timeout : 1300,
//            close : function(event, ui) {
//                $(this).dialog("destroy"); // 关闭时销毁
//            }
//        });
        var t = 1000; 
        $(".datagrid-mask,.datagrid-mask-msg").hide(); 
        dialog.loadding(320, 120, pContent); 
        
        var timer = window.setInterval(function() { 
            $(".datagrid-mask,.datagrid-mask-msg").hide(); 
            $("#dlg2").dialog("close");
            $("#dlg2").dialog("destroy");
            $("#dlg2").dialog("close");
            $("#dlg2").dialog("destroy");
            $("#dlg3").dialog("close");
            $("#dlg3").dialog("destroy");
            window.clearInterval(timer); // 时间到了清除计时器
        }, t);
    },
    // 弹出层自动消失并且刷新页面
    autoCloss1 : function(pWidth, pHeight, pTitle, pContent, flag,
            pCloseLocation, isClose) {
//        var html = '<div class="dialog" id="dlg">'
//                + '  <div class="ui-icon ui-icon-alert" style="margin-top:20px;margin-left:40px;margin-bottom:10px;">'
//                + pContent + '  </div>' + '</div>';
//        $(html).dialog({
//            title : pTitle,
//            modal : true,
//            iconCls : "icon-edit",
//            width : pWidth,
//            height : pHeight,
//            // top :$("#center").offset().top+50,
//            timeout : 500,
//            close : function(event, ui) {
//                $(this).dialog("destroy"); // 关闭时销毁
//            }
//        });  
        var types=$("#submittype").val();
        if (types != "0" && types!=undefined && types.length!=0 ) { // 是否是提交并继续
            resetFormAndClearValidate(".registerform");  
        }else{
            if (false) {
                $("#dlg2").dialog("close");
                $("#dlg2").dialog("destroy");
                $("#dlg2").dialog("close");
                $("#dlg2").dialog("destroy");
                $("#dlg3").dialog("close");
                $("#dlg3").dialog("destroy");
            } 
            $("#dlg").dialog("close");
            $("#dlg").dialog("destroy"); 
            var timer = window.setInterval(function() {
                if(pContent!=null && pContent.indexOf("成功")==-1)
                    dialog.loadding(320, 120, pContent);
                $(".datagrid-mask,.datagrid-mask-msg").hide(); 
                window.clearInterval(timer); // 时间到了清除计时器
                if (flag) { 
                    if ($("#submittype").val() == "0" || $("#submittype").length==0) { // 是否是提交并继续
                        location.href = pCloseLocation;
                    } else {
                        resetFormAndClearValidate(".registerform");
                    }
                }
            }, 1000);
        }
    },
    autoCloss3 : function(pWidth, pHeight, pTitle, pContent, flag,pCloseLocation) {
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $("#dlg3").dialog("close");
        $("#dlg3").dialog("destroy");            
        $("#dlg").dialog("close");
        $("#dlg").dialog("destroy"); 
        dialog.loadding(320, 120, pContent);
        var timer = window.setInterval(function() {        
            $(".datagrid-mask,.datagrid-mask-msg").hide(); 
            window.clearInterval(timer); // 时间到了清除计时器
            if (flag) 
                location.href = pCloseLocation;
        }, 1000);
    },
    // 修改密码弹出层自动消失
    autoCloss2 : function(pWidth, pHeight, pTitle, pContent) {
        var html = '<div class="dialog" id="dlg">'
                + '  <div class="ui-icon ui-icon-alert" style="margin-top:20px;margin-left:40px;margin-bottom:10px;">'
                + pContent + '  </div>' + '</div>';
        $(html).dialog({
            title : pTitle,
            modal : true,
            iconCls : "icon-warning",
            width : pWidth,
            height : pHeight,
            // top :$("#center").offset().top+50,
            timeout : 500,
            close : function(event, ui) {
                $(this).dialog("destroy"); // 关闭时销毁
            }
        });
        var timer = window.setInterval(function() {
            $("#dlg").dialog("close");
            $("#dlg").dialog("destroy");
            $("#dlg2").dialog("close");
            $("#dlg2").dialog("destroy");
            $("#dlg3").dialog("close");
            $("#dlg3").dialog("destroy");
            window.clearInterval(timer); // 时间到了清除计时器
        }, 2000);
    },
    confirmLock : function(pWidth, pHeight, pTitle, pContent, pId) {
        var html = '<div class="dialog" id="dlg2">'
                + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:60px;margin-bottom:10px;">'
                + pContent + '  </div>' + '</div>';
        $(html).dialog(
                {
                    title : pTitle,
                    modal : true,
                    iconCls : "icon-edit",
                    top : $("#center").offset().top + 50,
                    width : pWidth,
                    buttons : [
                            {
                                text : '确定',
                                id : 'delSure',
                                iconCls : 'icon-ok',
                                handler : function() {
                                    $("#form1").attr(
                                            "action",
                                            $("#form1").attr("action")
                                                    + "/lock/" + pId);
                                    $("#form1").submit();
                                }
                            }, {
                                text : '取消',
                                iconCls : 'icon-cancel',
                                handler : function() {
                                    $("#dlg2").dialog("close");
                                    $("#dlg2").dialog("destroy");
                                }
                            } ],
                    close : function(event, ui) {
                        $(this).dialog("destroy"); // 关闭时销毁
                    }
                });
    },
    viewpermissions:function(pWidth, pHeight, pTitle, pUrl) {        
        var html ='<div id="dlg3" class="easyui-dialog" style="padding: 10px;"></div>';            
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl, 
            iconCls : "icon-save",
            width : pWidth,
            height: pHeight,
            buttons : [{
                text : '关闭',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg3").dialog("close");
                    $("#dlg3").dialog("destroy");                        
                }
            }],
            close: function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    importDialog : function(pWidth, pHeight, pTitle, pUrl, pCloseLocation) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top + 50,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '提交',
                id : 'submit1',
                handler : function() {
                    $('.submit').click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                    if ($('#submittype').val() >= 2) {
                        location.href = pCloseLocation;
                        $('#submittype').val('0');
                    }
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    releaseDialog : function(pWidth, pHeight, pTitle, pUrl) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top + 50,
            iconCls : "icon-save",
            width : pWidth,
            buttons : [ {
                text : '上传并发布',
                id : 'submit1',
                handler : function() {
                    $('.submit').click();
                }
            }, {
                text : '取消',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy");
                }
            } ],
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },
    forgotDialog : function(pWidth, pHeight, pTitle, pUrl) {
        var html = '<div id="dlg2" class="easyui-dialog" style="padding: 10px;"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            top : $("#center").offset().top + 50,
            iconCls : "icon-save",
            width : pWidth,
            close : function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    },loadding : function (pWidth, pHeight, content) {
        $("<div class=\"datagrid-mask\"></div>").css({display:"block",width:"100%",height:$(window).height()}).appendTo("body");
        $("<div class=\"datagrid-mask-msg\"></div>").html(content).appendTo("body")
        .css({display:"block",left:($(document.body).outerWidth(true) - 190) / 2,"z-index":9999,top:($(window).height() - 45) / 2});
    },Lock : function(pContent,ID) {
        var html = '<div class="dialog" id="dlg2" data=\'123123123123123123\'>'
            + '  <div class="ui-icon ui-icon-alert" style="margin-top:30px;margin-left:20px;">'
            +pContent+ '  </div>' + '</div>';
            $("#dlg2").dialog("close");
            $("#dlg2").dialog("destroy");
            $(html).dialog(
            {
                title : '操作提示',
                modal : true,
                iconCls : "icon-edit",
                width : 300,
                height : 150,
                buttons : [
                        {
                            text : '确定',
                            id : 'delSure',
                            iconCls : 'icon-ok',
                            handler : function() {
                                lock(ID);
                            }
                        }, {
                            text : '取消',
                            iconCls : 'icon-cancel',
                            handler : function() {
                                $("#dlg2").dialog("close");
                                $("#dlg2").dialog("destroy");
                            }
                        } ],
                close : function(event, ui) {
                    $(this).dialog("destroy"); // 关闭时销毁
                }
            });
    },
    showFlash:function(pWidth, pHeight, pTitle, pUrl) {        
        var html ='<div id="dlg2" class="easyui-dialog"></div>';
        $("#dlg2").dialog("close");
        $("#dlg2").dialog("destroy");
        $(html).dialog({
            title : pTitle,
            modal : true,
            href : pUrl,
            height:pHeight,
            iconCls : "icon-edit",
            width : pWidth, 
            buttons : [{
                text:'不再提醒',
                id:'submit1',
                handler:function(){ 
                    $('#submit').click();
                }                
            }, {
                text : '关闭',
                iconCls : 'icon-cancel',
                handler : function() {
                    $("#dlg2").dialog("close");
                    $("#dlg2").dialog("destroy"); 
                }
            }],
            close: function(event, ui) {
                $(this).dialog("close");
                $(this).dialog("destroy");
            }
        });
    }
}

转载于:https://my.oschina.net/u/780876/blog/518214

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值