var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name(); //部门id var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids(); var corp_Id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names(); //部门名称 var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames(); //父部门id var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids(); //var colorArr = ["#ff7f50","#87cefa","#da70d6","#32cd32","#6495ed","#ff69b4","#ba55d3","#cd5c5c","#ffa500"]; var colorArr = ["#6495ed","#ff69b4","#ba55d3","#ff7f50","#87cefa","#da70d6","#32cd32","#cd5c5c","#ffa500"]; /** * 纵向图表 */ var fristChart = function(){ var _this = this; _this.chart1 = null; _this.chart2 = null; // var eval_dept_id = "" ,sys_id ="", sysIdData = [],level_id="",eval_id="",project_id = ""; var chart1Data = []; var rightText = ""; function initEvalDeptId(){ $("#eval_dept_id").OrgSel({"orgOkCallBack":function(){ eval_dept_id = $("#eval_dept_id").val(); initSysId(); }}); eval_dept_id = corp_Id; $("#show_eval_dept_id").val(corp_name); $("#eval_dept_id").val(eval_dept_id); $("#eval_dept_id_show").val(corp_name); initSysId(); } function initSysId(){ console.log(eval_dept_id); var url = $.pathname() + '/ws/scoreGrade/ScoreService/getSysIdByDeptId'; var params = {eval_dept_id:eval_dept_id}; $.request.query(url,params,function(data){ console.log(data); sysIdData = data; $("#sys_id").data("data",{list:data}); $("#sys_id").render(); if(data.length != 0){ sys_id = data[0].value; project_id = data[0].FD_OBJECTID; $("#sys_id").setValue(sys_id); $("#sys_id").render(); var levelData = getLevelSelect(parseInt(data[0].LEVEL_NUM)); initLevelId(levelData); }else{ sys_id = ""; project_id = ""; initLevelId([]); } }); } function initLevelId(data){ $("#level_id").data("data",{list:data}); $("#level_id").render(); if(data.length != 0){ level_id = data[0].value; $("#level_id").setValue(level_id); $("#level_id").render(); initEvalId(); }else{ level_id = ""; initEvalId(); } } function initEvalId(){ //console.log(eval_dept_id); //console.log(sys_id); //console.log(level_id); var url = $.pathname() + '/ws/scoreGrade/ScoreService/setSelectData'; var params = { level : level_id, sys_id : sys_id }; $.request.query(url,params,function(data){ data = data[0].result; $("#eval_id").data("data",{list:data}); $("#eval_id").render(); if(data.length != 0){ eval_id = data[0].value; $("#eval_id").setValue(eval_id); $("#eval_id").render(); getLongitudinalChartData(); }else{ eval_id = ""; getLongitudinalChartData(); } }); } function getLongitudinalChartData(){ //console.log(eval_dept_id); //console.log(sys_id); //console.log(level_id); //console.log(eval_id); var url = $.pathname() + '/ws/scoreGrade/ScoreService/getLongitudinalChartData'; var params = { sys_id:sys_id, project_id:project_id, eval_id:eval_id }; $.request.query(url,params,function(data){ if(_this.chart2) _this.chart2.clear(); //console.log(data); chart1Data = data[0].barResult[0].series; var option1 = getBarOption(data[0].barResult[0]); //console.log("第一个"); //console.log(option1); $.newEcharts().init(function(ec){ _this.chart1 = ec.init(document.getElementById("left_id")); _this.chart1.setOption(option1); _this.chart1.on("click",function(params){ //console.log(params); rightText = params.seriesName+params.name; var evalId = ""; var curColor = colorArr[params.seriesIndex]; //console.log(curColor); for(var i=0;i9){ option2.grid.y2 = 130; option2.xAxis[0].axisLabel = { interval:0,//横轴信息全部显示 rotate:30,//-30度角倾斜显示 }; }else if(option2.series[0].data.length>3){ option2.grid.y2 = 100; option2.xAxis[0].axisLabel = { interval:0,//横轴信息全部显示 rotate:30,//-30度角倾斜显示 }; } //console.log("第二个"); //console.log(option2); $.newEcharts().init(function(ec){ _this.chart2 = ec.init(document.getElementById("right_id")); _this.chart2.setOption(option2); }); }); } function getBarOption(data){ //console.log(JSON.stringify(data)); if(JSON.stringify(data) == "{}"){ return data; } var option = {}; var json = {}; json.text = $("#eval_id").attr("relText"); json.subtext = $("#level_id").attr("relText")+"下--柱状图"; json.legendData = []; //json.trigger = "item"; json.tooltipPosition = function(params){ //console.log(params); if(params[0]>267){ return [params[0]-175,params[1]-60]; }else{ return [params[0]+30,params[1]-60]; } }; json.tooltipFormatter = function(val){ var aa = val[0]["name"]+"
"; for(var i=0;i"; } return aa; }; json.magicType = {show: true, type: ['line', 'bar', 'stack', 'tiled']}; json.xAxisData = []; var xAxisData = data.xAxisData; //if(typeof xAxisData == "string") xAxisData = JSON.parse(xAxisData); //console.log(xAxisData); for(var i=0;i8){ option.legend.y = "85%"; option.grid.y2 = 130; option.align = 'right'; }else if(json.legendData.length>4){ option.grid.y2 = 100; option.align = 'right'; } option.toolbox = $.getToolbox(json); option.calculable = true; option.xAxis = $.getXAxis(json); option.yAxis = $.getYAxis(json); option.yAxis[0].axisLabel = { formatter: function(val){ console.log(val); if(val==0){ return "0"; }else{ return (val+"%"); } } }; option.series = json.series; //console.log(JSON.stringify(option)); //console.log(option); return option; } return { init:function(){ initEvalDeptId(); $("#eval_dept_id").change(function(){ eval_dept_id = $(this).attr("relValue"); initSysId(); }); $("#sys_id").change(function(){ sys_id = $(this).attr("relValue"); project_id = getCulomValueFromJson(sysIdData,sys_id,"FD_OBJECTID"); var num = getCulomValueFromJson(sysIdData,sys_id,"LEVEL_NUM"); var levelData = getLevelSelect(parseInt(num)); initLevelId(levelData); }); $("#level_id").change(function(){ level_id = $(this).attr("relValue"); initEvalId(); }); $("#eval_id").change(function(){ eval_id = $(this).attr("relValue"); getLongitudinalChartData(); }); } }; }(); /** * 横向图表 */ var secondChart = function(){ var _this = this; _this.chart1 = null; _this.chart2 = null; // var eval_dept_id = "" ,sys_id ="", level_id="",eval_id="",project_id = ""; var projectData = []; var deptData = []; var sysIdsData = []; var rightText = ""; function initDeptAndEvalByTime(){ var url = $.pathname() + '/ws/scoreGrade/ScoreService/initDeptAndEvalByTime'; var params = {}; $.request.query(url,params,function(data){ console.log(data); projectData = data[0].result; deptData = data[0].resultdept; sysIdsData = data[0].resultSysId; //setTimeout(function(){ initSysId(sysIdsData); initDeptidsView(deptData); initProjectidsView(projectData,""); //},4000); }); } function initSysId(data){ var html = ''; for(var i=0;i' +' ' +''); } $("#sys_id02").html(""); $("#sys_id02").append(html); $("#sys_id02").find(".sel-item input").bind("click",function(){ var $checked = $("#dept_id02").find("input:checkbox:checked"); if($checked.length<2){ var valuse = ""; if($checked.length==1){ valuse = $checked.eq(0).attr("id"); } $("#project_id02").parent().show(); initProjectidsView(projectData,valuse); }else{ $("#project_id02").html(""); $("#project_id02").parent().hide(); } initLevelId(); }); } function initDeptidsView(data){ var html = ''; for(var i=0;i' +' ' +''); } $("#dept_id02").html(""); $("#dept_id02").append(html); $("#dept_id02").find(".sel-item input").bind("click",function(){ var $checked = $("#dept_id02").find("input:checkbox:checked"); if($checked.length<2){ var valuse = ""; if($checked.length==1){ valuse = $checked.eq(0).attr("id"); } $("#sys_id02 input").attr("disabled",false); $("#project_id02").parent().show(); initProjectidsView(projectData,valuse); initLevelId(); }else{ $("#project_id02").html(""); $("#project_id02").parent().hide(); var valuse = ""; for(var i=0;i<$checked.length;i++){ valuse += ($checked.eq(i).attr("id")+"|"); } getSysIdsByDeptIds(valuse); } }); } function initProjectidsView(data,delids){ var html = ''; $("#project_id02").html(""); var radioVal = $("input:radio[name='sys_id']:checked").attr("id"); console.log(!radioVal); for(var i=0;i' +' ' +''); $html.data("itemData",data[i]); $("#project_id02").append($html); } } } $("#project_id02").find(".sel-item input").bind("click",function(){ var itemData = $(this).parent().data("itemData"); if($(this).attr("checked")){ $("#project_id02 input").attr("disabled",true); $("input[name='"+itemData.SYS_ID+"']").attr("disabled",false); }else{ var $checked = $('#project_id02 input:checkbox:checked'); if($checked.length!=0){ $("#project_id02 input").attr("disabled",true); }else{ $("#project_id02 input").attr("disabled",false); } for(var i=0;i<$checked.length;i++){ var value = $checked.eq(i).parent().data("itemData").SYS_ID; $("input[name='"+value+"']").attr("disabled",false); } } itemData = $('#project_id02 input:checkbox:checked').eq(0).parent().data("itemData"); if(itemData){ $("#sys_id02 ."+itemData.SYS_ID).attr("checked",true); }else{ var $radio = $("#sys_id02 input"); for(var i=0;i<$radio.length;i++){ $radio.eq(i).attr("checked",false); } } initLevelId(); }); } function getSysIdsByDeptIds(ids){ var url = $.pathname() + '/ws/scoreGrade/ScoreService/getSysIdsByDeptIds'; var params = {deptIds : ids}; $.request.query(url,params,function(data){ console.log(JSON.stringify(data)); var $radio = $("#sys_id02 input"); for(var i=0;i<$radio.length;i++){ $radio.eq(i).attr("checked",false); } $("#sys_id02 input").attr("disabled",true); for(var i=0;i