var products = []; var paths =[] var $span = $('.fr-checkbox-checkon'); var $tds = $("td").has($span); var $trs = $("tr").has($tds); //alert($trs.length); for (var i = 0; i < $trs.length; i++) { var row = $("td:eq(0)", $($trs[i])).attr("row"); // alert('row:'+row); products.push(contentPane.getCellValue(2, row)); } // alert(products); var printurl = "http://192.168.3.4:37799/webroot/decision/view/report"; //var printurl = ""; var p = []; if (products.length > 0) { //alert("需打印单据数:" + products.length); var m = products.length - 1; for (var j = 0; j <= products.length - 1; j++) { if (products[j] == ''||products[j] == '单号') { products.remove(''); products.remove('单号'); } //p.push("{reportlet: '/打印测试/吊牌打印A.cpt', DJBH : " + products[j] + "}"); p.push(products[j]); } } else { alert("请选择需要打印的单据"); } // alert(p); var cptpath = "/报表测试/#/测试/商品出库.cpt";
var urlstring = "{reportlet:" + "'" + FR.cjkEncode(cptpath) + "'" + ",DJBH :" + "'" + p +"'}"; paths.push(urlstring);
if(paths.length>0){ //将参数值组成的数组转化为字符串 var rpaths=paths.join(", "); //使用FineReport自带的方法cjkEncode进行转码 var reportlets="["+rpaths+"]"; var config = { printUrl : printurl, printType : 0, // 是否弹出设置窗口,true为弹出,false为不弹出 isPopUp : false, data : {reportlets:reportlets},// 需要打印的模板列表 printType: 0 // 打印类型,0为零客户端打印,1为本地打印 }; FR.doURLPrint(config); } |