if($ == undefined){ $ = jQuery; } var fmtJson = [{ "text":"整数", "value":"#,##0" },{ "text":"小数(保留一位)", "value":"#,##0.0" },{ "text":"小数(保留两位)", "value":"#,##0.00" },{ "text":"小数(保留四位)", "value":"#,##0.0000" },{ "text":"百分比", "value":"#,##0.00%" }]; var kpirate = [{ "text":"1", "value":"1" },{ "text":"千", "value":"1000" },{ "text":"万", "value":"10000" },{ "text":"百万", "value":"1000000" },{ "text":"亿", "value":"100000000" }]; var colorJson = [{ "text":"无", "value":"" },{ "text":"黑色", "value":"#000000" },{ "text":"白色", "value":"#FFFFFF" },{ "text":"红色", "value":"#FF0000" },{ "text":"鲜绿色", "value":"#00FF00" },{ "text":"蓝色", "value":"#0000FF" },{ "text":"黄色", "value":"#FFFF00" },{ "text":"粉红色", "value":"#FF00FF" },{ "text":"青绿色", "value":"#00FFFF" },{ "text":"深红色", "value":"#800000" },{ "text":"绿色", "value":"#008000" },{ "text":"深蓝色", "value":"#000080" },{ "text":"深黄色", "value":"#808000" },{ "text":"紫罗兰", "value":"#800080" },{ "text":"青色", "value":"#008080" },{ "text":"灰-25%", "value":"#C0C0C0" },{ "text":"灰-50%", "value":"#808080" },{ "text":"海螺色", "value":"#9999FF" },{ "text":"梅红色", "value":"#993366" },{ "text":"象牙色", "value":"#FFFFCC" },{ "text":"浅青绿", "value":"#CCFFFF" },{ "text":"深紫色", "value":"#660066" },{ "text":"珊瑚红", "value":"#FF8080" },{ "text":"海蓝色", "value":"#0066CC" },{ "text":"冰蓝", "value":"#CCCCFF" },{ "text":"深蓝色", "value":"#000080" },{ "text":"粉红色", "value":"#FF00FF" },{ "text":"黄色", "value":"#FFFF00" },{ "text":"青绿色", "value":"#00FFFF" },{ "text":"紫罗兰", "value":"#800080" },{ "text":"深红色", "value":"#800000" },{ "text":"青色", "value":"#008080" },{ "text":"蓝色", "value":"#0000FF" },{ "text":"天蓝色", "value":"#00CCFF" },{ "text":"浅青绿", "value":"#CCFFFF" },{ "text":"浅绿色", "value":"#CCFFCC" },{ "text":"浅黄色", "value":"#FFFF99" },{ "text":"淡蓝色", "value":"#99CCFF" },{ "text":"玫瑰红", "value":"#FF99CC" },{ "text":"淡紫色", "value":"#CC99FF" },{ "text":"茶色", "value":"#FFCC99" },{ "text":"浅蓝色", "value":"#3366FF" },{ "text":"水绿色", "value":"#33CCCC" },{ "text":"酸橙色", "value":"#99CC00" },{ "text":"金色", "value":"#FFCC00" },{ "text":"浅橙色", "value":"#FF9900" },{ "text":"橙色", "value":"#FF6600" },{ "text":"蓝-灰", "value":"#666699" },{ "text":"灰-40%", "value":"#969696" },{ "text":"深青", "value":"#003366" },{ "text":"海绿", "value":"#339966" },{ "text":"深绿", "value":"#003300" },{ "text":"橄榄色", "value":"#333300" },{ "text":"褐色", "value":"#993300" },{ "text":"梅红色", "value":"#993366" },{ "text":"靛蓝色", "value":"#333399" },{ "text":"灰-80%", "value":"#333333" }]; function flushPage(){ for(var k=0; curTmpInfo.comps&&k', buttons:[{ text:'确定', iconCls:"icon-ok", handler:function(){ if(state == 'insert'){ var txt = $("#txtctx").val(); var obj = {"id":newGuid(), type:'text', name:"文本", desc:txt}; var str = addComp(obj, layoutId, true); $("#layout_"+layoutId).append(str.replace(/\n/g,"
")); //移动滚动条 $("#optarea").scrollTop($("#c_"+obj.id).offset().top); //注册拖放事件 bindCompEvent(obj); bindResizeEvent(obj.id, 'text'); } if(state == 'update'){ var txt = $("#txtctx").val(); var comp = findCompById(compId); comp.desc = txt; $("#c_"+compId+" div.cctx").html(txt.replace(/\n/g,"
")); } //更新页面为已修改 curTmpInfo.isupdate = true; $('#pdailog').dialog('close'); } },{ text:'取消', iconCls:"icon-cancel", handler:function(){ $('#pdailog').dialog('close'); } }] }); if(state == 'update'){ var comp = findCompById(compId); $("#txtctx").val(comp.desc); } $("#txtctx").focus(); } //根据ispush来判断是否把组件放入JSON对象中 function addComp(comp, layoutId, ispush){ var json = comp; var layout = findLayoutById(layoutId); if(ispush){ if(!layout.children){ layout.children = []; } layout.children.push(json); if(!curTmpInfo.comps){ curTmpInfo.comps = []; } curTmpInfo.comps.push(json); } //生成文本组件的样式 var textcss = ""; if(json.style){ var sty = json.style; if(json.style.talign && json.style.talign != '' && json.type != 'input'){ //input类型的 talign 特殊处理 textcss = textcss +"text-align:"+json.style.talign+";"; } if(json.style.tfontsize && json.style.tfontsize != ''){ textcss = textcss + "font-size:"+json.style.tfontsize+"px;"; } if(json.style.tfontcolor && json.style.tfontcolor != ''){ textcss = textcss + "color:"+json.style.tfontcolor+";"; } if(sty.tfontweight && sty.tfontweight=="true"){ textcss = textcss + "font-weight:bold;"; } if(sty.titalic && sty.titalic == "true"){ textcss = textcss + "font-style:italic;"; } if(sty.tunderscore && sty.tunderscore == 'true'){ textcss = textcss + "text-decoration: underline;"; } if(sty.tbgcolor && sty.tbgcolor != '' ){ textcss = textcss + "background-color:"+sty.tbgcolor+";"; } //判断input类型的 theight if(sty.theight && sty.theight != '' && json.type == 'input'){ textcss = textcss + "height:"+sty.theight+"px;"; } } textcss = textcss + "padding:3px;"; //设置组件padding为 3 if(json.type == "box" && json.bgcolor && json.bgcolor!=""){ textcss = textcss + "background-color:"+json.bgcolor+";"; } if((json.type == "box" || json.type == "text") && json.height ){ textcss = textcss + "height:"+(json.height + 8)+"px;"; //加上padding } var str = "
"+json.name+"
"+"
"; if(json.type == 'text'){ str = str + comp.desc.replace(/\n/g,"
") }else if(json.type == "table"){ var ret = "
(点击按钮配置交叉表)
"; str = str + ret; }else if(json.type == "chart"){ var ret = "
(点击按钮配置图形)
"; str = str + ret; }else if(json.type == 'grid'){ var ret = "
(点击按钮配置表格)
"; str = str + ret; }else if(json.type == "box"){ var ret = "
(点击按钮配置数据块)
"; str = str + ret; } str = str + "
"; return str; } function showcompmenu(ts, layoutId, compId){ var offset = $(ts).offset(); var divId = ""; var comp = findCompById(compId); if(comp.type == "chart"){ divId = "chart_menu"; }else if(comp.type == "table"){ divId = "table_menu"; }else if(comp.type == "text"){ divId = "text_menu"; }else if(comp.type == "grid"){ divId = "grid_menu"; }else if(comp.type == "box"){ divId = "box_menu"; } curTmpInfo.layoutId = layoutId; curTmpInfo.compId = compId; $("#" + divId).menu("show", {left:offset.left, top:offset.top + 20}); } function bindResizeEvent(compId, tp){ var max, min; if(tp == "chart"){ max = 900,min = 150; }else if(tp == "box"){ max = 500, min = 30; }else if(tp == "table" || tp == "grid"){ max = 900, min = 60; }else if(tp == "text"){ max = 600, min = 30; }else if(tp == "pic"){ max = 2000, min = 30; }else{ max = 2000, min = 30; } $("#c_"+compId+" .cctx").myresizable({ handleSelector: "> .win-size-grip", resizeWidth: false, resizeHeight: true, resizeHeightFrom: 'bottom', onDrag:function(e, $el, opt){ if(tp == "box"){ $el.find(".boxcls").css("line-height", $el.height() + "px"); } }, onDragEnd:function(e, $el, newWidth, newHeight, opt){ var c = findCompById(compId); var h = Math.round($el.height()); if(c.type == "chart"){ c.chartJson.height = h; //设置图像高度 var o = document.getElementById('C'+compId); if(o){ var chart = echarts.getInstanceByDom(o); if(chart){ $("#C"+compId).height((h)+"px"); chart.resize("auto", "auto"); } } }else if(c.type == 'mbox'){ c.height = h; $("#c_"+compId+" .ccctx table.data-t").animate({"height": c.height+"px"}); }else if(c.type == "box"){ if(c.chart || c.thbDim || c.progressBar){ c.height = h - 60; }else{ c.height = h; } $el.find(".boxcls").css({"line-height": c.height + "px", "height":c.height+"px"}); }else if(c.type == "table"){ var headHeight = $("#c_"+compId+" div.lock-dg-header table.lockgrid").height(); //表头高度 c.height = h - headHeight; //减去 表头距离 $("#c_"+compId+" .lock-dg-body").animate({"height":c.height+"px"}); }else if(c.type == "grid"){ var headHeight = $("#c_"+compId+" div.lock-dg-header table.lockgrid").height(); //表头高度 var fyHeight = $("#c_"+compId+" div.pagesizeinfo").height() + 6; //分页高度 (padding:6px) h = Math.round(h - Math.round(headHeight) - (c.isnotfy =="true" ? 0 : Math.round(fyHeight))); //减去表头距离, 分页距离 $("#c_"+compId+" .lock-dg-body").animate({"height": h+"px"}); c.height = h; }else if(c.type == "text"){ c.height = h; }else if(c.type == "pic"){ if(c.height && c.width){ //图片存在宽度和高度,需要在拖动后重新定义 c.width = Math.round(c.width * h / c.height); } c.height = h; $("#c_"+compId+" .cctx img").animate({"height": (c.height)+"px","width":c.width}); } curTmpInfo.isupdate = true; } }); } function bindCompEvent(obj){ //注册移动事件 $("#c_" + obj.id).draggable({ revert:true, handle:$("#c_" + obj.id + " .ibox-title"), delay:180, proxy:function(source){ var width = $(source).width(); var height = $(source).height(); var p = $('
'+obj.name+'
'); p.appendTo('body'); return p; }, onStartDrag:function(e){ resetWindows('min'); $(this).hide(); }, onStopDrag:function(e){ $(".indicator").hide(); resetWindows('max'); $(this).show(); } }); $("#c_" + obj.id).droppable({ accept:"div.ibox, #comp_tree .tree-node", onDragEnter:function(e,source){ curTmpInfo.id = $(this).attr("id"); curTmpInfo.tp = "before"; curTmpInfo.mouseOnDiv = true; $(".indicator").css({ display:'block', left:$(this).offset().left, top:$(this).offset().top - 10 }); e.cancelBubble=true; e.stopPropagation(); //阻止事件冒泡 }, onDragLeave:function(e,source){ curTmpInfo.mouseOnDiv = false; var obj = $(this).parent(); var last = obj.children().last(); if(last.attr("id") == $(source).attr("id")){ last = last.prev(); } if(last.size() == 0){ $(".indicator").css({ display:'block', left:obj.offset().left, top:obj.offset().top - 10 }); }else{ curTmpInfo.id = last.attr("id"); curTmpInfo.tp = "after"; $(".indicator").css({ display:'block', left:last.offset().left, top:last.offset().top + last.height() }); } e.cancelBubble=true; e.stopPropagation(); //阻止事件冒泡 }, onDrop:function(e,source){ e.cancelBubble=true; e.stopPropagation(); //阻止事件冒泡 } }); } function editComp(layoutId, compId){ if(!layoutId){ layoutId = curTmpInfo.layoutId; } if(!compId){ compId = curTmpInfo.compId; } $('#Jlayout').layout("remove", "east"); var comp = findCompById(compId); if(comp.type == "text"){ insertText("update", layoutId, compId); }else if(comp.type == "table"){ editTableData(compId); }else if(comp.type == "chart"){ editChartData(compId, layoutId); }else if(comp.type == 'input'){ editInputData(comp); }else if(comp.type == 'grid'){ editGridData(compId); }else if(comp.type == "box"){ editBoxData(compId); } } function setComp(layoutId, compId){ if(!layoutId){ layoutId = curTmpInfo.layoutId; } if(!compId){ compId = curTmpInfo.compId; } $('#Jlayout').layout("remove", "south"); var comp = findCompById(compId); if(comp.type == "text"){ setTextProperty(comp); }else if(comp.type == "table"){ setTableProperty(comp); }else if(comp.type == "chart"){ setChartProperty(comp); }else if(comp.type == 'input'){ setInputProperty(comp); }else if(comp.type == "grid"){ setGridProperty(comp); }else if(comp.type == "box"){ setBoxProperty(comp); } } function editTableData(compId){ if($("#dataProperty").size() == 0){ $('#Jlayout').layout('add', {region:"south", id:"dataProperty", split:false, collapsible:false,height : 120, title:'编辑交叉表数据', tools:[{ iconCls:'icon-cancel', handler:function(){ $('#Jlayout').layout("remove", "south"); } }]}); }else{ $('#Jlayout').layout('panel', "south").panel("setTitle", "编辑交叉表数据"); } //切换选项卡到立方体 $("#comp_tab").tabs("select", 1); var comp = findCompById(compId); var str = ""; for(var i=0; comp.rows&&i"+comp.rows[i].dimdesc+"
"; } for(var i=0; comp.kpiJson&&i"+comp.kpiJson[i].kpi_name+"
"; } if(str == ""){ str = "
拖拽立方体维度或度量到此处作为交叉表的字段
"; }else{ str = "交叉表字段:" + str + ""; } var colstr = ""; for(var i=0; comp.cols&&i"+o.dimdesc+"
"; } if(colstr != ''){ colstr = "     列字段:" + colstr + ""; } var ctx = "
"+str + colstr +"
"; $("#dataProperty").html(ctx); //注册接收度量及维度拖放事件 $("#tableData").droppable({ accept:"#datasettree .tree-node", onDragEnter:function(e,source){ var node = $("#datasettree").tree("getNode", source); var tp = node.attributes.col_type; //对维度拖拽设置图标 $(source).draggable('proxy').find("span").removeClass("tree-dnd-no"); $(source).draggable('proxy').find("span").addClass("tree-dnd-yes"); $("#tableData").css("border", "1px solid #ff0000"); e.cancelBubble=true; e.stopPropagation(); //阻止事件冒泡 }, onDragLeave:function(e,source){ $(source).draggable('proxy').find("span").addClass("tree-dnd-no"); $(source).draggable('proxy').find("span").removeClass("tree-dnd-yes"); $("#tableData").css("border", "1px dotted #666"); e.cancelBubble=true; e.stopPropagation(); //阻止事件冒泡 }, onDrop:function(e,source){ var id = compId var json = findCompById(id); e.cancelBubble=true; e.stopPropagation(); //阻止事件冒泡 //清除边框颜色 $("#tableData").css("border", "1px dotted #666"); //获取TREE var node = $("#datasettree").tree("getNode", source); //判断拖入的维度及度量是否和以前维度及度量在同一个表。 if(json.cubeId != undefined){ if(json.cubeId != node.attributes.cubeId){ msginfo("您拖入的"+ (node.attributes.col_type == 2 ? "度量" : "维度") +"与组件已有的内容不在同一个数据表中,拖放失败。"); return; } }else{ json.cubeId = node.attributes.cubeId; json.dsetId = node.attributes.dsetId; json.dsid = node.attributes.dsid; } if(!json.kpiJson){ json.kpiJson = []; }; if(!json.cols){ json.cols = []; } if(!json.rows){ json.rows = []; } //写度量 if(node.attributes.col_type == 2){ //如果度量存在就忽略 if(!kpiExist(node.attributes.col_id, json.kpiJson)){ json.kpiJson.push({"kpi_id":node.attributes.col_id, "kpi_name" : node.text, "col_name":node.attributes.col_name, "aggre":node.attributes.aggre, "fmt":node.attributes.fmt, "alias":node.attributes.alias,"tname":node.attributes.tname,"unit":node.attributes.unit,"rate":node.attributes.rate}); }else{ msginfo("度量已经存在。"); return; } //添加字段 var str = ""+node.text+"
"; var obj = $("#tableData"); if(obj.find("#tabRows").size() == 0){ obj.html("交叉表字段:"+str+""); }else{ if($("#tableData #tabRows").find("span.col").size() == 0){ $("#tableData #tabRows").append(str); }else{ $("#tableData #tabRows").find("span.col").last().after(str); } } curTmpInfo.isupdate = true; tableView(json, id); } //写维度 if(node.attributes.col_type == 1){ //写row维度 //if($(this).attr("id") == "d_rowDims"){ if(!dimExist(node.attributes.col_id, json.rows) && !dimExist(node.attributes.col_id, json.cols)){ json.rows.push({"id":node.attributes.col_id, "dimdesc" : node.text, "type":node.attributes.dim_type, "colname":node.attributes.col_name,"tname":node.attributes.tname,"iscas":node.attributes.iscas, "tableName":node.attributes.tableName, "tableColKey":node.attributes.tableColKey,"tableColName":node.attributes.tableColName, "dimord":node.attributes.dimord, "dim_name":node.attributes.dim_name,"grouptype":node.attributes.grouptype,"valType":node.attributes.valType,"ordcol":node.attributes.ordcol,"alias":node.attributes.alias,"calc":node.attributes.calc}); }else{ msginfo("维度已经存在。"); return; } //添加字段 var str = ""+node.text+"
"; var obj = $("#tableData"); if(obj.find("#tabRows").size() == 0){ obj.html("交叉表字段:"+str+""); }else{ if($("#tableData #tabRows").find("span.dimcol").size() == 0){ $("#tableData #tabRows").find("b").after(str); }else{ $("#tableData #tabRows").find("span.dimcol").last().after(str); } } curTmpInfo.isupdate = true; tableView(json, id); //} } } }); } //从交叉表JSON中删除KPI function delJsonKpiOrDim(tp){ var id = curTmpInfo.ckid; var compId = curTmpInfo.compId; var comp = findCompById(compId); var pos = curTmpInfo.pos; if(tp == 'kpi'){ var kpis = comp.kpiJson; var idx = -1; for(var i=0; i拖拽立方体维度或度量到此处作为交叉表的字段"); //$("#c_"+compId+" .cctx").html(""); } } } curTmpInfo.isupdate = true; tableView(comp, compId); } function setTableProperty(comp){ if($("#compSet").size() == 0){ $('#Jlayout').layout('add', {region:"east", split:false, width:240, title:"交叉表属性配置", collapsible:false, id:"compSet", tools:[{ iconCls:'icon-cancel', handler:function(){ $('#Jlayout').layout("remove", "east"); } }]}); }else{ $('#Jlayout').layout('panel', "east").panel("setTitle", "交叉表属性配置"); } if(!comp.style){ comp.style = {}; } var s = comp.style; $('#compSet').propertygrid({ showGroup:true, border:false, showHeader:false, scrollbarSize: 0, fitColumns:false, onAfterEdit: function(rowIndex,rowData,changes){ var val = rowData.value; var col = rowData.col; curTmpInfo.isupdate = true; if(col == "name"){ comp.name = val; $("#c_"+comp.id + " div.ctit h5").text(val); }else if(col == "showtitle"){ comp.showtitle = val; }else if(col == "lockhead"){ comp[col] = val; tableView(comp, comp.id); } }, data:[ {name:'交叉表标题',col:'name', value:(comp.name?comp.name:""), group:'交叉表属性', editor:'text'}, {name:'是否显示标题',col:'showtitle', value:(comp.showtitle?comp.showtitle:"true"), group:'交叉表属性', editor:{ type:"checkbox", options:{"on":true, "off":false} }}, {name:"交叉表下钻",col:"xxx",value:"",group:"交叉表属性"} ] }); } function crossdrill(compId){ var comp = findCompById(compId); if(comp.rows.length != 1){ msginfo("交叉表行标签只有一个维度的时候才能配置交叉表钻取。"); return; } var dd; if(!comp.drillDim){ comp.drillDim = []; }else{ dd = comp.drillDim[0]; } var dims = null; var s = ""; $.ajax({ type:"post", url:"../bireport/queryDims.action", data: {cubeId: comp.cubeId}, dataType:"json", async:false, success: function(resp){ dims = resp; for(k=0; k"+name+""; } } }); var findDim = function(alias){ var ret = null; for(k=0; k当前交叉表行维度:"+row.dimdesc+"
钻取维度:"; $('#pdailog').dialog({ title: "交叉表钻取配置", width: 310, height: 200, closed: false, cache: false, modal: true, content:ctx, buttons:[{ text:'确定', iconCls:"icon-ok", handler:function(){ var dimid = $("#pdailog #drillDim").val(); if(dimid == ''){ delete comp.drillDim; }else{ var dim = findDim(dimid); comp.drillDim[0] = {name:dim.dim_desc,code:dim.alias,type:dim.dim_type,tableColKey:dim.tableColKey,tableColName:dim.tableColName,dimord:dim.dim_ord,colname:dim.col_name,tname:dim.tname,calc:dim.calc}; } tableView(comp, comp.id); curTmpInfo.isupdate = true; $('#pdailog').dialog("close"); } },{ text:'取消', iconCls:"icon-cancel", handler:function(){ $('#pdailog').dialog("close"); } }] }); } function setTextProperty(comp){ if($("#compSet").size() == 0){ $('#Jlayout').layout('add', {region:"east", split:false, width:240, title:"文本属性配置", collapsible:false, id:"compSet", tools:[{ iconCls:'icon-cancel', handler:function(){ $('#Jlayout').layout("remove", "east"); } }]}); }else{ $('#Jlayout').layout('panel', "east").panel("setTitle", "文本属性配置"); } if(!comp.style){ comp.style = {}; } s = comp.style; $('#compSet').propertygrid({ showGroup:true, border:false, showHeader:false, scrollbarSize: 0, fitColumns:false, onAfterEdit: function(rowIndex,rowData,changes){ var val = rowData.value; var col = rowData.col; curTmpInfo.isupdate = true; if(col == "name"){ comp.name = val; $("#c_"+comp.id + " div.ctit h5").text(val); }else if(col == "showtitle"){ comp.showtitle = val; }else{ comp.style[col] = val; var o = $("#c_"+comp.id+" .cctx"); if(col == "tfontsize"){ if(val == ''){ o.css("font-size", "inherit"); }else{ o.css("font-size", val+"px"); } }else if(col == "talign"){ o.css("text-align", val); }else if(col == "tfontcolor"){ o.css("color", val); }else if(col == "tfontweight"){ if(val == "true"){ o.css("font-weight", "bold"); }else{ o.css("font-weight", "normal"); } }else if(col == "titalic"){ if(val == "true"){ o.css("font-style","italic"); }else{ o.css("font-style","normal"); } }else if(col == "tunderscore"){ if(val == "true"){ o.css("text-decoration","underline"); }else{ o.css("text-decoration","inherit"); } }else if(col=="tbgcolor"){ if(val == ""){ o.css("background-color", "inherit"); }else{ o.css("background-color", val); } } } }, data:[ {name:'是否显示标题',col:'showtitle', value:(comp.showtitle?comp.showtitle:"true"), group:'文本属性', editor:{ type:"checkbox", options:{"on":true, "off":false} }}, {name:'标题',col:'name', value:(comp.name?comp.name:""), group:'文本属性', editor:'text'}, {name:'位置', col:'talign', value:(s.talign?s.talign:""), group:'文本属性', editor:{ type:'combobox', options:{data:[{value:'left',text:'left'},{value:'center',text:'center'},{value:'right',text:'right'}]} }}, {name:'背景颜色', col:'tbgcolor', value:(s.tbgcolor?s.tbgcolor:""), group:'文本属性', editor:{ type:'combobox', options:{data:colorJson, formatter:function(row){ return "
"+row.text+"
"; }} }}, {name:'字体大小',col:'tfontsize', value:(s.tfontsize?s.tfontsize:""), group:'文本字体', editor:{type:'numberspinner',options:{min:9,max:100,increment:3}}}, {name:'字体颜色',col:'tfontcolor', value:(s.tfontcolor?s.tfontcolor:""), group:'文本字体', editor:{ type:'combobox', options:{data:colorJson, formatter:function(row){ return "
"+row.text+"
"; }} }}, {name:'是否粗体',col:'tfontweight', value:(s.tfontweight?s.tfontweight:""), group:'文本字体', editor:{ type:"checkbox", options:{"on":true, "off":false} }}, {name:'是否斜体',col:'titalic', value:(s.titalic?s.titalic:""), group:'文本字体', editor:{ type:"checkbox", options: {"on":true, "off":false} }}, {name:'是否下划线',col:'tunderscore', value:(s.tunderscore?s.tunderscore:""), group:'文本字体', editor:{ type:"checkbox", options: {"on":true, "off":false} }} ] }); } function tableView(table, compId){ if(table.kpiJson == undefined){ return; } //如果没有度量,维度等内容,返回界面到初始状态 if(table.kpiJson.length == 0 && table.cols.length == 0 && table.rows.length == 0){ $("#T" + compId + " div.ctx").html("
(点击编辑按钮配置交叉表的列)
"); return; } var json = JSON.parse(JSON.stringify(table)); json.portalParams = pageInfo.params; __showLoading(); $.ajax({ type: "POST", url: "TableView.action", contentType : "application/json", dataType:"html", data: JSON.stringify(json), success: function(resp){ __hideLoading(); $("#c_" + compId + " div.cctx div.ccctx").html(resp); }, error:function(resp){ __hideLoading(); $.messager.alert('出错了','系统出错,请联系管理员。','error'); } }); } function dimsort(tp){ var dimid = curTmpInfo.ckid; var compId = curTmpInfo.compId; var pos = curTmpInfo.pos; var name = curTmpInfo.dimname; //获取组件的JSON对象 var comp = findCompById(compId); var dims = null; if(pos == 'col'){ dims = comp.cols; }else{ dims = comp.rows; } for(var i=0; i"; $('#pdailog').dialog({ title: '维度聚合', width: 320, height: 200, closed: false, cache: false, modal: true, toolbar:null, content: ctx, buttons:[{ text:'确定', iconCls:'icon-ok', handler:function(){ if(dim.issum == 'y'){ dim.issum = "n"; delete dim.aggre; }else{ var autoaggre = $("#pdailog input[name='autoaggre']:checked").size(); if(autoaggre == 1){ dim.aggre = "auto"; }else{ dim.aggre = $("#pdailog #dimaggre").val(); } dim.issum = 'y'; } curTmpInfo.isupdate = true; tableView(comp, compId); $('#pdailog').dialog('close'); } },{ text:'取消', iconCls:"icon-cancel", handler:function(){ $('#pdailog').dialog('close'); } }] }); $("#pdailog input[name='autoaggre']").click(function(){ var sel = $(this).attr("checked"); if(sel){ $("#pdailog #dimaggre").attr("disabled", "true"); }else{ $("#pdailog #dimaggre").removeAttr("disabled"); } }); } function dimkpimove(tp){ var dimid = curTmpInfo.ckid; var compId = curTmpInfo.compId; var pos = curTmpInfo.pos; var name = curTmpInfo.dimname; //获取组件的JSON对象 var comp = findCompById(compId); var dims = null; if(pos == 'col'){ dims = comp.cols; }else if(pos =="row"){ dims = comp.rows; }else if(pos == "kpi"){ dims = comp.kpiJson; } if(dims.length <= 1){ msginfo('无效移动。'); return; } for(var i=0; i= dims.length - 1){ msginfo('无效移动。'); return; }else{ var tp = dims[i + 1]; dims[i + 1] = dims[i]; dims[i] = tp; //交换维度 $("#tableData #"+(pos=="kpi"?"k":"d")+"_"+dimid).next().after($("#tableData #"+(pos=="kpi"?"k":"d")+"_"+dimid)); curTmpInfo.isupdate = true; tableView(comp, compId); return; } } break; } } } //维度交换行列 function dimexchange(){ var dimid = curTmpInfo.ckid; var compId = curTmpInfo.compId; var pos = curTmpInfo.pos; var name = curTmpInfo.dimname; //获取组件的JSON对象 var comp = findCompById(compId); if(pos == 'col'){ //先移除维度 var idx = 0; var tmp = null; var dims = comp.cols; for(var i=0; i"+tmp.dimdesc+"
"; if($("#tableData #tabRows span.dimcol").size() > 0){ $("#tableData #tabRows span.dimcol").last().after(o); }else{ $("#tableData #tabRows b").after(o); } if(comp.cols.length == 0){ $("#tableData #tabCols").remove(); } } if(pos == 'row'){ //先移除维度 var idx = 0; var tmp = null; var dims = comp.rows; for(var i=0; i     列字段:"); } $("#tableData #tabCols").append(""+tmp.dimdesc+"
"); } curTmpInfo.isupdate = true; tableView(comp, compId); } function kpiproperty(){ var kpiId = curTmpInfo.ckid; var compId = curTmpInfo.compId; var comp = findCompById(compId); var kpi = findKpiById(kpiId, comp.kpiJson); var ctx = "
度量名称:
所 属 表: "+comp.tname+"
对应字段:"+kpi.col_name+"
度量单位:"+kpi.unit+"
格 式 化:"+ "
表头排序:
function (value, col, row, data){

}
帮助
"; $('#pdailog').dialog({ title: '度量属性', width: 400, height: 320, closed: false, cache: false, modal: true, toolbar:null, content: ctx, buttons:[{ text:'确定', iconCls:'icon-ok', handler:function(){ kpi.fmt = $("#pdailog #fmt").val(); kpi.rate = Number($("#pdailog #kpiunit").val()); kpi.kpi_name = $("#pdailog #name").val(); var headsort = $("#pdailog input[name='headsort']:checked").size(); if(headsort == 0){ kpi.order = "n"; }else{ kpi.order = "y"; } var funcname = $("#table_cell_tab #funcname").val(); var code = $("#table_cell_tab #code").val(); if(funcname == "" && code == ""){ delete kpi.funcname; delete kpi.code; }else{ if(funcname == ""){ $("#pdailog #table_cell_tab").tabs("select", 1); msginfo("函数名是必填项!"); $("#table_cell_tab #funcname").focus(); return; } if(code == ""){ $("#pdailog #table_cell_tab").tabs("select", 1); msginfo("函数内容是必填项!"); $("#table_cell_tab #code").focus(); return; } kpi.funcname = funcname; kpi.code = escape(code); } $('#pdailog').dialog('close'); curTmpInfo.isupdate = true; tableView(comp, compId); } },{ text:'取消', iconCls:"icon-cancel", handler:function(){ $('#pdailog').dialog('close'); } }] }); $("#pdailog #table_cell_tab").tabs({border:false,fit:true}); $("#pdailog #table_cell_tab #helper").linkbutton({iconCls:'icon-tip'}); //让格式化、聚合方式选中 $("#pdailog #fmt").find("option[value='"+kpi.fmt+"']").attr("selected",true); $("#pdailog #kpiunit").find("option[value='"+kpi.rate+"']").attr("selected",true); $("#pdailog #aggreType").find("option[value='"+kpi.aggre+"']").attr("selected",true); } function setKpiInfo(ts, id, compId){ var offset = $(ts).offset(); //放入临时对象中,方便下次获取 curTmpInfo.ckid = id; curTmpInfo.compId = compId; curTmpInfo.pos = "kpi"; var comp = findCompById(compId); //设置度量排序的标识 var kpi = findKpiById(id, comp.kpiJson); if(kpi.sort == 'asc'){ $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord1")).target, iconCls:"icon-ok"}); $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord2")).target, iconCls:"icon-blank"}); $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord3")).target, iconCls:"icon-blank"}); }else if(kpi.sort == 'desc'){ $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord1")).target, iconCls:"icon-blank"}); $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord2")).target, iconCls:"icon-ok"}); $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord3")).target, iconCls:"icon-blank"}); }else{ $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord1")).target, iconCls:"icon-blank"}); $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord2")).target, iconCls:"icon-blank"}); $("#kpioptmenu").menu("setIcon", {target:$("#kpioptmenu").menu("getItem", $("#k_kpi_ord3")).target, iconCls:"icon-ok"}); } $("#kpioptmenu").menu("show", {left:offset.left, top:offset.top - 100}); } function setCdimInfo(ts, id, name, compId){ var offset = $(ts).offset(); //放入临时对象中,方便下次获 curTmpInfo.ckid = id; curTmpInfo.compId = compId; curTmpInfo.pos = "col"; curTmpInfo.dimname = name; //设置聚合菜单 var issum = false; var comp = findCompById(compId); var dims = comp.cols; for(var i=0; i维度取Top:
"; $('#pdailog').dialog({ title: '维度取Top', width: 360, height: 170, closed: false, cache: false, modal: true, toolbar:null, content: ctx, buttons:[{ text:'完成', iconCls:"icon-ok", handler:function(){ var top = $("#pdailog #top").numberbox("getValue"); var type = $("#pdailog #type").val(); dim.top = top; dim.topType = type; curTmpInfo.isupdate = true; $('#pdailog').dialog('close'); tableView(comp, compId); } },{ text:'取消', iconCls:"icon-cancel", handler:function(){ $('#pdailog').dialog('close'); } }] }); $("#pdailog #top").numberbox({width:180, height:28}); } function setRdimInfo(ts, id, name, compId){ var offset = $(ts).offset(); curTmpInfo.ckid = id; curTmpInfo.compId =compId; curTmpInfo.pos = "row"; curTmpInfo.dimname = name; //设置聚合菜单 var issum = false; var comp = findCompById(compId); var dims = comp.rows; for(var i=0; i