/** * Created by mac on 18/5/17. */ $('#devicereport-toptab li').on('click',function () { var _index = $(this).index(); switch (_index){ case 0: $('.parkincome-choosedatemonth').addClass('display-none'); $('.parkincome-choosedateweek').addClass('display-none'); $('.parkincome-choosedateday').removeClass('display-none'); $('#devicereport-toptab li').eq(0).addClass('ITD-graynav-topbaractive').siblings().removeClass('ITD-graynav-topbaractive'); $("#timeType").val(1); break; case 1: $('.parkincome-choosedateday').addClass('display-none'); $('.parkincome-choosedatemonth').addClass('display-none'); $('.parkincome-choosedateweek').removeClass('display-none'); $('#devicereport-toptab li').eq(1).addClass('ITD-graynav-topbaractive').siblings().removeClass('ITD-graynav-topbaractive'); $("#timeType").val(3); break; case 2: $('.parkincome-choosedateday').addClass('display-none'); $('.parkincome-choosedateweek').addClass('display-none'); $('.parkincome-choosedatemonth').removeClass('display-none'); $('#devicereport-toptab li').eq(2).addClass('ITD-graynav-topbaractive').siblings().removeClass('ITD-graynav-topbaractive'); fun.monthDate(); $("#timeType").val(2); } fun.ltsrcreateTableData(); fun.carFlowQueryData(); }); var fun= { init: function () { fun.dayDate(); fun.weekDate(); fun.monthDate(); fun.ltsrcreateTableData(); fun.carFlowQueryData(); }, dayDate:function() { $('#incomepark-daydaterange-btnsta').val(moment().subtract('days', 1).format('YYYY-MM-DD')); $('#incomepark-daydaterange-btnsta').datetimepicker({ endDate: moment().subtract('days', 1).format('YYYY-MM-DD'), format: 'yyyy-mm-dd', autoclose: true, startView: 2, //maxDate:moment().subtract('months', 3), minView: 2, forceParse: false, locale: "zh-CN", language: 'zh-CN', pickerPosition: "bottom-right" }) }, weekDate:function() { $('#incomepark-weekdaterange-btnsta').attr('data-text',moment().subtract('days', 7).format('YYYY-MM-DD')+'-'+moment().subtract('days', 1).format('YYYY-MM-DD')) $('#incomepark-weekdaterange-btnsta').html(moment().subtract('days', 7).format('YYYY-MM-DD')+' 至 '+moment().subtract('days', 1).format('YYYY-MM-DD')); }, monthDate:function() { $('#incomepark-monthdaterange-btnsta').val(moment().subtract('months', 1).format('YYYY-MM')); $('#incomepark-monthdaterange-btnsta').datetimepicker({ endDate: moment().subtract('months', 1).format('YYYY-MM'), format: 'yyyy-mm', autoclose: true, startView: 3, //maxDate:moment().subtract('months', 3), minView: 3, forceParse: false, locale: "zh-CN", language: 'zh-CN', pickerPosition: "bottom-right" }) }, srzbChartsFun:function (dataValue) { console.log(dataValue); var srzbechartsPie = echarts.init(document.getElementById('parkinglengthport-echart')); srzboption = { color:['#1E95CD','#5fe98f','#fdc94d','#50c0f5'], title: { // subtext: "" + totalFee, // text: '总计', textStyle: { color: '#c2c2c2', fontSize: '14', align: 'middle', verticalAlign: 'middle', }, subtextStyle: { color: '#000', fontSize: '24', align: 'middle', verticalAlign: 'middle', }, left: 'center', top: '60', }, tooltip: { trigger: 'item', formatter: "{a}
{b}: {c} ({d}%)" }, legend: { selectedMode:false, orient: 'horizontal', bottom: '0', icon:'circle', data:['支付宝','微信','余额','现金'] }, series: [ { name:'支付方式占比', type:'pie', radius: ['50%', '70%'], center: ['50%', '50%'], hoverAnimation: false, avoidLabelOverlap: false, legendHoverLink: false, label: { normal: { show: false, position: 'center' }, emphasis: { show: false, textStyle: { fontSize: '14', } } }, labelLine: { normal: { show: false } }, data:[1,2,3,4] } ] } srzbechartsPie.setOption(srzboption, true); window.srzbechartsPie=srzbechartsPie; //自适应 window.onresize = function(){ srzbechartsPie.resize(); }; }, ltsrcreateTableData: function () { $('#devicereport-table').bootstrapTable('destroy').bootstrapTable({ striped: true,//表格显示条纹 pagination: true, //启动分页 pageNumber: 1, //当前第几页 pageSize: 10, //每页显示的记录数 pageList: [10, 15, 20], //记录数可选列表 sidePagination: 'server',//表示服务端分页 queryParamsType: 'limit', sortable: true, //是否启用排序 sortOrder: "asc", method: 'POST',//请求方法 paginationPreText: '<', paginationNextText: '>', ajax: incomeparktableLoadRequest,//自定义ajax加载数据 // uniqueId:'id', columns: [ { field: 'number', title: '序号', width: '15%', align: "left", formatter:function(value,row,index){ //return index+1; //序号正序排序从1开始 var pageSize=$('#devicereport-table').bootstrapTable('getOptions').pageSize;//通过表的#id 可以得到每页多少条 var pageNumber=$('#devicereport-table').bootstrapTable('getOptions').pageNumber;//通过表的#id 可以得到当前第几页 var operStr=''; var topNo=pageSize * (pageNumber - 1) + index + 1; /*if(topNo==1){ operStr =''+topNo+''; return operStr; //返回每条的序号: 每页条数 * (当前页 - 1 )+ 序号 }else if(topNo==2){ operStr =''+topNo+''; return operStr; //返回每条的序号: 每页条数 * (当前页 - 1 )+ 序号 }else if(topNo==3){ operStr =''+topNo+''; return operStr; //返回每条的序号: 每页条数 * (当前页 - 1 )+ 序号 }else { }*/ operStr =''+topNo+''; return operStr; //返回每条的序号: 每页条数 * (当前页 - 1 )+ 序号 } }, { field: 'plName', title: '车场名称', width: '25%', align: "left", formatter:commonObj.replacenull }, { field: 'plType', title: '车场类型', width: '25%', align: "left", formatter: plTypeFormatter }, { field: 'totalBerths', title: '泊位数量', width: '20%', align: "left", formatter:commonObj.replacenull }, { field: 'inParkCount', title: '进场', width: '20%', align: "left", formatter:commonObj.replacenull }, { field: 'outParkCount', title: '出场', width: '20%', align: "left", formatter:commonObj.replacenull }, { field: 'turnoverRatio', title: '周转次数', width: '20%', align: "left", formatter: turnOverFormatter }, { field: 'freeRatio', title: '占用率', width: '20%', align: "left", formatter: freeRatioFormatter }, ] }); }, /*获取查询参数*/ incomeparkgetQueryParam: function () { var data = fn.getParkLot(); var plNos = []; for (var i = 0; i < data.length; i++) { plNos.push(data[i].code); } if (plNos.length < 1) { plNos.push("-1X"); } /*开始时间*/ var beginTime; /*结束时间*/ var endTime; var timeType=$("#timeType").val(); if(timeType==1){ var reportDate=$("#incomepark-daydaterange-btnsta").val(); $("#carFlowTitle").text("日"); $("#carFlowTitleTime").text(reportDate); beginTime=reportDate+" 00:00:00"; endTime=reportDate+" 23:59:59"; }else if(timeType==3){ var reportDate=$("#incomepark-weekdaterange-btnsta").attr('data-text'); $("#carFlowTitle").text("周"); var reportDateStr=$("#incomepark-weekdaterange-btnsta").html(); $("#carFlowTitleTime").text(reportDateStr); // console.log(reportDate); beginTime=reportDate.substring(0,11)+" 00:00:00"; endTime=reportDate.substring(11,21)+" 23:59:59"; //console.log(endTime); }else if(timeType==2){ var reportDate=$("#incomepark-monthdaterange-btnsta").val(); $("#carFlowTitle").text("月"); $("#carFlowTitleTime").text(reportDate); beginTime = reportDate + "-01 00:00:00"; var dates = reportDate.split("-"); if (dates[1] == '02') { endTime = reportDate + "-28 23:59:59"; } else if (dates[1] == '01' || dates[1] == '03' || dates[1] == '05' || dates[1] == '07' || dates[1] == '08' || dates[1] == '10' || dates[1] == '12') { endTime = reportDate + "-31 23:59:59"; } else { endTime = reportDate + "-30 23:59:59"; } } beginTime = beginTime == null || beginTime.length == 0 ? null : new Date((beginTime).replace(/-/g, "/")); endTime = endTime == null || endTime.length == 0 ? null : new Date((endTime).replace(/-/g, "/")); var req = { sysCode: sysComm.sysCode, plNos: plNos, beginTime: beginTime, endTime:endTime, timeType:timeType }; return req; }, carFlowQueryData:function () { var data = fn.getParkLot(); $("#orgNameTitle").text(data[0].orgName==null?"":data[0].orgName); $("#allParkCount").text(0); $("#openParkCount").text(0); $("#closeParkCount").text(0); $("#berthsNum").text(0); $("#openBerthNum").text(0); $("#closeBerthNum").text(0); $("#allInCarCount").text(0); $("#closeInCarCount").text(0); $("#openInCarCount").text(0); $("#allOutCarCount").text(0); $("#closeOutCarCount").text(0); $("#openOutCarCount").text(0); $("#allTurnRatioCount").text(0); $("#closeTurnRatioCount").text(0); $("#openTurnRatioCount").text(0); var req=fun.incomeparkgetQueryParam(); //条件查询 req.baseRequest = { pageNum: 1, pageSize:0 }; req.sysCode = sysComm.sysCode; var opt = { method: 'post', url: dataUrl.util.queryCarFlowByDayForListForPage(), data: JSON.stringify(req), contentType: 'application/json; charset=utf-8', dataType: 'json', success: function (res) { console.log(res); if (res.code == '8888') { var data=res.data; var openInCarCount = 0; var closeInCarCount = 0; var allInCarCount = 0; var openOutCarCount = 0; var closeOutCarCount = 0; var allOutCarCount = 0; var openTurnRatioCount = 0; var closeTurnRatioCount = 0; var allTurnRatioCount = 0; var openUseRatio = 0; var closeUseRatio = 0; var allUseRatio = 0; var openCount=0; var closeCount=0; var count=0; var outParkCount=0; var berthsNum = 0; var openBerthNum=0; var closeBerthNum=0; if(data!=null && data.rows!=null && data.rows.length>0){ var data=data.rows; for (var i = 0; i < data.length; i++) { if (parseInt(data[i].plType) == 1) { openInCarCount +=parseInt(data[i].inParkCount); openOutCarCount +=parseInt(data[i].outParkCount); openTurnRatioCount +=parseInt(data[i].turnoverRatio); openUseRatio +=((1-data[i].freeRatio)*100); openCount+=1; openBerthNum +=parseInt(data[i].totalBerths); } else { closeInCarCount +=parseInt(data[i].inParkCount); closeOutCarCount +=parseInt(data[i].outParkCount); closeTurnRatioCount +=parseInt(data[i].turnoverRatio); closeUseRatio +=((1-data[i].freeRatio)*100); closeCount+=1; closeBerthNum +=parseInt(data[i].totalBerths); } allInCarCount += parseInt(data[i].inParkCount); allOutCarCount += parseInt(data[i].outParkCount); allTurnRatioCount += parseInt(data[i].turnoverRatio); allUseRatio += ((1-data[i].freeRatio)*100); count+=1; berthsNum += parseInt(data[i].totalBerths); } } $("#allParkCount").text(count); $("#openParkCount").text(openCount); $("#closeParkCount").text(closeCount); $("#berthsNum").text(berthsNum); $("#openBerthNum").text(openBerthNum); $("#closeBerthNum").text(closeBerthNum); $("#allInCarCount").text(allInCarCount); $("#closeInCarCount").text(closeInCarCount); $("#openInCarCount").text(openInCarCount); $("#allOutCarCount").text(allOutCarCount); $("#closeOutCarCount").text(closeOutCarCount); $("#openOutCarCount").text(openOutCarCount); //周转次数=进场次数/泊位数 // $("#allTurnRatioCount").text((allInCarCount/berthsNum).toFixed(2)); // $("#closeTurnRatioCount").text((closeInCarCount/closeBerthNum).toFixed(2)); // $("#openTurnRatioCount").text((openInCarCount/openBerthNum).toFixed(2)); $("#allTurnRatioCount").text((allInCarCount/(berthsNum<1?1:berthsNum)).toFixed(2)); $("#closeTurnRatioCount").text((closeInCarCount/(closeBerthNum<1?1:closeBerthNum)).toFixed(2)); $("#openTurnRatioCount").text((openInCarCount/(openBerthNum<1?1:openBerthNum)).toFixed(2)); // console.log(allUseRatio); // console.log(count); // console.log(closeUseRatio); // console.log(closeCount); // console.log(openUseRatio); // console.log(openCount); if(count==0){ $("#allUseRatio").text(allUseRatio.toFixed(2)); }else{ $("#allUseRatio").text((allUseRatio/count).toFixed(2)); } if(closeCount==0){ $("#closeUseRatio").text(closeUseRatio.toFixed(2)); }else{ $("#closeUseRatio").text((closeUseRatio/closeCount).toFixed(2)); } if(openCount==0){ $("#openUseRatio").text(openUseRatio.toFixed(2)); }else{ $("#openUseRatio").text((openUseRatio/openCount).toFixed(2)); } } } }; sysAjax(opt); }, }; fun.init(); /** * 默认table 函数 * 自定义table AJAX请求 * @param {Object} params */ function incomeparktableLoadRequest(params) { var req = fun.incomeparkgetQueryParam(); //设置请求参数 var pageNum = (params.data.offset / params.data.limit) + 1; //条件查询 req.baseRequest = { pageNum: pageNum, pageSize: params.data.limit }; req.sysCode = sysComm.sysCode; var opt = { method: 'post', url: dataUrl.util.queryCarFlowByDayForListForPage(), data: JSON.stringify(req), contentType: 'application/json; charset=utf-8', dataType: 'json', success: function (res) { console.log(res); if (res.code == '8888') { params.success(res.data); } } }; sysAjax(opt); } function plTypeFormatter(value){ if(1==parseInt(value)){ return "路侧" }else if(2==parseInt(value)){ return "封闭" }else{ return "未知" } } function turnOverFormatter(value){ if(value==null || value==undefined || value=="0"){ return "0"; }else{ return value.toFixed(2); } } function freeRatioFormatter(value){ var useRatio=(1-value)*100; if(parseInt(useRatio)<=0){ return "0%" }else if(parseInt(useRatio)>0 && parseInt(useRatio)<100){ return useRatio.toFixed(2)+"%"; }else{ return "100%" } } //点击搜索 documentBindFunc.on('click', '#incomepark-billQueryBnt', function () { fun.ltsrcreateTableData(); fun.carFlowQueryData(); }); //车流量打印 $(document).on('click','#carFlowPrint',function(){ //; var data = fn.getParkLot(); var orgName=""; var plNos = []; for (var i = 0; i < data.length; i++) { plNos.push(data[i].code); orgName=data[i].orgName; } if (plNos.length < 1) { plNos.push("-1X"); } /*开始时间*/ var beginTime; /*结束时间*/ var endTime; var timeType=$("#timeType").val(); if(timeType==1){ var reportDate=$("#incomepark-daydaterange-btnsta").val(); $("#carFlowTitle").text("日"); $("#carFlowTitleTime").text(reportDate); beginTime=reportDate+" 00:00:00"; endTime=reportDate+" 23:59:59"; }else if(timeType==3){ var reportDate=$("#incomepark-weekdaterange-btnsta").attr('data-text'); $("#carFlowTitle").text("周"); $("#carFlowTitleTime").text(reportDate); beginTime=reportDate.substring(0,10)+" 00:00:00"; endTime=reportDate.substring(11,reportDate.length)+" 23:59:59"; }else if(timeType==2){ var reportDate=$("#incomepark-monthdaterange-btnsta").val(); $("#carFlowTitle").text("月"); $("#carFlowTitleTime").text(reportDate); beginTime = reportDate + "-01 00:00:00"; var dates = reportDate.split("-"); if (dates[1] == '02') { endTime = reportDate + "-28 23:59:59"; } else if (dates[1] == '01' || dates[1] == '03' || dates[1] == '05' || dates[1] == '07' || dates[1] == '08' || dates[1] == '10' || dates[1] == '12') { endTime = reportDate + "-31 23:59:59"; } else { endTime = reportDate + "-30 23:59:59"; } } var orgId=fn.getOrgId(); //var orgName="中兴智能"; var userName=fn.getUserName(); var url = dataUrl.util.carFlowPrint(); var openUrl = "";//弹出窗口的url var iWidth=800; //弹出窗口的宽度; var iHeight=800; //弹出窗口的高度; var iTop = (window.screen.availHeight-80-iHeight)/2; //获得窗口的垂直位置; var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置; var win= window.open('',"","height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+",location=no,resizable=no"); var html="
"; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+=""; html+="
"; html += "