vehicleaudit.js 21.2 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
var fun = {
    init: function () {
        //基本信息
        fun.createTabledata();
    },
    /*获取查询参数*/
    getQueryParam: function () {
        var userPhone = $.trim($("#telphoneNo").val());
        var carNumber = $.trim($("#carNumber").val());
        var checkStates = $('#vehicle-toptab div.ITD-graynav-topbaractive').data('checkstate');

        var req = {
            phoneNum: userPhone,
            carNumber: carNumber,
            examineStates: checkStates,
            sysCode: sysComm.sysCode
        };
        return req;
    },
    createTabledata: function () {
        $('#vehicletable').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: 3,
            //rightFixedColumns: true,
            //rightFixedNumber: 1,
            // selectItemName: 'personCustName',
            paginationPreText: '<',
            paginationNextText: '>',
            ajax: tableLoadRequest, //自定义ajax加载数据
            uniqueId: 'id',
            columns: [
                {
                    field: 'carNumber',
                    title: '<span class="type-icon"> </span>车牌号',
                    width: '15%',
                    align: "left",
                    formatter: commonObj.replacenull
                },
                {
                    field: 'phoneNumber',
                    title: '<span class="mobile-icon"> </span>手机号',
                    width: '15%',
                    align: "left",
                    formatter: commonObj.replacenull
                },
                {
                    field: 'carShelfNum',
                    title: '<span class="type-icon"> </span>车驾号',
                    width: '15%',
                    align: "left",
                    formatter: commonObj.replacenull
                },
                {
                    field: 'carEngineNum',
                    title: '<span class="type-icon"> </span>发动机号',
                    width: '15%',
                    align: "left",
                    formatter: commonObj.replacenull

                },

                {
                    field: 'examineState',
                    title: '<span class="status-icon"> </span>状态',
                    width: '15%',
                    align: "left",
                    formatter: function (value, row, index) {
                        var str = '-';
                        value = value == null ? 0 : value;

                        if (value == 0 ) {
                            str = '待上传';
                        }
                        if(value == 1){
                            str = '待审核';
                        }
                        if (value == 2) {
                            str = '审核通过';
                        }
                        if (value == 3) {
                            str = '审核不通过';
                        }
                        return str;

                    }
                },
                {
                    field: '',
                    title: '<span class="opration-icon"></span>操作',
                    width: '15%',
                    align: 'left',
                    //visible: false,
                    formatter: fun.popFormater
                }

            ]
        });
    },
    //弹出 table查看
    createPopTabledata: function () {
        $('#vehiclePoptable').bootstrapTable('destroy').bootstrapTable({
            striped: true, //表格显示条纹
            pagination: true, //启动分页
            pageNumber: 1, //当前第几页
            // showColumns: true,
            pageSize: 5, //每页显示的记录数
            pageList: [5], //记录数可选列表
            sidePagination: 'server', //表示服务端分页
            queryParamsType: 'limit',
            method: 'POST', //请求方法
            // fixedColumns: true,
            // fixedNumber: 1,
            // leftFixedColumns: true,
            // leftFixedNumber: 3,
            //rightFixedColumns: true,
            //rightFixedNumber: 1,
            // selectItemName: 'personCustName',
            paginationPreText: '<',
            paginationNextText: '>',
            ajax: checkRecordRequest, //自定义ajax加载数据
            uniqueId: 'id',
            columns: [
                {
                    field: 'operTime',
                    title: '<span class="time-icon"> </span>时间',
                    width: '15%',
                    align: "left",
                    formatter: commonObj.timeFormatter
                },
                {
                    field: 'operName',
                    title: '<span class="person-icon"> </span>审核人',
                    width: '15%',
                    align: "left",
                    formatter: commonObj.replacenull
                },
                {
                    field: 'phoneNum',
                    title: '<span class="mobile-icon"> </span>手机号',
                    width: '15%',
                    align: "left",
                    formatter: commonObj.replacenull
                },
                {
                    field: 'carEngineNum',
                    title: '<span class="type-icon"> </span>发动机号',
                    width: '15%',
                    align: "left",
                    formatter: commonObj.replacenull

                },

                {
                    field: 'checkState',
                    title: '<span class="status-icon"> </span>状态',
                    width: '15%',
                    align: "left",
                    formatter:function (value, row, index) {
                        var str = '-';
                        value = value == null ? 0 : value;

                        if (value == 0 ) {
                            str = '待上传';
                        }
                        if(value == 1){
                            str = '待审核';
                        }
                        if (value == 2) {
                            str = '审核通过';
                        }
                        if (value == 3) {
                            str = '审核不通过';
                        }
                        return str;

                    }
                },
                {
                    field: 'cerPicturePath',
                    title: '<span class="type-icon"> </span>行驶证',
                    width: '15%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<div class="popImg iconModel ITD-cursor-pointer" data-url="'+value+'" ></div>';
                    }
                },
                {
                    field: 'checkRemark',
                    title: '<span class="opration-icon"> </span>备注',
                    width: '15%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<div class="ITD-cursor-pointer ITD-hidden-nowrap" data-toggle="tooltip" style="max-width: 120px;" title="'+commonObj.isnull(value)+'">'+commonObj.isnull(value)+'</div>';
                    }
                },


            ]
        });
    },
    popFormater: function (value, row, index) {
        var operStr = '';

        var checkState = (null == row.examineState) ? 0 : row.examineState;
        if (checkState == 0 || checkState == 3 || checkState == 1) {
            operStr = ' <span  class="lookMsg ITD-status-on" data-custid="' + row.custId + '" data-carnumber="' + row.carNumber + '" style="margin-right: 4px;" >查看</span><span class="reMsg ITD-status-blue" style="margin-right: 4px;" data-id="' + row.id + '" data-custid="' + row.custId + '" data-carnumber="' + row.carNumber + '">审核</span>';
        }
        if (checkState == 2) {
            operStr = ' <span  class="lookMsg ITD-status-on" data-custid="' + row.custId + '" data-carnumber="' + row.carNumber + '" style="margin-right: 4px;" >查看</span><span class="removeMsg ITD-status-abnormal" style="margin-right: 4px;" data-id="' + row.id + '" data-custid="' + row.custId + '" data-carnumber="' + row.carNumber + '" >撤销</span>';
        }

        return operStr;
    },

};

