cashieraudit.js 32.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018
//导出功能
window.downloadFile = function (sUrl) {

    //iOS devices do not support downloading. We have to inform user about this.
    if (/(iP)/g.test(navigator.userAgent)) {
        alert('Your device does not support files downloading. Please try again in desktop browser.');
        return false;
    }

    //If in Chrome or Safari - download via virtual link click
    if (window.downloadFile.isChrome || window.downloadFile.isSafari) {
        //Creating new link node.
        var link = document.createElement('a');
        link.href = sUrl;

        if (link.download !== undefined) {
            //Set HTML5 download attribute. This will prevent file from opening if supported.
            var fileName = sUrl.substring(sUrl.lastIndexOf('/') + 1, sUrl.length);
            link.download = fileName;
        }

        //Dispatching click event.
        if (document.createEvent) {
            var e = document.createEvent('MouseEvents');
            e.initEvent('click', true, true);
            link.dispatchEvent(e);
            return true;
        }
    }

    // Force file download (whether supported by server).
    if (sUrl.indexOf('?') === -1) {
        sUrl += '?download';
    }

    window.open(sUrl, '_self');
    return true;
}

window.downloadFile.isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
window.downloadFile.isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
var casauditfun= {
    init:function () {
        //办事处初始化
        //停车场初始化
        casauditfun.initParkBlock();
        //收费员初始化
        $('#casaudit-person').selectpicker('render');
        //块下拉框变化,停车场下拉框变化
        casauditfun.queryBlockChange();
        //停车场下拉框变化,收费员下拉框变化
        casauditfun.queryParkChange();
        /** 时间初始化 **/
        $('#casaudit-daterange-btnsta').val(moment().subtract('days',0).format('YYYY-MM-DD'));
        $('#casaudit-daterange-btnend').val(moment().subtract('days', 0).format('YYYY-MM-DD'));
        //开始日期
        $("#casaudit-daterange-btnsta").datetimepicker({
            endDate: moment().subtract('days', 0).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"
        })
        //结束日期
        $("#casaudit-daterange-btnend").datetimepicker({
            endDate: moment().subtract('days', 0).format('YYYY-MM-DD'),
            //startDate:startVal,
            format: 'yyyy-mm-dd',
            weekStart: 1,
            autoclose: true,
            startView: 2,
            minView: 2,
            forceParse: false,
            locale: "zh-CN",
            language: 'zh-CN',
            pickerPosition: "bottom-right"
        })

        //饼图 统计
        queryPdaAndEqpTypeNums();
        //柱形图 echarts
        queryInputNumsByTimes();
        //折线图 echarts
        queryEqpAndPdaTimesForLine();
        // table
        casauditfun.casauditcreateTableData();

    },
    //导出函数
    exportEqpInOutParkAllStatisticExcel:function(){
        //校验日期
        var req = casauditfun.getQueryParam();
        var datesta = $("#casaudit-daterange-btnsta").val();
        var dateend = $("#casaudit-daterange-btnend").val();
        var beginTime = datesta+" 00:00:00";
        var endTime=dateend+" 23:59:59";
        var plBlockIds = JSON.parse($("#casaudit-plAreaBlockIds").val());
        var plnos = $("#casaudit-parkIds").val();
        var plNos = new Array();
        if(plnos==null||plnos==''){
            plNos.push("-1X");
        }
        else{
            plNos = JSON.parse(plnos);
        }
        var chargerCodes = JSON.parse($("#casaudit-plAreaBlockIds").val());
        var url = dataUrl.util.exportEqpAndPdaReportTimeList() + '?chargerCodes=' + req.chargerCodes + '&entryType=' + req.entryType + '&inOutState=' + req.inOutState + '&plNos=' + req.plNos + '&plBlockIds=' + req.plBlockIds  + '&beginTime=' + beginTime + '&endTime=' + endTime +'&sysCode='+sysComm.sysCode;
        window.downloadFile(url);
    },

    //停车区域-块
    initParkBlock: function () {
        var data = fn.getParkBlock();
        var html = '';
        var htmls = '';
        var blockIds = [-1];
        for (var i = 0; i < data.length; i++) {
            blockIds.push(data[i].code);
            html += "<option value='[\"" + data[i].code + "\"]'>" + data[i].name + "</option>";
        }
        var blockIdsStr = JSON.stringify(blockIds);
        htmls = '<option value=' + blockIdsStr + ' selected>所有办事处</option>' + html;

        $("#casaudit-plAreaBlockIds").empty();

        $("#casaudit-plAreaBlockIds").append(htmls);
        $('#casaudit-plAreaBlockIds').selectpicker('render');
        //加载下拉框
        casauditfun.initParkSelect();

    },
    //根据块信息查询停车场信息
    initParkSelect:function(){
        //停车场下拉框
        var data = casauditfun.getParkingLotMsg();
        var htmls = '';
        var html = '';
        var plNos = [];
        for (var i = 0; i < data.length; i++) {
            plNos.push(data[i].plNo);
            html += "<option value='[\"" + data[i].plNo + "\"]'>" + data[i].plName + "</option>";
        }
        var plnosStr = JSON.stringify(plNos);
        htmls = '<option value=' + plnosStr + ' selected>所有停车场</option>' + html;

        $("#casaudit-parkIds").empty();
        $("#casaudit-parkIds").append(htmls);
        $('#casaudit-parkIds').selectpicker('refresh');

        /*$("#parkIds1").empty();
        $("#parkIds1").append(htmls);
        $('#parkIds1').selectpicker('refresh');*/
        //收费员初始化
        casauditfun.initChargerSelect();

    },
    //根据停车场编号查询收费员信息
    initChargerSelect:function(){
        //停车场下拉框
        var data = casauditfun.getChargerMsg();
        var htmls = '';
        var html = '';
        var chargerCodes = [];
        for (var i = 0; i < data.length; i++) {
            chargerCodes.push(data[i].chargerCode);
            html += "<option value='[\"" + data[i].chargerCode + "\"]'>" + data[i].chargerCode + "-" + data[i].chargerName + "</option>";
        }
        var chargerCodesStr = JSON.stringify(chargerCodes);
        htmls = '<option value=' + chargerCodesStr + ' selected>所有收费员</option>' + html;

        $("#casaudit-person").empty();
        $("#casaudit-person").append(htmls);
        $('#casaudit-person').selectpicker('refresh');

    },
    getParkingLotMsg:function(){
        var plAreaBlockIds;
        plAreaBlockIds = JSON.parse($("#casaudit-plAreaBlockIds").val());
        var parkLot = "";
        var req = {
            sysCode:sysComm.sysCode,
            areaBlockIds: plAreaBlockIds
        };
        var opt = {
            async: false,
            data:JSON.stringify(req),
            method: "POST",
            //contentType:"application/x-www-form-urlencoded; charset=UTF-8",
            url: dataUrl.util.getParkListByBlockIds(),
            success: function (res) {
                if (res.code == '8888') {
                    parkLot = JSON.stringify(res.data);
                }
            }
        }
        sysAjax(opt);
        return JSON.parse(parkLot);
    },
    getChargerMsg:function(){
//      var plNos;
//      plNos = JSON.parse($("#casaudit-parkIds").val());
//      var plNo = "";
//      if (plNos.length > 1) {
//          plNo = "";
//      } else {
//          plNo = plNos[0];
//      }
        var chargers = "";
        var req = {
        	baseRequest:{pageNum: 1, pageSize: 0},
            plNo: null,
            parkAreaCode: "",
            groupCode: "",
            onduty: "",
            status: "",
            nameOrNo: "",
            orgId:fn.getOrgId(),
            sysCode: sysComm.sysCode
        };
        var opt = {
            async: false,
            data:JSON.stringify(req),
            method: "POST",
            url: dataUrl.util.queryCashierListInfo(),
            success: function (res) {
                if (res.code == '8888') {
                    chargers = JSON.stringify(res.data.rows);
                }
            }
        }
        sysAjax(opt);
        return JSON.parse(chargers);
    },
    //块改变查询停车场
    queryBlockChange:function(){
        $("#casaudit-plAreaBlockIds").change(function(){
            casauditfun.initParkSelect();
        });
    },
    //停车场改变查询收费员
    queryParkChange:function(){
        $("#casaudit-parkIds").change(function(){
//          casauditfun.initChargerSelect();
        });
    },
    /*获取查询参数*/
    getQueryParam: function() {
        var plBlockIds = JSON.parse($("#casaudit-plAreaBlockIds").val());
        var plNos = [];
        var plnos = $("#casaudit-parkIds").val();
        if(plnos==null||plnos==''){
            plNos.push("-1X");
        }
        else{
            plNos = JSON.parse(plnos);
        }
        var chargerCodes = [];
        var chargercodes = $("#casaudit-person").val();
        if(chargercodes==null||chargercodes==''){
            chargerCodes.push("-1X");
        }
        else{
            chargerCodes = JSON.parse(chargercodes);
        }
        if(chargerCodes.length > 1){
            chargerCodes = [];
        }
        var datesta = $("#casaudit-daterange-btnsta").val();
        var dateend = $("#casaudit-daterange-btnend").val();
        var beginTime = datesta+" 00:00:00";
        var endTime=dateend+" 23:59:59";
		//进出场状态 进场-1 出场-0 全部--1
		var inOutState = $("#cashieraudit-toptab .ITD-graynav-topbaractive").attr('value');
		if(inOutState == null || inOutState==''){
			inOutState = -1;
		}
		//折线图 0-按小时统计 1-按天统计
		var timeType = 1;//默认按天
		if(datesta == dateend){//按小时
			timeType = 0;
		}
		//详情列表 0-未录入 1-录入 -1-全部
		var entryType = -1;
		entryType = $("#tab-btn-wrap .tabAction").attr('value');
        var req = {
            sysCode: sysComm.sysCode,
            plBlockIds: plBlockIds,
            plNos: plNos,
            chargerCodes:chargerCodes,
            beginTime: new Date(beginTime.replace(new RegExp(/-/gm) ,"/")),
            endTime: new Date(endTime.replace(new RegExp(/-/gm) ,"/")),
            inOutState:inOutState,
            timeType:timeType,
            entryType:entryType,
            inType:1,
            outType:1
        };

        return req;
    },
    lineecharts:function (data) {
    	var eqpTimes=[];
    	var pdaTimes=[];
    	var staticTime=[];
    	var timeType = casauditfun.getQueryParam().timeType;
    	
    	if(data != null && data.length > 0){
    		$.each(data, function(index,item) {
    			eqpTimes.push(item.eqpTimes);
    			pdaTimes.push(item.pdaTimes);
    			if(timeType == 0){
    				staticTime.push((item.staticTime).substr(10,12)+':00');
    			}else{
    				staticTime.push((item.staticTime).substr(5,10));
    			}
    			
    		});
    	}
        var incomeecharts = echarts.init(document.getElementById('cashieraudit-line-echarts'));
        var incomeoption = {
            color:['#1e95cd','#5fe98f'],
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                right: '2%',
                top: '0',
                textStyle: {
                    color: '#888990',
                },
                itemWidth: 18,
                itemHeight: 10,
                data: ['设备上报次数', '设备录入次数']
            },
            grid: {
                top: '13%',
                left: '1%',
                right: '2%',
                bottom: '2%',
                containLabel: true
            },

            xAxis: {
                type: 'category',
                boundaryGap: true,
                data:staticTime,

                axisLabel: {
                    // interval:2,
                    show: true,
                    textStyle: {
                        color: 'rgba(0,0,0,0.5)',
                        fontSize:'12px',
                        fontFamily:'微软雅黑'
                    }
                },
                // splitNumber:10,
                // minInterval:2,
                axisTick: {
                    show: false,
                },
                splitLine:{
                    lineStyle:{
                        color:'rgba(0,0,0,0.1)',
                    }
                },

                axisLine: {
                    show: true,
                    lineStyle: {
                        color: 'rgba(0,0,0,0.1)',
                        // width: 1,//这里是为了突出显示加上的
                    }
                },

            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    show: true,
                    textStyle: {
                        color: 'rgba(0,0,0,0.5)',
                        fontSize:'12px',
                        fontFamily:'微软雅黑'
                    }
                },
                axisLabel: { //调整y轴的lable
                    textStyle: {
                        color: 'rgba(0,0,0,0.5)',
                    }
                },
                axisTick: {
                    show: false
                },

                axisLine: {
                    lineStyle: {
                        color: 'rgba(0,0,0,0.1)',
                        width: 1,//这里是为了突出显示加上的
                    }
                },
                splitLine:{
                    lineStyle:{
                        // type:'dashed',
                        color:'rgba(0,0,0,0.1)',
                    }
                }
            },
            series: [
                {
                    name: '设备上报次数',
                    type: 'line',
                    // symbol:'none',
                    // smooth:true,
                    data:eqpTimes,
                    // data:[4,1,6,2,9,4,1,6,2,9,8,1],
                    itemStyle : {
                        normal : {
                            lineStyle:{
                                color:'#f0f0f2',
                            }
                        }
                    },
                    areaStyle: {
                        normal: {
                            color: '#1e95cd',
                            opacity:.2
                        }
                    },
                    lineStyle: {
                        normal: {
                            color:'#1e95cd',
                            width:2,
                        }
                    }
                },
                {
                    name: '设备录入次数',
                    type: 'line',
                    // symbol:'none',
                    // smooth:true,
                    data:pdaTimes,
                    // data:[43,13,26,24,93,4,1,6,2,9,8,1],
                    itemStyle : {
                        normal : {
                            lineStyle:{
                                color:'#f0f0f2',
                            }
                        }
                    },
                    areaStyle: {
                        normal: {
                            color: '#5fe98f',
                            opacity:.2
                        }
                    },
                    lineStyle: {
                        normal: {
                            color:'#5fe98f',
                            width:2,
                        }
                    }
                },

            ]
        };

        incomeecharts.setOption(incomeoption, true);
    },
    //饼图 统计
    casauditPDAandGeodata:function (data) {
    	var eqpTimes = (data.eqpTimes == null ? 0 : data.eqpTimes);
    	var pdaTimes = (data.pdaTimes == null ? 0 : data.pdaTimes);
    	var pdaRate = (pdaTimes*100/eqpTimes).toFixed(0);
    	if(isNaN(pdaRate)){
    		pdaRate = 0;
    	}
    	$("#pdaRate").html(pdaRate+'%');
        var parlAllchart = echarts.init(document.getElementById('casaudit-parkAll-chart'));
        // 指定图表的配置项和数据
        var topleftoption = {
            color:['rgba(254,200,77,1)','#5fe98f',],
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b}: {c} ({d}%)"
            },
            // legend: {
            //     orient: 'vertical',
            //     right:'1%',
            //     top:'3%',
            //     selectedMode:false,
            //     textStyle: {
            //         color: 'rgba(0,0,0,0.5)',
            //         fontSize:'12px',
            //         fontFamily:'微软雅黑'
            //     },
            //     itemWidth:16,
            //     itemHeight:10,
            //     data:['一致','不一致']
            // },

            series: [
                {
                    name:'设备上报与设备录入信息',
                    type:'pie',
                    radius: ['60%', '70%'],
                    avoidLabelOverlap: false,
                    label: {
                        normal: {
                            show: false,
                            position: 'center'
                        },
                        emphasis: {
                            show: false,

                        }
                    },
                    labelLine: {
                        normal: {
                            show: false
                        }
                    },
                    data:[
                        {value:eqpTimes-pdaTimes, name:'设备未录入次数'},
                        {value:pdaTimes, name:'设备录入次数'},
                    ]

                }
            ]
        };

        parlAllchart.setOption(topleftoption,true);
        parlAllchart.resize();
    },
    //柱形图 echarts
    casauditRecordNum:function (data) {
        var lineecharts = echarts.init(document.getElementById('casaudit-topright-echarts'));
        var lineoption = {
            color:['#1e95cd'],
            tooltip : {
                trigger: 'axis',
                axisPointer : {            // 坐标轴指示器,坐标轴触发有效
                    type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
                }
            },
            legend: {
                itemHeight:10,
                right: '10',
                top:'0',
                data: ['5分钟','10分钟','20分钟','30分钟','30分钟以上']
                //data: ['大华','华赛','烽火']
            },
            grid: {
                top: '13%',
                left: '1%',
                right: '2%',
                bottom: '2%',
                containLabel: true
            },
            xAxis : [
                {
                    type : 'category',
                    data: ['5分钟','10分钟','20分钟','30分钟','30分钟以上'],
                    axisLabel: {
                        // interval:2,
                        show: true,
                        textStyle: {
                            color: 'rgba(0,0,0,0.5)',
                            fontSize:'12px',
                            fontFamily:'微软雅黑'
                        }
                    },
                    splitLine:{
                        lineStyle:{
                            color:'rgba(0,0,0,0.1)',
                        }
                    },

                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: 'rgba(0,0,0,0.1)',
                            // width: 1,//这里是为了突出显示加上的
                        }
                    },
                    axisTick: {
                        show: false
                    },
                }
            ],
                yAxis: {
                    type: 'value',
                    axisLabel: {
                        show: true,
                        textStyle: {
                            color: 'rgba(0,0,0,0.5)',
                            fontSize:'12px',
                            fontFamily:'微软雅黑'
                        }
                    },
                    axisTick: {
                        show: false,
                    },
                    splitLine:{
                        lineStyle:{
                            color:'rgba(0,0,0,0.1)',
                        }
                    },

                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: 'rgba(0,0,0,0.1)',
                            // width: 1,//这里是为了突出显示加上的
                        }
                    },
                },
            series : [
                {
                    name:'录入次数',
                    type:'bar',
                    barWidth: '20%',
                    itemStyle : {
                        normal : {
                            lineStyle:{
                                color:'#f0f0f2',
                            }
                        }
                    },
                    areaStyle: {
                        normal: {
                            color: '#1e95cd',
                            opacity: .2
                        }
                    },
                    lineStyle: {
                        normal: {
                            color: '#1e95cd',
                            width: 2,
                        }
                    },
                    data:[data.fiveMinNums, data.tenMinNums, data.twentyMinNums, data.thirtyMinNums, data.overThirtyMinNums]
                }
            ],
        };
        lineecharts.setOption(lineoption,true);
        lineecharts.resize();
    },
    //默认生成表格数据
    casauditcreateTableData: function() {
        $('#casauditrecordtable').bootstrapTable('destroy').bootstrapTable({
            striped: true, //表格显示条纹
            pagination: true, //启动分页
            pageNumber: 1, //当前第几页
            // showColumns: true,
            pageSize: 10, //每页显示的记录数
            pageList: [10, 15, 20], //记录数可选列表
            sidePagination: 'server', //表示服务端分页
            queryParamsType: 'limit',
            method: 'POST', //请求方法
            // fixedColumns:true,
            // fixedNumber:1,
            // leftFixedColumns: true,
            // leftFixedNumber: 2,
            // selectItemName: 'personCustName',
            paginationPreText: '<',
            paginationNextText: '>',
            ajax: casaudittableLoadRequest, //自定义ajax加载数据
            uniqueId: 'id',
            rowStyle:casauditfun.markTheTable,
            columns: [
                {
                    field: 'plName',
                    title: '<span class="parking-icon"></span>车场名称',
                    width: '10%',
                    visible: true,
                    align: 'left',
                    formatter:commonObj.replacenull
                },
                {
                    field: 'parkAreaName',
                    title: '<span class="berth-icon"></span>泊位区间',
                    width: '10%',
                    visible: true,
                    align: 'left',
                    formatter:commonObj.replacenull
                },
                {
                    field: 'eqpNo',
                    title: '<span class="business-icon"></span>设备编码',
                    width: '10%',
                    visible: true,
                    align: 'left',
                    formatter:commonObj.replacenull
                },
                {
                    field: 'eqpReportTime',
                    title: '<span class="collect-icon"></span>设备上报时间',
                    width: '10%',
                    visible: true,
                    align: 'left',
                    formatter:commonObj.timeFormatter,
                },
                {
                    field: 'pdaReportTime',
                    title: '<span class="time-icon"></span>设备录入时间',
                    width: '10%',
                    align: 'left',
                    formatter:commonObj.timeFormatter,

                },

                {
                    field: 'berthNo',
                    title: '<span class="business-icon"></span>泊位编号',
                    width: '5%',
                    align: 'left',
                    formatter:commonObj.replacenull
                },
                {
                    field: 'chargerName',
                    title: '<span class="person-icon"></span>收费员',
                    width: '10%',
                    align: 'left',
                    formatter:commonObj.replacenull
                },
                {
                    field: 'timeDuration',
                    title: '<span class="time-icon"></span>间隔时间',
                    width: '10%',
                    align: 'left',
                    formatter:casauditfun.formatSeconds,
                },

            ]
        });
    },
    markTheTable:function (value,row, index) {
    	//这里有5个取值代表5中颜色['active', 'success', 'info', 'warning', 'danger'];
        var strclass = "";
        if (value.timeDuration == null || value.timeDuration > 15*60 || value.pdaReportTime  == null) {
            strclass = 'danger';
        }
        else {
            strclass = '';
        }
        return { classes: strclass }
    },
    formatSeconds:function(value) {
    	if(value == null){
    		return "-";
    	}
	    var theTime = parseInt(value);// 秒
	    var theTime1 = 0;// 分
	    var theTime2 = 0;// 小时
	    var theTime3 = 0;//天
	    if (theTime < 60) {
	        return theTime + '秒';
	    }
	    if (theTime > 60) {
	        theTime1 = parseInt(theTime / 60);
	        theTime = parseInt(theTime % 60);
	
	
	    }
	
	    if (theTime1 > 60) {
	        theTime2 = parseInt(theTime1 / 60);
	        theTime1 = parseInt(theTime1 % 60);
	    }
	
	    if (theTime2 > 24) {
	        theTime3 = parseInt(theTime2 / 24);
	        theTime2 = parseInt(theTime2 % 24);
	    }
	
	    var result = '';
	    if (theTime1 == 0 && theTime2 == 0 && theTime3 == 0) {
	        result = parseInt(theTime) + "秒"
	    }
		if (theTime > 0) {
	        result = "" + parseInt(theTime) + "秒" + result;
	    }
	    if (theTime1 > 0) {
	        result = "" + parseInt(theTime1) + "分钟" + result;
	    }
	    if (theTime2 > 0) {
	        result = "" + parseInt(theTime2) + "小时" + result;
	    }
	
	    if (theTime3 > 0) {
	        result = "" + parseInt(theTime3) + "天" + result;
	    }
	    return result;
	},
    isOnlineFormatter:function(value){
        if(value==null){
            return "";
        }
        else if(value == "0"){
            return "在线";
        }
        else if(value == "1"){
            return "离线";
        }
        else{
            return "故障";
        }
    },

};

