| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- var myChart = echarts.init(document.getElementById('reportChar'),'walden');
- var myChart2 = echarts.init(document.getElementById('reportChar2'),'walden');
- var myChart3 = echarts.init(document.getElementById('reportChar3'),'walden');
- option = {
- color: ['#3398DB'],
- tooltip: {
- trigger: 'axis'
- },
- grid:{
- left: '3%',
- right: '4%',
- bottom: '1%',
- containLabel: true
- },
-
- legend: {
- data:[],
- width:'90%',
- left:'center'
- },
- xAxis:
- {
- type: 'category',
- data: [],
- axisLabel: {
- interval: 0,
- formatter:function(value)
- {
- var ret = "";//拼接加\n返回的类目项
- var maxLength = 1;//每项显示文字个数
- var valLength = value.length;//X轴类目项的文字个数
- var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
- if (rowN > 1)//如果类目项的文字大于3,
- {
- for (var i = 0; i < rowN; i++) {
- var temp = "";//每次截取的字符串
- var start = i * maxLength;//开始截取的位置
- var end = start + maxLength;//结束截取的位置
- //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
- temp = value.substring(start, end) + "\n";
- ret += temp; //凭借最终的字符串
- }
- return ret;
- }
- else {
- return value;
- }
- }
- }
- },
- yAxis: [
- {
- type: 'value',
- name:'考勤调整次数(次)'
- }
- ],
- dataZoom: [
-
- {
- type: 'inside',
- start: 0,
- end: 100
-
- }
- ],
- series: [
- {
- name:'',
- type:'bar',
- data:[]
- }
- ]
- };
- option2 = {
- color: ['#3398DB'],
- tooltip: {
- trigger: 'axis'
- },
- grid:{
- left: '3%',
- right: '4%',
- bottom: '1%',
- containLabel: true
- },
-
- legend: {
- data:[],
- width:'90%',
- left:'center'
- },
- xAxis:
- {
- type: 'category',
- data: []
- },
- yAxis: [
- {
- type: 'value',
- name:'考勤调整次数(次)'
- }
- ],
- dataZoom: [
-
- {
- type: 'inside',
- start: 0,
- end: 100
-
- }
- ],
- series: [
- {
- name:'',
- type:'bar',
- data:[]
- }
- ]
- };
- option3 = {
- color: ['#3398DB'],
- tooltip: {
- trigger: 'axis'
- },
- grid:{
- left: '3%',
- right: '4%',
- bottom: '1%',
- containLabel: true
- },
-
- legend: {
- data:[],
- width:'90%',
- left:'center'
- },
- xAxis:
- {
- type: 'category',
- data: []
- },
- yAxis: [
- {
- type: 'value',
- name:'考勤调整次数(次)'
- }
- ],
- dataZoom: [
-
- {
- type: 'inside',
- start: 0,
- end: 100
-
- }
- ],
- series: [
- {
- name:'',
- type:'bar',
- data:[]
- }
- ]
- };
- $(function() {
- $(document).ready(function() {
- kaoqinsearch();
- });
- });
- function kaoqinsearch(){
- handleAjaxSimple("desktopRptController.do?getKaoQinTiaoZhengCount", $("#reportForm").serialize(), handleSuccess);
- }
- function handleSuccess(data){
- if(data.cdata.noData){
- $(".content").hide();
- $("#uptb").hide();
- $("#upbg").hide();
- $("#upexport").hide();
- $(".err-info").show();
- }else{
- $(".content").show();
- $(".err-info").hide();
- //$("#upBtn").show();
- $("#uptb").show();
- $("#upbg").show();
- var srcstr = $("#uptb").attr("src");
- if(srcstr.indexOf("tb1.png") < 0){
- $("#upexport").show();
- }
- var rolefalg = $("#roleFlag").val();
- var prostr;
- prostr = '项目';
- // if(rolefalg == 1){
- // }else{
- // prostr = '部门';
- // }
- var charheadStr;
- var attType = $("#attType").val();
- charheadStr =$("#curYear").val()+"年"+$("#attMonth").val()+"月项目考勤调整次数排行榜";
- // if(attType == 0 ){
- // charheadStr =$("#curYear").val()+"年"+$("#attMonth")+prostr+"";
- // }else if(attType == 1){
- // var attQuarters = $("#attQuarters").val();
- // if(attQuarters == 1){
- // charheadStr = $("#curYear").val()+"年一季度(01月-03月)各"+prostr+"工资费用";
- // }else if(attQuarters == 2){
- // charheadStr = $("#curYear").val()+"年二季度(04月-06月)各"+prostr+"工资费用";
- // }else if(attQuarters == 3){
- // charheadStr = $("#curYear").val()+"年三季度(07月-09月)各"+prostr+"工资费用";
- // }else {
- // charheadStr = $("#curYear").val()+"年四季度(10月-12月)各"+prostr+"工资费用";
- // }
- // }else if(attType == 2){
- // charheadStr = $("#curYear").val()+"年度各"+prostr+"工资费用";
- // }
- $("#upcharheaddiv").html(charheadStr);
- initCharDate(data.cdata);
- initNdateList(data.tdata);
- }
- }
- function initNdateList(data){
- var rolefalg = $("#roleFlag").val();
- // if(rolefalg == 1){
- // }else{
- // pjNamestr = '项目名称';
- // pidNamestr='部门名称';
- // }
- var attType = $("#attType").val();
- var peopleTotalStr;
- peopleTotalStr="考勤调整次数排行榜";
- // if(attType == 0 ){
- // }else{
- // peopleTotalStr="每月工资平均人数";
- // }
- var colums = [[
- {field:'name',title:'项目名称',width:150},
- {field:'count',title:'考勤调整次数(次)',width:150 ,align:'center',halign:'center'},
- {field:'total',title:'考勤调整时长(分钟)',width:150,align:'center',halign:'center'}
- // {field:'peopleTotal',title:peopleTotalStr,width:150 ,align:'right',halign:'center' },
-
- ]]
- $('#reportTable').datagrid({
- singleSelect : true,
- loadMsg:'数据加载中,请稍后……',
- columns:colums,
- rownumbers:true,
- fitColumns:true
- }).datagrid('loadData',data);
-
-
- }
- function initCharDate(data){
- myChart.clear();
- option.xAxis.data = data.xAxisData;
- option.series = data.series;
- myChart.setOption(option);
- myChart.resize();
- }
- function showTabel(){
- $("#reportChar").hide();
- $("#tablediv").show();
- $("#upexport").show();
- $("#uptb").attr("src","images/tb.png");
- $("#upbg").attr("src","images/bg1.png");
- //$("#attendanceStatsTable").datagrid("resize");
- var h=$(".content").height();
- $('#reportTable').datagrid('resize', {
- height :h-50
- });
-
- }
- function showChar(){
- $("#tablediv").hide();
- $("#reportChar").show();
- $("#upexport").hide();
- $("#uptb").attr("src","images/tb1.png");
- $("#upbg").attr("src","images/bg.png");
- myChart.resize();
- }
- myChart.on('click', function (params) {
- console.log(params);
- var rolefalg = $("#roleFlag").val();
- var attType = $("#attType").val();
- // if(rolefalg == 1){
- $("#upcharheaddiv2").html(params.name + "-"+$("#curYear").val()+"年"+$("#attMonth").val()+"月考勤调整次数统计");
- // $("#upcharheaddiv2").html($("#curYear").val()+"年度项目工资费用");
- // if(attType == 2){
- var data ={
- "attYear" : $("#curYear").val(),
- "attMonth" : $("#attMonth").val(),
- "pid":params.data.id
- };
- handleAjaxSimple("desktopRptController.do?getKaoQinTiaoZhengCount", data, showDownChar);
- // }
- // }
- })
- myChart2.on('click', function (params) {
- console.log(params);
- var rolefalg = $("#roleFlag").val();
- var attType = $("#attType").val();
- // if(rolefalg == 1){
- $("#upcharheaddiv3").html(params.name + "-"+$("#curYear").val()+"年"+$("#attMonth").val()+"月考勤调整次数统计");
- // $("#upcharheaddiv2").html($("#curYear").val()+"年度项目工资费用");
- // if(attType == 2){
- var data ={
- "attYear" : $("#curYear").val(),
- "attMonth" : $("#attMonth").val(),
- "deptId":params.data.id
- };
- handleAjaxSimple("desktopRptController.do?getKaoQinTiaoZhengCount", data, showDown2Char);
- // }
- // }
- })
- function goBefore(){
- $("#reportChar2").css("display","none");
- $("#tablediv2").hide();
- $("#searchColums").show();
- $("#downcharhead").hide();
- $("#reportChar").show();
- $("#upcharhead").show();
- $("#upcharhead2div").hide();
- $("#upBtn").show();
- $("#downBtn").hide();
- $("#downexport").hide();
- $("#downtb").attr("src","images/tb1.png");
- $("#downbg").attr("src","images/bg.png");
- myChart.resize();
- }
- function goBefore2(){
- $("#reportChar3").css("display","none");
- $("#tablediv3").hide();
- $("#searchColums").show();
- $("#downcharhead").hide();
- $("#reportChar2").show();
- $("#upcharhead2div").show();
- $("#upcharhead3div").hide();
- $("#downBtn").show();
- $("#downBtn2").hide();
- //$("#upBtn").show();
- //$("#downBtn").hide();
- //$("#downexport").hide();
- $("#downtb").attr("src","images/tb1.png");
- $("#downbg").attr("src","images/bg.png");
- myChart2.resize();
- }
- //显示下钻图表
- function showDownChar(data){
- $("#reportChar").css("display","none");
- $("#reportChar2").show();
- $("#upBtn").hide();
- $("#downBtn").show();
- $("#searchColums").hide();
- $("#downcharhead").show();
- $("#upcharhead").hide();
- $("#upcharhead2").show();
- $("#yearspan2").html($("#curYear").val());
- $("#downBtn2").hide();
- initDownCharDate(data.cdata);
- initDownTabDate(data.tdata);
-
- }
- function initDownCharDate(data){
- myChart2.clear();
- option2.xAxis.data = data.xAxisData;
- option2.series = data.series;
- myChart2.setOption(option2);
- myChart2.resize();
- }
- function initDownTabDate(data){
- var colums = [[
- {field:'name',title:'部门名称',width:150},
- {field:'count',title:'考勤调整次数(次)',width:150 ,align:'center',halign:'center'},
- {field:'total',title:'考勤调整时长(分钟)',width:150,align:'center',halign:'center'}
- // {field:'peopleTotal',title:peopleTotalStr,width:150 ,align:'right',halign:'center' },
-
- ]]
- $('#reportTable2').datagrid({
- singleSelect : true,
- loadMsg:'数据加载中,请稍后……',
- columns:colums,
- rownumbers:true,
- fitColumns:true
- }).datagrid('loadData',data);
- }
- //显示下钻图表
- function showDown2Char(data){
- $("#reportChar2").css("display","none");
- $("#reportChar3").show();
- $("#upBtn").hide();
- $("#downBtn").hide();
- $("#searchColums").hide();
- $("#downcharhead").show();
- $("#upcharhead2").hide();
- $("#upcharhead3").show();
- $("#yearspan2").html($("#curYear").val());
- $("#downBtn2").show();
- initDown2CharDate(data.cdata);
- initDown2TabDate(data.tdata);
-
- }
- function initDown2CharDate(data){
- myChart3.clear();
- option3.xAxis.data = data.xAxisData;
- option3.series = data.series;
- myChart3.setOption(option3);
- myChart3.resize();
- }
- function initDown2TabDate(data){
- var colums = [[
- {field:'name',title:'员工姓名',width:150},
- {field:'count',title:'考勤调整次数(次)',width:150 ,align:'center',halign:'center'},
- {field:'total',title:'考勤调整时长(分钟)',width:150,align:'center',halign:'center'}
- // {field:'peopleTotal',title:peopleTotalStr,width:150 ,align:'right',halign:'center' },
-
- ]]
- $('#reportTable3').datagrid({
- singleSelect : true,
- loadMsg:'数据加载中,请稍后……',
- columns:colums,
- rownumbers:true,
- fitColumns:true
- }).datagrid('loadData',data);
- }
- function showDownTabelBtn(){
- $("#reportChar2").hide();
- $("#tablediv2").show();
- $("#downexport").show();
- $("#downtb").attr("src","images/tb.png");
- $("#downbg").attr("src","images/bg1.png");
- //$("#attendanceStatsTable2").datagrid("resize");
- var h=$(".content").height();
- $('#reportTable2').datagrid('resize', {
- height :h-50
- });
- }
- function showDownCharBtn(){
- $("#tablediv2").hide();
- $("#downexport").hide();
- $("#downtb").attr("src","images/tb1.png");
- $("#downbg").attr("src","images/bg.png");
- $("#reportChar2").show();
- myChart2.resize();
- }
- function showDownTabelBtn2(){
- $("#reportChar3").hide();
- $("#tablediv3").show();
- $("#downexport").show();
- $("#downtb2").attr("src","images/tb.png");
- $("#downbg2").attr("src","images/bg1.png");
- //$("#attendanceStatsTable2").datagrid("resize");
- var h=$(".content").height();
- $('#reportTable3').datagrid('resize', {
- height :h-50
- });
- }
- function showDownCharBtn2(){
- $("#tablediv3").hide();
- $("#downexport").hide();
- $("#downtb2").attr("src","images/tb1.png");
- $("#downbg2").attr("src","images/bg.png");
- $("#reportChar3").show();
- myChart3.resize();
- }
- function exportExcel(flag){
- var opts;
- if(flag == 1){
- opts = $('#reportTable').datagrid('getColumnFields'); //这是获取到所有的FIELD
- }else{
- opts = $('#reportTable2').datagrid('getColumnFields'); //这是获取到所有的FIELD
- }
- var exceltitles=[];
- for(i=0;i<opts.length;i++)
- {
- //var col = $('div[class$="'+opts[i]+'"] :not(.datagrid-sort-icon)').html();
- var col = $('td[field="'+opts[i]+'"] div :not(.datagrid-sort-icon)').html();
- exceltitles.push(col);//把TITLEPUSH到数组里去
- }
- var formdom = '<form method="post" id="formdom" action="desktopRptController.do?exportExcel"><input name="flag" value="'+flag+'" /><input name="exceltitles" value="'+exceltitles+'" /><input name="exceltitleIds" value="'+opts+'" /></form>';
- $("#export").html(formdom);
- $("#formdom").submit();
- }
|