fun.init();

//img 弹窗
documentBindFunc.on('click', '.iconModel', function () {

    var imgUrl = $(this).data('url');
    if(null == imgUrl || imgUrl =='undefined' || imgUrl == 'null' || imgUrl==''){
        $('#imgModelUrl').attr('src',"../../assets/pages/img/bookUserICO.png");
    }else{
        $('#imgModelUrl').attr('src',imgUrl);
    }
    // 初始化
    $('#ITD-imgmodel').modal('show');
});
//查看 弹窗
documentBindFunc.on('click', '.lookMsg', function () {

    var custId = $(this).data('custid');
    var carNumber = $(this).data('carnumber');

    $('#view_custid').val(custId);
    $('#view_carnumber').val(carNumber);

    $('#carUsernameRead').text(commonObj.isnull(null));
    $('#baseCarNumRead').text(commonObj.isnull(null));
    $('#baseTelnumRead').text(commonObj.isnull(null));
    $('#basecarJiaRead').text(commonObj.isnull(null));
    $('#basecarFDJRead').text(commonObj.isnull(null));
    $('#drivingImg').attr('src', "../../assets/pages/img/bookUserICO.png");


    var req = {
        sysCode: sysComm.sysCode,
        custId: custId,
        carNumber: carNumber
    };

    var opt = {
        method: 'post',
        url: dataUrl.util.queryCustCarInfo(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function (res) {
            if (res.code == '8888') {
                console.log(res);
                var carInfoArray = res.data.carDTOS;
                if (null != carInfoArray) {
                    var carInfo = carInfoArray[0];
                    $('#baseCarNumRead').text(commonObj.isnull(carInfo.carNumber));
                    $('#basecarJiaRead').text(commonObj.isnull(carInfo.carShelfNum));
                    $('#basecarFDJRead').text(commonObj.isnull(carInfo.carEngineNum));
                    if (null != carInfo.cerPicturePath) {
                        $('#drivingImg').attr('src', carInfo.cerPicturePath);
                    }
                }

                var custInfo = res.data.custPersonDTO;
                if (null != custInfo) {
                    $('#carUsernameRead').text(commonObj.isnull(custInfo.custName));
                    $('#baseTelnumRead').text(commonObj.isnull(custInfo.userPhone))
                }

            }else{
                alert('获取审核信息失败!');
            }
        }
    };
    sysAjax(opt);

    // 初始化
    fun.createPopTabledata();
    $('#vehicle_detailmodel').modal('show');

});

documentBindFunc.on('click', "#drivingImg,#check_view_img", function () {
    var imgs = $(this).attr('src');
    if(imgs=='../../assets/pages/img/bookUserICO.png'){
        return false;
    }
    window.open(imgs, "_blank");
});



//审核 弹窗
documentBindFunc.on('click', '.reMsg', function () {
    // 初始化
    $('#alertvehile_rule').addClass('display-none').text('');
    $('#baseBeizhu').val('');
    var id = $(this).data('id');
    $('#renewMon-sure').data('id','');
    $('#renewMon-sure').data('id',id);
    var custId = $(this).data('custid');
    var carNumber = $(this).data('carnumber');
    $('#carUsername').text(commonObj.isnull(null));
    $('#baseCarNum').text(commonObj.isnull(null));
    $('#baseTelnum').text(commonObj.isnull(null));
    $('#basecarJia').text(commonObj.isnull(null));
    $('#basecarFDJ').text(commonObj.isnull(null));
    $('#check_view_img').attr('src', "../../assets/pages/img/bookUserICO.png");
    $('#passID').removeClass('passTypeActive');
    $('#nopassID').removeClass('passTypeActive');


    var req = {
        sysCode: sysComm.sysCode,
        custId: custId,
        carNumber: carNumber
    };

    var opt = {
        method: 'post',
        url: dataUrl.util.queryCustCarInfo(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function (res) {
            console.log(res);
            if (res.code == '8888') {
                console.log(res);
                var carInfoArray = res.data.carDTOS;
                if (null != carInfoArray) {
                    var carInfo = carInfoArray[0];
                    $('#baseCarNum').text(commonObj.isnull(carInfo.carNumber));
                    $('#basecarJia').text(commonObj.isnull(carInfo.carShelfNum));
                    $('#basecarFDJ').text(commonObj.isnull(carInfo.carEngineNum));
                    if (null != carInfo.cerPicturePath) {
                        $('#check_view_img').attr('src', carInfo.cerPicturePath);
                    }
                }

                var custInfo = res.data.custPersonDTO;
                if (null != custInfo) {
                    $('#carUsername').text(commonObj.isnull(custInfo.custName));
                    $('#baseTelnum').text(commonObj.isnull(custInfo.userPhone))


                }

            }
        }
    };
    sysAjax(opt);


    $('#vehicle_Msgmodel').modal('show');
});
//撤销 弹窗
documentBindFunc.on('click', '.removeMsg', function () {

    var id = $(this).data('id');
    $('#vehicle_delsubmit').data('id','');
    $('#vehicle_delsubmit').data('id',id);

    // 初始化
    $('#vehicle_delmodel').modal('show');
});

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

});
//主页查询
documentBindFunc.on('click', "#queryBtn", function () {
    fun.createTabledata();
});

