<%@ taglib prefix="EscapeUtils"
uri="http://www.tech.com/EscapeUtils"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="com.svw.xss.EscapeUtils"%>
<%@page import="java.text.DecimalFormat"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%
String root = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>指标比较</title>
<script src="<%=EscapeUtils.htmlEscape(root)%>/js/jquery-1.8.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="<%=EscapeUtils.htmlEscape(root)%>/css/themes/icon.css">
<link rel="stylesheet" type="text/css" href="<%=EscapeUtils.htmlEscape(root)%>/css/themes/default/easyui.css">
<script type="text/javascript" src="<%=EscapeUtils.htmlEscape(root)%>/js/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="<%=EscapeUtils.htmlEscape(root)%>/css/all.css">
<script src="<%=EscapeUtils.htmlEscape(root)%>/js/highcharts.js"></script>
<script src="<%=EscapeUtils.htmlEscape(root)%>/js/exporting.js"></script>
<script src="<%=EscapeUtils.htmlEscape(root)%>/js/highcharts-zh_CN.js"></script>
<%
String array[]=(String[])request.getAttribute("array");
String regionId=(String)request.getAttribute("regionId");
String regionName=(String)request.getAttribute("regionName");
String maxdate=(String)request.getAttribute("maxdate");
String mindate=(String)request.getAttribute("mindate");
String fType=(String)request.getAttribute("fType");
String areaCode=(String)request.getAttribute("areaCode");
%>
<script type="text/javascript">
var rowObj={};
var json;
$(function() {
$("#combobox").combobox({editable:false});
//datagrid列标题的扩展方法
$.extend($.fn.datagrid.methods, {
setColumnTitle: function(jq, option){
if(option.field){
return jq.each(function(){
var $panel = $(this).datagrid("getPanel");
var $field = $('td[field='+option.field+']',$panel);
if($field.length){
var $span = $("span",$field).eq(0);
$span.html(option.text);
}
});
}
return jq;
}
});
var areaCode,aCode;
var action=1;
var val1=$('#sel1 option:selected').val();
var val2=$('#sel2 option:selected').val();
var val3=$('#sel3 option:selected').val();
var val4=$('#sel4 option:selected').val();
var nameArray=new Array();
aCode=$("#aCode").val();
$(".a").click(function() { // 6个sheet页的跳转
$(".a").css('background-color', '');
$(this).css('background-color', '#cccccc');
action=$(this).attr("value");
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
})
//获取数据库中最大、最小的日期
$("#max").val();
//使季度下拉列表默认为系统最近的日期
var jd= $("#max").val().charAt($("#max").val().length - 1);
$("#quarter").val(jd);
var yy,jj,qc;//定义全局变量年、季度、类型
jj= $("#quarter").val();//获取默认选中的季度
yy=$("#year").val();//获取默认选中的年份
qc=$("#quarterchoose").val();
/*年度、季度选择器*/
var $year=$('#year option:selected').text();
var $quarter=$('#quarter option:selected') .text(); //获取季度
$("#year").change(function(){ //年度按钮
$year=$('#year option:selected').text();
yy=$year;
if(qc==2){ //当前选项为年度时
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
}
});
$("#quarter").change(function(){
$quarter=$('#quarter option:selected') .text(); //季度按钮
jj= $('#quarter option:selected').val();
if(qc==1){
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
}
});
//此处为年、季度下拉框的选择
$("#quarterchoose").change(function(){
$val=$('#quarterchoose option:selected') .val();
if("2"==$val){
$("#quarter").hide(); //隐藏季度
$quarter=null;
qc=2;
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
}else{
$("#quarter").show(); //显示季度
$year=$('#year option:selected').text();
qc=1;
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
}
})
/*柱状图中清除样式*/
//添加清除样式
$("#clear").click(function() {
$("#container").remove();
$('<div id="container" style="min-width: 430px; height: 300px;"></div>').appendTo($("body"));
$(".clear").hide();
});
if(<%=fType%>==2){ //省
$("#areaSpan").css('margin-right','30px');
nameArray[0]=1;
nameArray[1]=1;
nameArray[2]=1;
nameArray[3]=0;
nameArray[4]=0;
nameArray[5]=0;
//获取要比较的省份的值
var val1=$('#sel1 option:selected').val();
var val2=$('#sel2 option:selected').val();
var val3=$('#sel3 option:selected').val();
if(val1=="0"){
$("#tt").datagrid('hideColumn','four');
}else{
$("#tt").datagrid('showColumn','four');
}
if(val2=="0"){
$("#tt").datagrid('hideColumn','five');
}else{
$("#tt").datagrid('showColumn','five');
}
if(val3=="0"){
$("#tt").datagrid('hideColumn','six');
}else{
$("#tt").datagrid('showColumn','six');
}
$("#area").change(function(){ //区域的隐藏与否
if($("#area").prop('checked')){
$("#tt").datagrid('showColumn','two');
nameArray[1]=1;
}else{
$("#tt").datagrid('hideColumn','two');
nameArray[1]=0;
}
})
$("#country").change(function(){ //全国的隐藏与否
if($("#country").prop('checked')){
$("#tt").datagrid('showColumn','three');
nameArray[2]=1;
}else{
$("#tt").datagrid('hideColumn','three');
nameArray[2]=0;
}
})
$(".select1").change(function(){
//获取经销商下拉框中选中的值
four =$('#sel1 option:selected').text();
five =$('#sel2 option:selected').text();
six =$('#sel3 option:selected').text();
//修改经销商的名称
val1=$('#sel1 option:selected').val();
val2=$('#sel2 option:selected').val();
val3=$('#sel3 option:selected').val();
$("#tt").datagrid("setColumnTitle", {field : 'four',text :""});
$("#tt").datagrid("setColumnTitle", {field : 'five',text : ""});
$("#tt").datagrid("setColumnTitle", {field : 'six',text : ""});
if(val1=="0"){
$("#tt").datagrid('hideColumn','four');
nameArray[3]=0;
}else{
//修改经销商的名称
$("#tt").datagrid("setColumnTitle", {field : 'four',text : four});
$("#tt").datagrid('showColumn','four');
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
nameArray[3]=1;
}
if(val2=="0"){
$("#tt").datagrid('hideColumn','five');
nameArray[4]=0;
}else{
//修改经销商的名称
$("#tt").datagrid("setColumnTitle", {field : 'five',text : five});
$("#tt").datagrid('showColumn','five');
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
nameArray[4]=1;
}
if(val3=="0"){
$("#tt").datagrid('hideColumn','six');
nameArray[5]=0;
}else{
//修改经销商的名称
$("#tt").datagrid("setColumnTitle", {field : 'six',text : six});
$("#tt").datagrid('showColumn','six');
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
nameArray[5]=1;
}
})
}else if(<%=fType%>==3){ //总部下的区域查询
nameArray[0]=1;
nameArray[1]=1;
nameArray[2]=0;
nameArray[3]=0;
nameArray[4]=0;
nameArray[5]=0;
$("#area").css('display','none').css('clear','both'); //区域进来时:隐藏
$("#areaSpan").html("");
$("#country").css('clear','both');
areaCode=$("#areaCode").val();
var val1=$('#sel1 option:selected').val();
var val2=$('#sel2 option:selected').val();
var val3=$('#sel3 option:selected').val();
var val4=$('#sel4 option:selected').val();
//四个区域的隐藏
if(val1=="0"){
$("#tt").datagrid('hideColumn','three');
}else{
$("#tt").datagrid('showColumn','three');
}
if(val2=="0"){
$("#tt").datagrid('hideColumn','four');
}else{
$("#tt").datagrid('showColumn','four');
}
if(val3=="0"){
$("#tt").datagrid('hideColumn','five');
}else{
$("#tt").datagrid('showColumn','five');
}
if(val4=="0"){
$("#tt").datagrid('hideColumn','six');
}else{
$("#tt").datagrid('showColumn','six');
}
$("#country").change(function(){ //全国的隐藏与否
if($("#country").prop('checked')){
$("#tt").datagrid('showColumn','two');
nameArray[1]=1;
}else{
$("#tt").datagrid('hideColumn','two');
nameArray[1]=0;
}
})
$(".select1").change(function(){
three =$('#sel1 option:selected').text();
four =$('#sel2 option:selected').text();
five =$('#sel3 option:selected').text();
six =$('#sel4 option:selected').text();
// five=five.substring(0,five.length-1);
val1=$('#sel1 option:selected').val();
val2=$('#sel2 option:selected').val();
val3=$('#sel3 option:selected').val();
val4=$('#sel4 option:selected').val();
$("#tt").datagrid("setColumnTitle", {field : 'three',text :""});
$("#tt").datagrid("setColumnTitle", {field : 'four',text : ""});
$("#tt").datagrid("setColumnTitle", {field : 'five',text :""});
$("#tt").datagrid("setColumnTitle", {field : 'six',text : ""});
if(val1=="0"){
$("#tt").datagrid('hideColumn','three');
nameArray[2]=0;
}else{
//修改经销商的名称
$("#tt").datagrid("setColumnTitle", {field : 'three',text : three});
$("#tt").datagrid('showColumn','three');
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
nameArray[2]=1;
}
if(val2=="0"){
$("#tt").datagrid('hideColumn','four');
nameArray[3]=0;
}else{
//修改经销商的名称
$("#tt").datagrid("setColumnTitle", {field : 'four',text : four});
$("#tt").datagrid('showColumn','four');
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
nameArray[3]=1;
}
if(val3=="0"){
$("#tt").datagrid('hideColumn','five');
nameArray[4]=0;
}else{
//修改经销商的名称
$("#tt").datagrid("setColumnTitle", {field : 'five',text :five});
$("#tt").datagrid('showColumn','five');
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
nameArray[4]=1;
}
if(val4=="0"){
$("#tt").datagrid('hideColumn','six');
nameArray[5]=0;
}else{
//修改经销商的名称
$("#tt").datagrid("setColumnTitle", {field : 'six',text : six});
$("#tt").datagrid('showColumn','six');
$('#tt').datagrid('options').url = '/doms/kpi/BmrCompare/searchCompare.json?action='+action+'&year='+yy+'&jd='+jj+'®ionId='+<%=regionId%>+'&areaCode='+areaCode+'&fType='+<%=fType%>+'&val1='+val1+'&val2='+val2+'&val3='+val3+'&val4='+val4+'&aCode='+aCode;
$('#tt').datagrid('reload');
nameArray[5]=1;
}
})
}
//返回前页
$("#back").click(function(){
if(<%=fType%>==2){ //省
location.href="/doms/module/kpi/kpiJsp/ProvinceBMRquery.jsp";
}else if(<%=fType%>==3){ //区域
location.href="/doms/module/kpi/kpiJsp/AreaBMRquery.jsp";
}else if(<%=fType%>==4){ //全国
location.href="/doms/module/kpi/kpiJsp/CountryBMRquery.jsp";
}
})
//报表下载
$("#download").click(function(){
var name,code,time;
var data=new Array();
data[0]= $("#name").parentsUntil('tr').next().find('span:eq(0)').text();
data[1] = $("#name").parentsUntil('tr').next().next().find('span:eq(0)').text();
data[2]= $("#name").parentsUntil('tr').next().next().next().find('span:eq(0)').text();
data[3]= $("#name").parentsUntil('tr').next().next().next().next().find('span:eq(0)').text();
data[4]= $("#name").parentsUntil('tr').next().next().next().next().next().find('span:eq(0)').text();
data[5]= $("#name").parentsUntil('tr').next().next().next().next().next().next().find('span:eq(0)').text();
var codedata=new Array();
if(<%=fType%>==3){ //查询区域
codedata[0]=$("#aCode").val();
codedata[1]="country";
codedata[2]=$('#sel1 option:selected').val();
codedata[3]=$('#sel2 option:selected').val();
codedata[4]=$('#sel3 option:selected').val();
codedata[5]=$('#sel4 option:selected').val();
}else{ // 查询省份
codedata[0]=<%=regionId%>;
codedata[1]=$("#aCode").val();
codedata[2]="country";
codedata[3]=$('#sel1 option:selected').val();
codedata[4]=$('#sel2 option:selected').val();
codedata[5]=$('#sel3 option:selected').val();
}
name=data[0];
code=codedata[0];
for(var i=1;i<6;i++){
if(nameArray[i]==1){
name=name+","+data[i];
code=code+","+codedata[i];
}
}
$val=$('#quarterchoose option:selected') .val();
$quarter=$('#quarter option:selected').val(); //获取季度
$year=$('#year option:selected').text(); // 获取年度
if("2"==$val){ //隐藏季度
$quarter=0;
}
time=$year+","+$quarter;
document.location.href = '/doms/kpidownload/BmrCompareDownload/getData.do?code=' + code + '&name=' + name + '&time=' + time;
})
});
//easyui中重写的触发事件
function oper(value,row,index){
return "<a href=\"javascript:void(0);\" οnmοuseοver=\"operAlert('" + index + "','" + row.describe + "','" + row.name + "',this)\" οnmοuseοut=\"operHiden('"+index+"')\">"+value+"</a>";
}
function operAlert(val, content,name) {
//控制弹出框的位置
$(".position").css('top', $(obj).offset().top+'px').css('left',$(obj).offset().left+200+'px'); //获取当前列标题的定位
$(".position").html('<span style="font-size:14px;">'+name+':'+content+'</span>'); //将计算公式通过隐藏域显示
$(".position").show();
}
function operHiden(val){
$(".position").hide();
}
function show(value,row,index){
rowObj[index]=row;
if(row.dataType==1){
return '<button style="border: none;width: auto;padding-top:5px;padding-right:10px;height: auto;background-color:rgba(0, 0, 0, 0);" οnmοuseοver="showmap('+index+')"><img alt="" src="<%=EscapeUtils.htmlEscape(root)%>/images/zzt.png" style="width:25px;height:20px"></button>';
}else{
return '<button style="border: none;width: auto;padding-top:5px;padding-right:10px;height: auto;background-color:rgba(0, 0, 0, 0);" οnmοuseοver="showmap('+index+')"><img alt="" src="<%=EscapeUtils.htmlEscape(root)%>/images/zxt.png" style="width:25px;height:20px"></button>';
}
}
function showmap(index){
var arrays=new Array();
var bt=new Array();
row=rowObj[index];
name=row.name;
datatype=row.dataType; //datatype:0 小数 datatype:1整数
arrays[0]=row.one;
arrays[1]=row.two;
arrays[2]=row.three;
arrays[3]=row.four;
arrays[4]=row.five;
arrays[5]=row.six;
var aName=new Array();
//获取表格中标题栏
aName[0] = $("#name").parentsUntil('tr').next().find('span:eq(0)').text();
aName[1]= $("#name").parentsUntil('tr').next().next().find('span:eq(0)').text();
aName[2]= $("#name").parentsUntil('tr').next().next().next().find('span:eq(0)').text();
aName[3]= $("#name").parentsUntil('tr').next().next().next().next().find('span:eq(0)').text();
aName[4]= $("#name").parentsUntil('tr').next().next().next().next().next().find('span:eq(0)').text();
aName[5]= $("#name").parentsUntil('tr').next().next().next().next().next().next().find('span:eq(0)').text();
var count,bt;
var data=new Array();
var dName=new Array();
if(<%=fType%>==3){ // 区域的查询
count=1;
arrays[0]=arrays[0].replace(/,/g,'');//替换掉所有的“,”
arrays[1]=arrays[1].replace(/,/g,'');
dName[0]=aName[0];
dName[1]=aName[1];
data[0]= arrays[0];
data[1]= arrays[1];
for(var i=2;i<6;i++){
if(aName[i]!=null&&aName[i]!=""){
count++;
data[count]=arrays[i]; //将当前array的值赋值给data数组
dName[count]=aName[i];
}
}
for( var i=0;i<=count;i++){
if(count==1){ //选中0个比较的区域
bt=[aName[0],aName[1]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1])];
}
}else if(count==2){ // 选中一个比较的区域
data[2]=data[2].replace(/,/g,'');
bt=[aName[0],aName[1],dName[2]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2)),parseFloat((parseInt(data[2])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1]),parseFloat(data[2])];
}
}else if(count==3){ // 选中两个比较的区域
data[2]=data[2].replace(/,/g,'');
data[3]=data[3].replace(/,/g,'');
bt=[aName[0],aName[1],dName[2],dName[3]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2)),parseFloat((parseInt(data[2])/10000).toFixed(2)),parseFloat((parseInt(data[3])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1]),parseFloat(data[2]),parseFloat(data[3])];
}
}else if(count==4){ // 选中三个比较的区域
data[2]=data[2].replace(/,/g,'');
data[3]=data[3].replace(/,/g,'');
data[4]=data[4].replace(/,/g,'');
bt=[aName[0],aName[1],dName[2],dName[3],dName[4]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2)),parseFloat((parseInt(data[2])/10000).toFixed(2)),parseFloat((parseInt(data[3])/10000).toFixed(2)),parseFloat((parseInt(data[4])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1]),parseFloat(data[2]),parseFloat(data[3]),parseFloat(data[4])];
}
}else{ //选中四个比较的区域
data[2]=data[2].replace(/,/g,'');
data[3]=data[3].replace(/,/g,'');
data[4]=data[4].replace(/,/g,'');
data[5]=data[5].replace(/,/g,'');
bt=[aName[0],aName[1],dName[2],dName[3],dName[4],dName[5]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2)),parseFloat((parseInt(data[2])/10000).toFixed(2)),parseFloat((parseInt(data[3])/10000).toFixed(2)),parseFloat((parseInt(data[4])/10000).toFixed(2)),parseFloat((parseInt(data[5])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1]),parseFloat(data[2]),parseFloat(data[3]),parseFloat(data[4]),parseFloat(data[5])];
}
}
}
}else{ // fType==2 查询省的BMR比较
count=2;
arrays[0]=arrays[0].replace(/,/g,'');//替换掉所有的“,”
arrays[1]=arrays[1].replace(/,/g,'');
arrays[2]=arrays[2].replace(/,/g,'');
dName[0]=aName[0];
dName[1]=aName[1];
dName[2]=aName[2];
data[0]= arrays[0];
data[1]= arrays[1];
data[2]=arrays[2];
for(var i=3;i<6;i++){
if(aName[i]!=null&&aName[i]!=""){
count++;
data[count]=arrays[i]; //将当前array的值赋值给data数组
dName[count]=aName[i];
}
}
for( var i=0;i<=count;i++){
if(count==2){ // 没有省份比较项
bt=[aName[0],aName[1],aName[2]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2)),parseFloat((parseInt(arrays[2])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1]), parseFloat(arrays[2])];
}
}else if(count==3){ // 有一个省份比较项
data[3]=data[3].replace(/,/g,'');
bt=[aName[0],aName[1],aName[2],dName[3]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2)),parseFloat((parseInt(arrays[2])/10000).toFixed(2)),parseFloat((parseInt(data[3])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1]), parseFloat(arrays[2]), parseFloat(data[3])];
}
}else if(count==4){ //有两个省份比较项
data[3]=data[3].replace(/,/g,'');
data[4]=data[4].replace(/,/g,'');
bt=[aName[0],aName[1],aName[2],dName[3],dName[4]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2)),parseFloat((parseInt(arrays[2])/10000).toFixed(2)),parseFloat((parseInt(data[3])/10000).toFixed(2)),parseFloat((parseInt(data[4])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1]), parseFloat(arrays[2]), parseFloat(data[3]), parseFloat(data[4])];
}
}else { //有三个省份比较项
data[3]=data[3].replace(/,/g,'');
data[4]=data[4].replace(/,/g,'');
data[5]=data[5].replace(/,/g,'');
bt=[aName[0],aName[1],aName[2],dName[3],dName[4],dName[5]];
if(datatype!=0 && Math.abs(data[i])>10000){
json = [ parseFloat((parseInt(arrays[0])/10000).toFixed(2)),parseFloat((parseInt(arrays[1])/10000).toFixed(2)),parseFloat((parseInt(arrays[2])/10000).toFixed(2)),parseFloat((parseInt(data[3])/10000).toFixed(2)),parseFloat((parseInt(data[4])/10000).toFixed(2)),parseFloat((parseInt(data[5])/10000).toFixed(2))];
if("元"==name.substring(name.length-2,name.length-1)){
name=name.substring(0,name.length-2)+"万元)";
}else if("元/台"==name.substring(name.length-4,name.length-1)){
name=name.substring(0,name.length-4)+"万元/台)";
}
break;
}else{
json = [ parseFloat(arrays[0]), parseFloat(arrays[1]), parseFloat(arrays[2]), parseFloat(data[3]), parseFloat(data[4]), parseFloat(data[5])];
}
}
}
}
$(".clear").show();
$name = name;
if(datatype==1){ //呈现柱状图
$('#container').highcharts({
chart : {
type : 'column'
},
legend : { //去除x轴底部的标题前的圆点
symbolHeight : 0.1,
symbolWidth : 0.1
},
title : {
text : ''
},
xAxis : {
categories : bt,
labels : {
style : {
'fontSize' : '12px',
'fontWeight' : 'normal',
'fontColor' : '#666666'
},
formatter : function() { //设置x轴列名称两行显示
var labelVal = this.value;
var reallyVal = labelVal;
var lvl = labelVal.length;
if (lvl > 4) {
reallyVal = labelVal.substr(0, 4) + "<br/>" + labelVal.substring(4, lvl);
}
return reallyVal;
}
}
},
yAxis : {
lineColor: '#e0e5ef',
lineWidth: 1,
title : {
text : ''
},
labels : {
formatter : function() {
if(this.value==0){
return 0;
}else{
return this.value;
}
}
}
},
plotOptions : { //是柱状图呈现数值
series : { //数据列
borderWidth : 0,
dataLabels : {
enabled : true,
formatter:function(){
return this.y==0?'':this.y;
},
style : {
'fontSize' : '12px',
'fontWeight' : 'normal',
color: 'gray',
'fontFamily' : 'Times New Roman'
}
}
}
},
credits : { // 去除右下角
enabled : false
},
exporting: { // 去除导出功能
enabled:false
},
series : [ {
name : $name,
data : json
} ]
});
}else{ // 呈现折线图
$('#container').highcharts({
chart : {
type : 'line'
},
legend : { //去除x轴底部的标题前的圆点
symbolHeight : 0.1,
symbolWidth : 0.1
},
title : {
text : ''
},
xAxis : {
categories : bt,
labels : {
style : {
'fontSize' : '12px',
'fontWeight' : 'normal',
'fontColor' : '#666666'
},
formatter : function() { //设置x轴列名称两行显示
var labelVal = this.value;
var reallyVal = labelVal;
var lvl = labelVal.length;
if (lvl > 4) {
reallyVal = labelVal.substr(0, 4) + "<br/>" + labelVal.substring(4, lvl);
}
return reallyVal;
}
}
},
yAxis : {
lineColor: '#e0e5ef',
lineWidth: 1,
title : {
text : ''
},
labels : {
formatter : function() {
return this.value + '%';
}
}
},
plotOptions : { //是柱状图呈现数值
line:{
dataLabels : {
enabled : true,
formatter:function(){
return this.y==0?'':(this.y+'%');
},
style : {
'fontSize' : '12px',
'fontWeight' : 'normal',
color: 'gray',
'fontFamily' : 'Times New Roman'
}
},
marker: { //更改圆点大小和形状
radius: 2, //曲线点半径,默认是4
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
}
}
},
credits : { // 去除右下角
enabled : false
},
exporting: { // 去除导出功能
enabled:false
},
series : [ {
name : $name,
data : json
} ]
});
}
document.getElementById("container").style.display = "block";
}
</script>
<style type="text/css">
.select1 {clear: both;width: 80px;margin-right: 30px}
.select2 {clear: both;width: 80px;margin-right: 30px;margin-left:0}
.combo-arrow {background-colro: blue}
.textbox .textbox-text {height: 30px;}
</style>
</head>
<body>
<input type="hidden" id="min" value=<%=mindate %> />
<input type="hidden" id="max" value=<%=maxdate%> />
<input type="hidden" id="areaCode" value=<%=areaCode%> />
<!-- 千分位显示数据 -->
<%
String pattern="###,###,##0";
DecimalFormat df=new DecimalFormat(pattern);
%>
<div id="container" ></div>
<div style="width:1005px; height: auto; margin:auto;">
<div>
<div class="sty1">
BMR指标比较:<%=regionName %></div>
<div class="sty1">
可选对比项: <input type="checkbox" name="compare" value="2" checked="checked" id="area" />
<span id="areaSpan">区域</span>
<input type="checkbox" name="compare" value="3" checked="checked" id="country" />全国
<input type="hidden" value="${aCode}" id="aCode"><!-- 当前区域code -->
</div>
<%
if("2".equals(fType)){
%><div class="sty1">
可选省份:<select class="select1" id="sel1" style="width: 130px">
<option value="0">请选择</option>
<c:forEach items="${province}" var="p">
<option value=${p.regionId}>${p.regionName}</option>
</c:forEach>
</select> <select class="select1" id="sel2" style="width: 130px">
<option value="0">请选择</option>
<c:forEach items="${province}" var="p">
<option value=${p.regionId}>${p.regionName}</option>
</c:forEach>
</select> <select class="select1" id="sel3" style="width: 130px">
<option value="0">请选择</option>
<c:forEach items="${province}" var="p">
<option value=${p.regionId}>${p.regionName}</option>
</c:forEach>
</select>
</div>
<div class="sty1">
时间节点:<select class="select2" id="quarterchoose" style="margin-right:30px;width: 130px">
<option selected="selected" value="1">季度</option>
<option value="2">年</option>
</select>
<select class="select2" id="year" style="margin-right:30px;width: 130px">
<c:forEach items="${year}" var="y">
<option selected="selected">${y}</option>
</c:forEach>
</select>
<select class="select2" id="quarter" style="margin-right:30px;width: 130px">
<option value="1">Q1</option>
<option value="2">Q2</option>
<option value="3">Q3</option>
<option value="4">Q4</option>
</select> <a href="javascript:void(0);" style="float: right; color: blue"id="back">返回前页</a>
</div>
<%
}else{
%><div class="sty1">
可选区域:<select class="select1" id="sel1">
<option value="0">请选择</option>
<c:forEach items="${area}" var="a">
<option value=${a.orgCode}>${a.orgName}</option>
</c:forEach>
</select> <select class="select1" id="sel2">
<option value="0">请选择</option>
<c:forEach items="${area}" var="a">
<option value=${a.orgCode}>${a.orgName}</option>
</c:forEach>
</select> <select class="select1" id="sel3">
<option value="0">请选择</option>
<c:forEach items="${area}" var="a">
<option value=${a.orgCode}>${a.orgName}</option>
</c:forEach>
</select> <select class="select1" id="sel4">
<option value="0">请选择</option>
<c:forEach items="${area}" var="a">
<option value=${a.orgCode}>${a.orgName}</option>
</c:forEach>
</select>
</div>
<div class="sty1">
时间节点:<select class="select2" id="quarterchoose">
<option selected="selected" value="1">季度</option>
<option value="2">年</option>
</select>
<select class="select2" id="year">
<c:forEach items="${year}" var="y">
<option selected="selected">${y}</option>
</c:forEach>
</select>
<select class="select2" id="quarter">
<option value="1">Q1</option>
<option value="2">Q2</option>
<option value="3">Q3</option>
<option value="4">Q4</option>
</select> <a href="javascript:void(0);" style="float: right; color: blue"id="back">返回前页</a>
</div>
<%
}
%>
<div class="sty1" style="clear: both;">
<hr>
</div>
<div class="sty1">
<ul class="box">
<li ><a href="javascript:void(0);"
style="background-color: #cccccc" class="a" value="1">综合指标</a></li>
<li ><a href="javascript:void(0);"
class="a" value="2">成长能力</a></li>
<li ><a href="javascript:void(0);"
class="a" value="3">盈利指标</a></li>
<li ><a href="javascript:void(0);"
class="a" value="4">投资回报</a></li>
<li ><a href="javascript:void(0);"
class="a" value="5">运营能力</a></li>
<li ><a href="javascript:void(0);"
class="a" value="6">偿债能力</a></li>
<li style="float: right;margin:0"><a href="javascript:void(0);"
style="color: blue" id="download">报表下载</a></li>
</ul>
</div>
<div class="sty1" style="clear: both;">
<hr>
</div>
</div>
<!-- 添加清除按钮 -->
<div class="clear">
<a id="clear"><img
src="<%=EscapeUtils.htmlEscape(root)%>/images/clear.png" style="height:14px;height:14px"></a>
</div>
<div class="position">hello111</div>
<%
if ("3".equals(fType)) {
%>
<table id="tt" class="easyui-datagrid"
style="width: 1005px; height: auto;"
data-options="
singleSelect:true,
collapsible:true,
url:'/doms/kpi/BmrCompare/searchCompare.json?action=1®ionId='+<%=regionId %>+'&fType='+<%=fType%>,
method:'get',
striped:true
">
<thead>
<tr>
<th
data-options="field:'name',width:220,align:'left',halign:'center',position:'relative',formatter:oper"><span
id="name">财务指标</span></th>
<th
data-options="field:'one',width:120,align:'right',halign:'center'"><%=array[0] %></th>
<th
data-options="field:'two',width:120,align:'right',halign:'center'"><%=array[1] %></th>
<th
data-options="field:'three',width:120,align:'right',halign:'center'"></th>
<th
data-options="field:'four',width:120,align:'right',halign:'center'"></th>
<th
data-options="field:'five',width:120,align:'right',halign:'center'"></th>
<th
data-options="field:'six',width:120,align:'right',halign:'center'"></th>
<th
data-options="field:'dataType',width:120,align:'right',halign:'center',hidden:'true'"></th>
<th
data-options="field:'status3',width:54,align:'right',halign:'center',formatter:show">图例</th>
</tr>
</thead>
</table>
<%
} else if("2".equals(fType)){
%>
<table id="tt" class="easyui-datagrid"
style="width: 1005px; height: auto;"
data-options="
singleSelect:true,
collapsible:true,
url:'/doms/kpi/BmrCompare/searchCompare.json?action=1®ionId='+<%=regionId%>+'&fType='+<%=fType%>,
method:'get',
striped:true
">
<thead>
<tr>
<th
data-options="field:'name',width:220,align:'left',halign:'center',position:'relative',formatter:oper"><span
id="name">财务指标</span></th>
<th
data-options="field:'one',width:120,align:'right',halign:'center'"><%=array[0] %></th>
<th
data-options="field:'two',width:120,align:'right',halign:'center'"><%=array[1] %></th>
<th
data-options="field:'three',width:120,align:'right',halign:'center'"><%=array[2] %></th>
<th
data-options="field:'four',width:120,align:'right',halign:'center'"></th>
<th
data-options="field:'five',width:120,align:'right',halign:'center'"></th>
<th
data-options="field:'six',width:120,align:'right',halign:'center'"></th>
<th
data-options="field:'dataType',width:0,align:'right',halign:'center',hidden:'true'"></th>
<th
data-options="field:'status3',width:54,align:'right',halign:'center',formatter:show">图例</th>
</tr>
</thead>
</table>
<%
}
%>
<!-- striped:true:隔行换色属性 -->
</div>
</body>
</html>
easyui结合highchart
最新推荐文章于 2019-10-19 13:03:21 发布