/** * 运维图形统计 报修 耗材 隐藏 * */ var stateVal = 0,leftHigh,rightHigh; //默认当天 $(function() { //获取数据 getPiedatas(); initPies(); }); //获取数据 function getPiedatas(start,end) { myChart0 = echarts.init(document.getElementById('pieChart0')); $.ajax({ type: "get", url: huayi.config.callcenter_url + "WOReport/GetComplainthandlList", async: false, dataType: 'json', data: { stime: start, endtime: end, questionName:$(".quesType").val(), isEnd:$('#customer_exceed').val(), product:$("#product_name").val(),//产品 salesBase:$("#category").val(),//基地 }, success: function(data) { if(data.state.toLowerCase() == "success") { data = data.rows; if(data.length>0) { leftHigh=data[0].number rightHigh=Math.ceil(data[0].ongesttime) quesTypeData=[]; $(data).each(function(i, n) { //数据 quesTypeData[i]=n.name; }) typeid=[]; $(data).each(function(i, n) { //数据 typeid[i]=n.typeid; }) //数量 numberData = []; $(data).each(function(i, n) { numberData[i] = n.number; }) if ($('#customer_exceed').val()==1) { //超期未完成 endOverdueName="超期未完成"; endOverdueData = []; $(data).each(function(i, n) { endOverdueData[i] = n.Overdue; }) console.log(endOverdueData) }else if($('#customer_exceed').val()==2){ //已回访数量 endOverdueName="已回访" endOverdueData = []; $(data).each(function(i, n) { endOverdueData[i] = n.EndOverdue; }) } //效率提升率 efficiencyData = []; $(data).each(function(i, n) { efficiencyData[i] = n.efficiency.split('%')[0]; }) //平均用时 averageData = []; $(data).each(function(i, n) { averageData[i] = n.averageTime.split('h')[0]; }) //中位数 medianData = []; $(data).each(function(i, n) { medianData[i] = n.median.split('h')[0]; }) //用时最短 minimumtimeData = []; $(data).each(function(i, n) { minimumtimeData[i] = n.minimumtime.split('h')[0]; }) //用时最长 ongesttimeData = []; $(data).each(function(i, n) { ongesttimeData[i] = n.ongesttime.split('h')[0]; }) }else{ //数据 quesTypeData = [] typeid=[] //数量 numberData = [] if ($('#customer_exceed').val()==1) { //超期未完成 endOverdueName="超期未完成"; endOverdueData = []; }else if($('#customer_exceed').val()==2){ //已回访数量 endOverdueName="已回访" endOverdueData = []; } //效率提升率 efficiencyData = []; //平均用时 averageData = []; //中位数 medianData = []; //用时最短 minimumtimeData = []; //用时最长 ongesttimeData = []; } } } }); } //初始化图形 function initPies() { initPie0(); //初始化 工单数量统计 } //初始化 工单数量统计 function initPie0() { myChart0.on('click', function (params) { if(params.componentType == "xAxis"){ }else{ Yname =option.series[7].data[params.dataIndex]; if (Yname=="合计") { Yname="" } $('.tagcloud').html(''); textCon(); } }); var option={ textStyle: { fontSize: 16 * getHeightScale, }, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' } } }, toolbox: { feature: { dataView: { show: false, readOnly: false }, magicType: { show: false, type: ['line','bar'] }, restore: { show: false }, saveAsImage: { show: false } } }, legend: { data: quesTypeData }, color: ['#2FCDCD','#1852B5','#D08065','#1852B5','#1852B5', '#1852B5', '#1852B5'], //color: ['#2F4554','#2F4554','#61A0A8','#D48265','#91C7AE','#749F83', '#CA8622', '#00e9ff'], xAxis: [{ type: 'category', data: quesTypeData, triggerEvent:true, axisPointer: { type: 'shadow' }, axisLine: { //这是x轴文字颜色 lineStyle: { color: "#00e9ff", } }, axisLabel: { textStyle: { fontSize: 16 * getHeightScale // 让字体变大 } } }], yAxis: [{ type: 'value', name: '数量', min: 0, max: leftHigh, interval: Math.ceil(leftHigh/10), splitLine: {     show: false   }, axisLine: { //这是x轴文字颜色 lineStyle: { color: "#00e9ff", } }, axisLabel: { formatter: '{value}', textStyle: { fontSize: 16 * getHeightScale // 让字体变大 } } }, { type: 'value', name: '天', min: 0, max: rightHigh, interval: Math.ceil(rightHigh/10), splitLine: {     show: false   }, axisLine: { //这是x轴文字颜色 lineStyle: { color: "#00e9ff", } }, axisLabel: { formatter: '{value} 天', textStyle: { fontSize: 16 * getHeightScale // 让字体变大 } } } ], series: [ { name: endOverdueName, type: 'bar', data: endOverdueData }, { name: '总数', type: 'bar', data: numberData }, { name: '平均用时', type: 'line', data: averageData, yAxisIndex: 1, smooth: true } , { name: '中位数', type: 'line', symbolSize: 0, // symbol的大小设置为0 showSymbol: false, // 不显示symbol lineStyle: { normal: { color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的 width: 0 } }, data: medianData }, { name: '效率提升率(%)', type: 'line', symbolSize: 0, // symbol的大小设置为0 showSymbol: false, // 不显示symbol lineStyle: { normal: { color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的 width: 0 } }, data: efficiencyData }, { name: '用时最短', type: 'line', symbolSize: 0, // symbol的大小设置为0 showSymbol: false, // 不显示symbol lineStyle: { normal: { color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的 width: 0 } }, data: minimumtimeData }, { name: '用时最长', type: 'line', symbolSize: 0, // symbol的大小设置为0 showSymbol: false, // 不显示symbol lineStyle: { normal: { color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的 width: 0 } }, data: ongesttimeData } , { name: '问题ID', type: 'line', symbolSize: 0, // symbol的大小设置为0 showSymbol: false, // 不显示symbol lineStyle: { normal: { color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的 width: 0 } }, data: typeid } ] } myChart0.setOption(option) }