帆软FineReport我常用的参数及JavaScript

一、简单的参数
1.条件参数

${if(len(area)=0,""," and area in ('"+area+"')")} 

2.用户名参数

username = '${fine_username}'

3.引用数据集校验

INARRAY(C4, area.SELECT(area_chn)) > 0

4.数据库查询引用参数

if(flag){
	var sql ="sql(\"SMIL\",\"delete from [table] where username= '"+username+"'\",1,1)"
	alert("删除成功!")
	FR.remoteEvaluate(sql);
}
帆软版:
$(".fr-core-btn-text:contains(确定)").html("删除");
$(".fr-core-btn-text:contains(取消)").html("不删除").css({"letter-spacing":"0px","text-indent":"0px"});

FR.Msg.confirm("提示", "确定要删除吗?", function(value) {
	if (value) {
		var sql ="sql(\"SMIL\",\"delete from [table] where DATEDIFF(mm,[month],getdate())=0 and operator= '"+username+"'\",1,1)"
		FR.remoteEvaluate(sql);
		FR.Msg.alert("提示", "删除成功!", function() {
			location.reload();
		});	     
	}
})

二、全局操作函数
1.全局提交

_g().parameterCommit()

2.隐藏参数界面的三角按钮

$('.parameter-container-collapseimg-up').remove();

3.填报页面选中框的颜色

$('.fDright').css('background', '#ADD8E6'); 
$('.fDbottom').css('background', '#ADD8E6');
$('.fDtop').css('background', '#ADD8E6'); 
$('.fDleft').css('background', '#ADD8E6');

4.鼠标跟随–鼠标悬浮变色

var background_color = "#ADD8E6"; //新背景色
var frozen_back_color = new Array();
var back_color = new Array();
var $last_tr;
var i = 0;
$(".x-table tr:gt(1)").bind("mouseenter", function () {
if (typeof($last_tr) != "undefined") {
if (typeof($(this).attr("id")) != "undefined") {
if (typeof($("#content-container #frozen-west").attr("id")) != "undefined") {
$("#content-container #" + $last_tr.attr("id")).each(function () {
$(this).children("td").each(function () {
$(this).css("background-color", frozen_back_color[i][$(this).index()]);
});
i = i + 1;
});
i = 0;
} else {
$last_tr.children("td").each(function () {
$(this).css("background-color", back_color[$(this).index()]);
});
}
frozen_back_color = [];
back_color = [];
}
}
if (typeof($(this).attr("id")) != "undefined") {
if (typeof($("#content-container #frozen-west").attr("id")) != "undefined") {
$("#content-container #" + $(this).attr("id")).each(function () {
frozen_back_color[i] = new Array();
$(this).children("td").each(function () {
frozen_back_color[i][$(this).index()] = $(this).css("background-color");
$(this).css("background-color", background_color);
});
i = i + 1;
});
i = 0;
} else {
$(this).children("td").each(function () {
back_color[$(this).index()] = $(this).css("background-color");
$(this).css("background-color", background_color);
});
}
}
});
$(".x-table tr:gt(1)").bind("mouseleave", function () {
if (typeof($(this).attr("id")) != "undefined") {
$last_tr = $(this);
}
});

三、自定义工具栏相关
1 .自定义导出模板(文件路径获取方法:网页预览报表)

参数:aaa=sessionID
window.location.href=
"文件路径加上
?op=export&format=excel&extype=simple&sessionID="+aaa

2.submit按钮接口

FR.Msg.confirm("提示", "确定要删除数据吗?", function(value) {
	if (value) {
		contentPane.setCellValue(col, row, "0");
		_g().verifyAndWriteReport();
	} else {
		contentPane.setCellValue(col, row, "1");
		_g().verifyAndWriteReport();
	}
})

3.填报提交回填函数设置:

if (fr_submitinfo.success) {
	FR.Msg.alert("Reminder", "Submitted successfully", function() {
	a.reset();
     });
} else {
	FR.Msg.alert("Warning", "The submission failure error message is:" + fr_submitinfo.failinfo, function() {
	a.reset();
     });
}

4.提交后打开新的报表

var iframe = $("