//通过 切换 按钮事件
documentBindFunc.on('click', '#passID', function () {
    // 初始化
    $('#nopassID').removeClass('passTypeActive');
    $('#passID').addClass('passTypeActive');

});
documentBindFunc.on('click', '#nopassID', function () {
    $('#passID').removeClass('passTypeActive');
    $('#nopassID').addClass('passTypeActive');
});

//审核确认提交
documentBindFunc.on('click', '#renewMon-sure', function () {
    var id =  $('#renewMon-sure').data('id');
    var remark = $.trim($("#baseBeizhu").val());
    var checkStatus =  $('.vehpassType.passTypeActive').data('code');
    console.log(checkStatus)
    if (remark == '' || remark == undefined || remark == null) {
        $('#alertvehile_rule').removeClass('display-none').text('请输入备注内容');
        return;
    }
    if (checkStatus == '' || checkStatus == undefined || checkStatus == null) {
        $('#alertvehile_rule').removeClass('display-none').text('请选择状态');
        return;
    }
    submitCustCarInfoCheckStatus(id,checkStatus,remark);
});


//审核撤销确认提交
documentBindFunc.on('click', '#vehicle_delsubmit', function () {
    var id =  $('#vehicle_delsubmit').data('id');
    submitCustCarInfoCheckStatus(id,3,'审核撤销');

});





