function paramToString(v) {
return v == null ? null : v.toString();
}
function main(spreadsheetReport, ruleName, params) {
debugger;
if (ruleName != "根据参数跳转") return;
var value = spreadsheetReport.getParameterValue("产品大类名称");
// 判断当前参数值,跳转到不同的报表
if (value == "饮料") {
jump_role1(spreadsheetReport, ruleName, params);
} else if (value == "调味品"){
jump_role2(spreadsheetReport, ruleName, params);
} else {
alert("当前参数值不能跳转到任何报表!");
}
};
// 如果当前参数值是饮料,则跳转到报表1
function jump_role1(spreadsheetReport, ruleName, params) {
var paramsInfo = [];
//paramsInfo.push({ name:"产品名称",value:paramToString(params[0]),displayValue:paramToString(params[0])});
//@smartbi.openOtherPage:"I402881eb0c9787c2014f8c9fb57300a5"
//新窗口打开
//openURL("openresource.jsp?resid=I40288253015803c503c590e5015803fc00350218&showtoolbar=true&refresh=true", [{name:"paramsInfo",value: lang.toJSONString(paramsInfo)}])
//覆盖当前资源
var command = spreadsheetReport.command;
command.close();
//@smartbi.openOtherPage:"I40288253015803c503c590e5015804933a850628"
command.execute('OPENWITHNOREFRESH', 'I4028b881015ecb42cb42853d015ecbb0ed820042');
var report = command.spreadsheetReport;
if (paramsInfo.length > 0) report.setParamsInfo(paramsInfo);
report.doRefresh();
};
// 如果当前参数值是调味品,则跳转到报表2
function jump_role2(spreadsheetReport, ruleName, params) {
var paramsInfo = [];
//paramsInfo.push({ name:"产品大类名称",value:paramToString(params[0]),displayValue:paramToString(params[0])});
//@smartbi.openOtherPage:"I402881eb0c9787c2014f8ca0925c00e7"
//openURL("openresource.jsp?resid=I4028b881015fe2dbe2db21df015fe2f7c6c7019c&showtoolbar=true&refresh=true", [{name:"paramsInfo",value: lang.toJSONString(paramsInfo)}])
//覆盖当前资源
var command = spreadsheetReport.command;
command.close();
//@smartbi.openOtherPage:"I4028b881015fe2dbe2db21df015fe36107450452"
command.execute('OPENWITHNOREFRESH', 'I4028b881015fe2dbe2db21df015fe36107450452');
var report = command.spreadsheetReport;
if (paramsInfo.length > 0) report.setParamsInfo(paramsInfo);
report.doRefresh();
};