casauditfun.init();

//切换 搜索部分 是否生效
documentBindFunc.on('click', "#cashieraudit-toptab div.ITD-graynav-topbar", function () {
    var index = $(this).index();
    $(this).addClass('ITD-graynav-topbaractive').siblings('div').removeClass('ITD-graynav-topbaractive');
    //切换完后,查询echarts 表格数据
	$("#casaudit-qerBtn").click();

});

//切换  录入 未录入
documentBindFunc.on('click','#tab-btn-wrap li',function () {
    var _index = $(this).index();
    if(_index==0){
        // cllEcharts(chartData);
    }else if(_index==1){
        // zylEcharts(chartData);
    }
    $(this).addClass('tabAction').siblings().removeClass('tabAction');
	casauditfun.casauditcreateTableData()
});

//查询按钮
$(document).on('click', '#casaudit-qerBtn', function() {
//  var datesta = $("#casaudit-daterange-btnsta").val();
//  var dateend = $("#casaudit-daterange-btnend").val();
//  var beginTime = datesta+" 00:00:00";
//  var endTime=dateend+" 23:59:59";
//  // beginTime = new Date(beginTime.replace(new RegExp(/-/gm) ,"/"));
    //饼图 统计
    queryPdaAndEqpTypeNums();
    //柱形图 echarts
    queryInputNumsByTimes();
    //折线图 echarts
    queryEqpAndPdaTimesForLine();
    // table
    casauditfun.casauditcreateTableData();
});

