You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.9 KiB
111 lines
2.9 KiB
//弹出窗口方法 url为页面地址加所需的参数
|
|
function popWin(url){
|
|
$("#myModal").modal(
|
|
{
|
|
backdrop : 'static',
|
|
keyboard : false,
|
|
remote : url
|
|
});
|
|
}
|
|
//弹出窗口显示时所执行的方法
|
|
function winShow(function_name){
|
|
$("#myModal").on("shown.bs.modal", function() {
|
|
if (function_name!=""&&function_name!=null&&typeof(function_name)!="undefined"){
|
|
eval(function_name);
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
//弹出窗口隐藏时所执行的方法
|
|
function winHidden(function_name){
|
|
$("#myModal").on("hidden.bs.modal", function() {
|
|
if (function_name!=""&&function_name!=null&&typeof(function_name)!="undefined"){
|
|
desktop.window.eval(function_name);
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
function hideWin(){
|
|
$('#myModal').modal('hide');
|
|
}
|
|
//不缓存页面数据,隐藏后清除
|
|
$(document).ready(function(){
|
|
$("#myModal").on("hidden.bs.modal", function() {
|
|
$(this).removeData("bs.modal");
|
|
$(".modal-content").empty();
|
|
});
|
|
});
|
|
//提示框
|
|
function customAlertTip(title,text,type){
|
|
swal(title, text, type);
|
|
}
|
|
//提示框带回调
|
|
function customAlertWithCallBack(title,text,type,function_name){
|
|
swal({
|
|
title : title,
|
|
text : text,
|
|
type : type,
|
|
closeOnConfirm : true,
|
|
}, function() {
|
|
desktop.window.eval(function_name);
|
|
}
|
|
);
|
|
}
|
|
//带确认的提示框
|
|
function customAlertQuery(title,text,type,yesBtnText,noBtnText,function_confirm,function_cancel){
|
|
swal({
|
|
title : title,
|
|
text : text,
|
|
type : type,
|
|
showCancelButton : true,
|
|
confirmButtonClass : "btn-danger",
|
|
confirmButtonText : yesBtnText,
|
|
cancelButtonText : noBtnText,
|
|
closeOnConfirm : false,
|
|
closeOnCancel : true
|
|
}, function(isConfirm) {
|
|
if (isConfirm) { //确定
|
|
desktop.window.eval(function_confirm);
|
|
} else { //取消
|
|
desktop.window.eval(function_cancel);
|
|
}
|
|
});
|
|
}
|
|
|
|
//带确认的提示框,点确认后关闭
|
|
function customAlertQueryClose(title,text,type,yesBtnText,noBtnText,function_confirm,function_cancel){
|
|
swal({
|
|
title : title,
|
|
text : text,
|
|
type : type,
|
|
showCancelButton : true,
|
|
confirmButtonClass : "btn-danger",
|
|
confirmButtonText : yesBtnText,
|
|
cancelButtonText : noBtnText,
|
|
closeOnConfirm : true,
|
|
closeOnCancel : true
|
|
}, function(isConfirm) {
|
|
if (isConfirm) { //确定
|
|
desktop.window.eval(function_confirm);
|
|
} else { //取消
|
|
desktop.window.eval(function_cancel);
|
|
}
|
|
});
|
|
}
|
|
//从远端的数据源加载完数据之后触发该事件
|
|
function winShowBefore(function_name){
|
|
$("#myModal").on("loaded.bs.modal", function() {
|
|
if (function_name!=""&&function_name!=null&&typeof(function_name)!="undefined"){
|
|
eval(function_name);
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
function remoteUrl(u){
|
|
var t = new Date().getTime();
|
|
u += "&t="+t;
|
|
$.get(u, '', function(data){
|
|
$('#myModal .modal-content').html(data);
|
|
})
|
|
$('#myModal').modal({show:true,backdrop:'static',keyboard : false});
|
|
} |