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");
            }
        });
    }
}
相關文章
相關標籤/搜索