You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.9 KiB
JavaScript

/// <reference path="../Scripts/jquery.min.js" />
/// <reference path="../Scripts/jquery.easyui.min.js" />
WindowLoad = function () {
this.ApplicationPath = "";
this.ControlID = "Window_Load";
this.ParentElement = null; //要加入的父容器
this.Isbgiframe = false;
this.IsShowInit = false;
var My = this;
var txtTitle = "";
//#region 加载
this.Load = function () {
Init();
}
//#endregion
//#region 初始化
function Init() {
if (My.ParentElement == null) My.ParentElement = $(document.body);
if ($("#" + My.ControlID, My.ParentElement).length > 0) return;
txtTitle = My.ControlID + "_txtTitle";
var htmlString = new Sys.StringBuilder();
htmlString.append("<div id='" + My.ControlID + "' class='easyui-window' style='width: 300px; height: 100px;' closed='true' modal='true' collapsible='false' minimizable='false' maximizable='false' title='提示'>");
htmlString.append("<table border='0' cellpadding='0' cellspacing='0' style='height: 100%; width: 100%'>");
htmlString.append("<tr>");
htmlString.append("<td style='text-align: center; vertical-align: middle;'><img src='" + My.ApplicationPath + "themes/default/images/tree_loading.gif' /><br /><span id='" + txtTitle + "'>请稍候....</span></td>");
htmlString.append("</tr>");
htmlString.append("</table>");
htmlString.append("</div>");
My.ParentElement.append(htmlString.toString());
$("#" + My.ControlID, My.ParentElement).window();
if (My.Isbgiframe == true) $("#" + My.ControlID, My.ParentElement).window("window").bgiframe();
}
//#endregion
//#region 设置提示消息
this.SetTitle2 = function (title, msg) {
$("#" + txtTitle, My.ParentElement).window("setTitle", title);
$("#" + txtTitle, My.ParentElement).text(msg);
}
//#endregion
//#region 设置提示消息
this.SetTitle = function (msg) {
$("#" + txtTitle, My.ParentElement).text(msg);
}
//#endregion
//#region 设置提示内容
this.SetContent = function (content) {
$("#" + My.ControlID, My.ParentElement).html(content);
}
//#endregion
//#region 恢复
function Comeback() {
var htmlString = new Sys.StringBuilder();
htmlString.append("<table border='0' cellpadding='0' cellspacing='0' style='height: 100%; width: 100%'>");
htmlString.append("<tr>");
htmlString.append("<td style='text-align: center; vertical-align: middle;'><img src='" + My.ApplicationPath + "themes/default/images/tree_loading.gif' /><br /><span id='" + txtTitle + "'>请稍候....</span></td>");
htmlString.append("</tr>");
htmlString.append("</table>");
$("#" + My.ControlID, My.ParentElement).html(htmlString.toString());
}
//#endregion
//#region 显示
this.Show = function () {
if (My.IsShowInit == true) { Comeback(); }
else { $("#" + txtTitle, My.ParentElement).text("请稍候...."); }
$("#" + My.ControlID, My.ParentElement).window("open");
}
//#endregion
//#region 隐藏
this.Hide = function () {
$("#" + My.ControlID, My.ParentElement).window("close");
}
//#endregion
}