var indexName = {'index_128': '预约总量', 'index_129': '居民预约量', 'index_130': '代预约量'}; function getSignDate(){ //获取初始化签约年 var nowdate = new Date(); var year = nowdate.getFullYear(); var month = nowdate.getMonth() + 1; if(year>=2023){ year = year }else if(month<=6){ year = year - 1 } return year } function getStartDate(chooseYear){ // 按年度来计算的时候,开始时间是该年度7月1号还是到下一个年的6月30号结束 // 2022年及以前开始时间07-01 // 2023及以后开始时间01-01 if(chooseYear == 2016){ return chooseYear + "-08-01"; }else if(chooseYear <= 2022) { return chooseYear+'-07-01'; }else if(chooseYear >= 2023){ return chooseYear+'-01-01'; } } //获取结束时间 function getEndDate(chooseYear){ var nowdate = new Date(); var year = nowdate.getFullYear(); var month = nowdate.getMonth() + 1; var day = nowdate.getDate(); var endDate = '' if(chooseYear < '2022') { endDate = new Date((parseInt(chooseYear)+1) + '-06-30'); }else{ endDate = new Date((parseInt(chooseYear)) + '-12-31'); } var now = new Date(); if(now <= endDate){ return now.format("yyyy-MM-dd"); }else{ if(chooseYear < '2022') { return (parseInt(chooseYear)+1) + '-06-30'; }else{ return (parseInt(chooseYear)) + '-12-31'; } } } //获取结束时间29 function getEndDate29(chooseYear){ chooseYear = parseInt(chooseYear); var endDate = new Date((chooseYear+1) + '-06-29'), now = new Date(); if(now <= endDate){ return now.format("yyyy-MM-dd"); }else{ return (chooseYear+1) + '-06-29'; } } /** * 获取多少天前的日期 */ function getDateBefore(days) { var now = new Date(); var date = new Date(now.getTime() - days * 24 * 3600 * 1000); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day); } /* * 获取用来排序的字段值,返回数组 * 参数: list - 列表, key - 字段的名称 */ function getKeyValueArr(list, key){ var arr = []; for(var k in list){ arr.push(list[k][key]); } return arr; } /* * 排名 */ function soreRank(arr){ var temp = []; var lis = []; for(var i=0;i10 ){ dataZoom_end = 100-(9/yData.length)*100; }else{ dataZoom_end = 0; } } setTimeout(function(){ EventBus.$emit("draw-line-chart", { panelName : title, quotaNames : names, xData : xDatas[0], yDatas : yDatas, colors : colors, selectedDateType: selectedDateType, nowlineid : elId, unit:unit }); },10) } /** * 绘制柱状图数据处理 * @param {Object} elId div的id值 * @param {Object} data 数据值 */ function getBarData(arg){ var dataZoom_end, xDatas = [], yDatas = [], names = [], colors = ['#12b7f5', '#cd67fd','#FF9526']; if(arg.colors){ colors = arg.colors } for(var p in arg.data){ if(arg.hasLegend){ names.push(arg.indexNames[p]); } var xData = _.map(arg.data[p].data||arg.data[p], function(o){ return o[arg.rangeParams]||o.range; }); var yData = _.map(arg.data[p].data||arg.data[p], function(o){ return o[arg.amountParams]||o.amount; }); xDatas.push(xData); yDatas.push(yData); var lastIndex = yData.length % 10; if(yData.length >10 ){ dataZoom_end = 100-(9/yData.length)*100; }else{ dataZoom_end = 0; } } if(arg.typeV){ drawBarV({elId:arg.elId, name:names, dataZoom_end:dataZoom_end, xData:xDatas[0], yDatas:yDatas, colors:colors,barCategoryGap:arg.barCategoryGap,argInit:arg}) }else{ drawBarH({elId:arg.elId, name:names, dataZoom_end:dataZoom_end, xData:xDatas[0], yDatas:yDatas, colors:colors,barCategoryGap:arg.barCategoryGap,argInit:arg}) } } function drawBarH(arg){ var barCharts = echarts.init(document.getElementById(arg.elId)); var options = { tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' }, textStyle:{ align:'left' }, formatter:function(datas){ var res = datas[0].name + '
' for (var i = 0, length = datas.length; i < length; i++) { var unit = "" if(arg.argInit.units){ unit = arg.argInit.units[datas[i].seriesName] } res += datas[i].seriesName + ':' + datas[i].value + unit +'
' } return res } }, calculable: false, grid: { borderWidth: 0, top:'20px', left: '20px', right: '20px', bottom: '20px', containLabel: true }, xAxis: [{ type: 'category', axisLine: { lineStyle: { type: 'solid', color: '#333333', //左边线的颜色 width: '1' //坐标线的宽度 } }, axisTick: { show: false }, splitArea: { show: false }, splitLine: { show: false }, data: arg.xData }], yAxis: [{ type: 'value', axisTick: { show: false }, splitArea: { show: false }, splitLine: { show: false }, axisLine: { lineStyle: { type: 'solid', color: '#333333', //左边线的颜色 width: '1' //坐标线的宽度 } }, }], } var series = []; for(var i=0; i' for (var i = 0, length = datas.length; i < length; i++) { var unit = "" if(arg.argInit.units){ unit = arg.argInit.units[datas[i].seriesName] } res += datas[i].seriesName + ':' + datas[i].value + unit +'
' } return res } }, calculable: false, grid: { borderWidth: 0, top:'5%', left: '3%', right: '10%', bottom: '5%', containLabel: true }, yAxis: [{ type: 'category', axisLine: { lineStyle: { type: 'solid', color: '#333333', //左边线的颜色 width: '1' //坐标线的宽度 } }, axisTick: { show: false }, splitArea: { show: false }, splitLine: { show: false }, data: arg.xData }], xAxis: [{ type: 'value', axisTick: { show: false }, splitArea: { show: false }, splitLine: { show: false }, axisLine: { lineStyle: { type: 'solid', color: '#333333', //左边线的颜色 width: '1' //坐标线的宽度 } }, }], } var series = []; for(var i=0; i provideNumber) { for (var p = 0; p < rowNumber; p++) { var tempStr = ""; var start = p * provideNumber; var end = start + provideNumber; if (p == rowNumber - 1) { tempStr = params.substring(start, paramsNameNumber); } else { tempStr = params.substring(start, end) + "\n"; } newParamsName += tempStr; } } else { newParamsName = params; } return newParamsName } } return option; }