//车辆审核信息变更确认提交
function submitCustCarInfoCheckStatus(id,checkStatus,remark) {
    //0:待审核 1:审核中 2:通过 3 :驳回

    //条件查询
    var req = {
        sysCode: sysComm.sysCode,
        id:id,
        checkStatus:checkStatus,
        remark:remark
    }

    var opt = {
        method: 'post',
        url: dataUrl.util.submitCustCarInfoCheckStatus(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function (res) {
            if (res.code == '8888') {
                // fun.createTabledata();
                $("#vehicletable").bootstrapTable('refresh');
                $('#vehicle_Msgmodel').modal('hide');
                $('#vehicle_delmodel').modal('hide');
            }else{
                alert('审核状态变更失败!');
                $("#vehicletable").bootstrapTable('refresh');
            }
        }
    };

    sysAjax(opt);


}


/**
 * 检查记录
 */
function checkRecordRequest(params) {
    var custId = $('#view_custid').val();
    var carNumber = $('#view_carnumber').val();

    //设置请求参数
    var pageNum = (params.data.offset / params.data.limit) + 1;

    //条件查询
    var req = {
        baseRequest: {
            pageNum: pageNum,
            pageSize: params.data.limit
        },
        sysCode: sysComm.sysCode,
        carNumber: carNumber
    }

    var opt = {
        method: 'post',
        url: dataUrl.util.queryTdCCarCheckRecordForPage(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function (res) {
            if (res.code == '8888') {
                params.success(res.data);
                $("[data-toggle='tooltip']").tooltip({
                    delay: {show: 500, hide: 100},
                });
            }
        }
    };

    sysAjax(opt);

}


/**
 * 自定义table AJAX请求
 * @param {Object} params
 */
function tableLoadRequest(params) {
    var req = fun.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.queryUserCarInfoForPage(),
        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);
                $("[data-toggle='tooltip']").tooltip({
                    delay: {show: 500, hide: 100},
                });
            }
        }
    };
    sysAjax(opt);
}

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

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

//timer处理函数
function SetRemainTime() {
    if (curCount == 0) {
        window.clearInterval(InterValObj);//停止计时器
        $("#vehreportBtn").removeAttr("disabled");//启用按钮
        $(".ITD-export-btn").css("width", "72px");
        $("#vehreportBtn").val("导出");
    } else {
        curCount--;
        $("#vehreportBtn").val(curCount + "秒后可再次导出");
    }
}


//导出excle
documentBindFunc.on('click', '#vehreportBtn', function () {
    //获取table所有行数据
    var parkLot = $("#vehicletable").bootstrapTable('getData');
    //获取table总条数
    var numTotal = $("#vehicletable").bootstrapTable('getOptions').totalRows;
    //提示 无数据不导出
    console.log(parkLot)
    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;
    }

    //执行倒计时函数s
    sendMessage();

    var req = fun.getQueryParam();
    var beginTime = DateUtils.long2String(req.startTime, 7);
    var endTime = DateUtils.long2String(req.endTime, 7);
    var url = dataUrl.util.exportappAcctRechargeList();
    console.log(beginTime + ',' + endTime)
    var forms = exportIncomeDetailFormforbill(url, beginTime, endTime, req.userPhone);
    forms.submit();
});


function exportIncomeDetailFormforbill(url, beginTime, endTime, userPhone) {

    var form = document.createElement("form");
    form.style.display = 'none';
    form.action = url;
    form.method = "get";
    document.body.appendChild(form);

    var input = document.createElement("input");
    //input.type = "hidden";
    input.name = "beginTime";
    input.value = beginTime;
    form.appendChild(input);

    var input2 = document.createElement("input");
    input2.name = "endTime";
    input2.value = endTime;
    form.appendChild(input2);

    var input3 = document.createElement("input");
    //input2.type = "hidden";
    input3.name = "userPhone";
    input3.value = userPhone;
    form.appendChild(input3);

    return form;

};