//饼图ajax
function queryPdaAndEqpTypeNums(){
    var req = casauditfun.getQueryParam();
    var opt = {
        method: 'post',
        url: dataUrl.util.queryPdaAndEqpTypeNums(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function(res) {
            console.log("图1:",res);
            if(res.code == '8888') {
                var data = res.data;
                casauditfun.casauditPDAandGeodata(data);
            }
            else{

                return;
            }
        }
    };
    sysAjax(opt);
}
//柱状图图ajax
function queryInputNumsByTimes(){
    var req = casauditfun.getQueryParam();
    var opt = {
        method: 'post',
        url: dataUrl.util.queryInputNumsByTimes(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function(res) {
            console.log("图2:",res);
            if(res.code == '8888') {
                var data = res.data;
                casauditfun.casauditRecordNum(data);
            }
            else{

                return;
            }
        }
    };
    sysAjax(opt);
}
//折线图ajax
function queryEqpAndPdaTimesForLine(){
    var req = casauditfun.getQueryParam();
    var opt = {
        method: 'post',
        url: dataUrl.util.queryEqpAndPdaTimesForLine(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function(res) {
            console.log("图3:",res);
            if(res.code == '8888') {
                var data = res.data;
                casauditfun.lineecharts(data);
            }
            else{

                return;
            }
        }
    };
    sysAjax(opt);
}
/**
 * 自定义table AJAX请求
 * @param {Object} params
 */
function casaudittableLoadRequest(params) {
    var req = casauditfun.getQueryParam();
    //设置请求参数
    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.queryEqpAndPdaReportTimeList(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function(res) {
            console.log("图4:",res);
            if(res.code == '8888') {
                params.success(res.data);
            }
            else{

            }
        }
    };
    sysAjax(opt);
}
//导出
var InterValObj; //timer变量,控制时间
var count = 8; //间隔函数,1秒执行
var curCount;//当前剩余秒数

function sendMessage() {
    curCount = count;
    //设置button效果,开始计时
    $("#exportPark").attr("disabled", "true");
    $(".ITD-export-btn").css("width", "138px");
    $("#exportPark").val(curCount + "秒后可再次导出");
    InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
}

//timer处理函数
function SetRemainTime() {
    if (curCount == 0) {
        window.clearInterval(InterValObj);//停止计时器
        $("#exportPark").removeAttr("disabled");//启用按钮
        $(".ITD-export-btn").css("width", "72px");
        $("#exportPark").val("导出");
    }
    else {
        curCount--;
        $("#exportPark").val(curCount + "秒后可再次导出");
    }
}
//导出excle
documentBindFunc.on('click','#exportPark',function (){
    //获取table所有行数据
    var parkLot = $("#casauditrecordtable").bootstrapTable('getData');
    //获取table总条数
    var numTotal = $("#casauditrecordtable").bootstrapTable('getOptions').totalRows;
    //提示 无数据不导出
    if(parkLot.length<1){
        $('.ITD-alertmodel-contentmsg').text('无数据可导出!');
        $('#ITD-tipsmodel').modal('show');
        setTimeout(function () {
            $('.ITD-alertmodel-contentmsg').text('');
            $('#ITD-tipsmodel').modal('hide');
        },3000);
        return false;
    }
    //超1万条 缩短查询范围
    if(numTotal>10000){
        $('.ITD-alertmodel-contentmsg').text('数据量过大,请缩小查询范围!');
        $('#ITD-tipsmodel').modal('show');
        setTimeout(function () {
            $('.ITD-alertmodel-contentmsg').text('');
            $('#ITD-tipsmodel').modal('hide');
        },3000);
        return false;
    }

    //执行倒计时函数
    sendMessage();
    
    casauditfun.exportEqpInOutParkAllStatisticExcel();
});