帆软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 = $("<iframe id='inp' name='inp' width='100%' height='100%' scrolling='yes' frameborder='0'>");
// 对话框内iframe参数的命名,默认宽高占比是100%,可向下滚动
var url = FR.cjkEncode("${servletURL}?viewlet=文件路径加上.cpt&op=write");
iframe.attr("src", url);
// 给iframe添加src属性
var o = {
	width: 1200, //对话框宽度
	height: 800 //对话框高度
};
FR.showDialog("Import Check", o.width, o.height, iframe, o); //弹出对话框

其他.获取复选按钮控件数据:

在这里插入代码片
var $span = $(".fr-checkbox-checkon");  //获取选中的复选框
var darray = [];
var array = [];
var $tds = $("td").has($span);          //获得选中复选框的单元格
var len = $tds.length;
for (var i = 0; i < len; i ++) {          //遍历选中的单元格
   var id = $($tds[i]).attr("id");        //给选中的单元格增加id属性
   if (id) {
   	var rownum =contentPane.curLGP.getTDRow($tds[i])-1;
   	var wjid=contentPane.getCellValue(1,rownum);
     array.push(wjid);
     darray.push(id);
   	}
}
var arr=array.join("','");
contentPane.setCellValue(6,0,arr);
  • 0
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值