
//------------------------------------------查询结果---------------------------------------------------------
let bomIds = []
$('#mytab').bootstrapTable({
    height: $(window).height,
    toolbar: '#toolbar',                //工具按钮用哪个容器
    striped: true,                      //是否显示行间隔色
    cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
    pagination: true,               //是否显示分页（*）
    checkboxHeader: true,
    sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
    paginationPreText: '上一页',
    paginationNextText: '下一页',
    fixedColumns: true,
    uniqueId: "patientId",
    fixedNumber: 4,
    pageNumber: 1,                       //初始化加载第一页，默认第一页
    pageSize: 20,                       //每页的记录行数（*）
    pageList: [5, 10, 15, 20, 30, 50],//可供选择的每页的行数（*）
    height: 300,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
    columns: [
        {
            width: 25,
            title: '全选',
            field: 'check',
            checkbox: true,
            align: 'center',
            valign: 'middle',
            formatter: function (value, row, index) {
                if (bomIds.indexOf(row['patientId']) >= 0) {
                    return {checked: true};
                }
            }
        },
        {
            field: 'no',
            title: '序号',
            sortable: true,
            formatter: function (value, row, index) {
                //获取每页显示的数量
                var pageSize = $('#mytab').bootstrapTable('getOptions').pageSize;
                //获取当前是第几页
                var pageNumber = $('#mytab').bootstrapTable('getOptions').pageNumber;
                //返回序号，注意index是从0开始的，所以要加上1
                return pageSize * (pageNumber - 1) + index + 1;
            }
        },
        {
            title: '住院号',
            field: 'inpatientNo',
        },
        {
            title: '住院次数',
            field: 'admissTimes',
        },
        {
            title: '出院科室',
            field: 'disDept',
        },
        {
            title: '出院时间',
            field: 'disDate',
            formatter: crtTimeFtt
        }
    ],
    locale: 'zh-CN',//中文支持,
    url: path + '/applyDetails/getCommomVo',//排序方式
    queryParams: function (params) {
        return {
            limit: params.limit, // 每页显示数量
            offset: params.offset, // SQL语句起始索引
            page: (params.offset / params.limit) + 1, //当前页码,
            inpatientNo: $("#inpatientNo").val(),
            startTime: $("#startTime1").val(),
            endTime: $("#endTime1").val(),
            admissTimes: $("#admissTimes").val(),
            disDept: $("#dis_dept").val(),
            batchId: getUrlParam('batchId'),
            applyName: getUrlParam('applyName')
        }
    },
    responseHandler: function (res) {
        //在ajax获取到数据，渲染表格之前，修改数据源
        var nres = [];
        nres.push({total: res.total, rows: res.list});
        return nres[0];
    },
    onLoadSuccess: function () {
        $(".page-list").show();
        $(".fixed-table-body").css("overflow", "auto");
    },
    //监听分页点击事件
    onPageChange: function (num, type) {
        pageNumber = num;
    },
    //选中单个复选框
    onCheck: function (row) {
        bomIds.push(row.patientId)
        var checks = $("#checks").val();
        $("#checks").val(checks += "'" + row.id + "',");
    },
    //取消单个复选框
    onUncheck: function (row) {
        const findIndex = bomIds.findIndex(rowIndex => rowIndex == row.patientId)
        if (findIndex != -1) {
            bomIds.splice(findIndex, 1)
        }
        var checks = $("#checks").val();
        checks = checks.replace("'" + row.id + "',", "");
        $("#checks").val(checks);
    },
    //全选
    onCheckAll: function (rows) {
        bomIds = rows.map(rowData => rowData.patientId)

        $("#checks").val("");
        var checks = '';
        for (var i = 0; i < rows.length; i++) {
            checks += "'" + rows[i].id + "',"
        }
        $("#checks").val(checks);
    },
    //全不选
    onUncheckAll: function (rows) {
        bomIds = []
        $("#checks").val("");
    }
})

function crtTimeFtt(val) {
    if (val != null) {
        var date = new Date(val);
        return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
    }
}

//键盘回车查询
$(document).keyup(function (event) {
    if (event.keyCode == 13) {
        refreshTable();
    }
});

//查询按钮
function refreshTable() {
    $("#checks").val("");
    $('#mytab').bootstrapTable('refresh', {
        url: path + '/applyDetails/getCommomVo',
    })
    var inpatientNo = $("#inpatientNo").val();
    var startTime = $("#startTime1").val();
    var endTime = $("#endTime1").val();
    var admissTimes = $("#admissTimes").val();
    var disDept = $("#dis_dept").val();
    var batchId = getUrlParam('batchId');
    var applyName = getUrlParam('applyName')
    $.ajax({
        type: 'post',
        url: path + '/applyDetails/getCommomVo',
        data: {
            inpatientNo: inpatientNo,
            startTime: startTime,
            endTime: endTime,
            admissTimes: admissTimes,
            disDept: disDept,
            batchId: batchId,
            refreshTable: 1,
            applyName: applyName
        },
        dataType: 'json',
        success: function (data) {
            if (data.size == 1) {
                var applyStatc = data.list[0].applyStatc;
                if (applyStatc != "") {
                    reLoadBorrowingTab();
                    return toastr.success(applyStatc);
                }
                reLoadBorrowingTab();
                toastr.success("当前查询只有一条记录已自动帮你添加到批次中!");
            }
        }
    })
}

function empty() {
    $(":input").val("")
    refreshTable();
}


$(function () {
    initDateInput(1);
    initDateInput(2);
})

//加载科室
loadDept();

//加载科室
function loadDept() {
    $.ajax({
        type: 'get',
        url: path + '/commom/getDept',
        dataType: 'json',
        success: function (data) {
            if (null != data) {
                $("#dis_dept").empty();
                var html = '<option value="">全部</option>';
                for (var i = 0; i < data.length; i++) {
                    if (data[i].name != '') {
                        var name = data[i].name;
                        var code = data[i].code;
                        html += '<option data-tokens="' + name + '|' + '|' + name + '" value="' + code + '">' + name + '</option>';
                    }
                }
                $("#dis_dept").append(html);
            }
        }
    })
}

//批量添加
function addApprovesMore() {
    //先清除上次数据
    clearContent();
    //批量添加选择信息
    tabChecks = getChecked();
}

//保存批量申请
function add() {
    var effeDays = $("#effeDays").val();
    var applyReason = $("#applyReason").val();
    var applyName = $("#applyName").val();
    var patientIds = bomIds.join();
    var batchId = getUrlParam('batchId');
    var applyName = getUrlParam('applyName')
    if (bomIds.length == 0) {
        return toastr.warning("至少选择一条以上");
    }
    if (effeDays == "") {
        return toastr.warning("申请天数不能为空");
    }
    if (applyReason == "") {
        return toastr.warning("申请理由不能为空");
    }
    $.ajax({
        type: 'post',
        url: path + '/applyDetails/addBatchBorrowing',
        data: {
            effectiveDay: effeDays,
            applyReason: applyReason,
            applyName: applyName,
            applyFlag: 1,
            patientIds: patientIds,
            batchId: batchId
        },
        dataType: 'json',
        success: function (data) {
            if (data.code == 100) {
                return toastr.warning(data.msg);
            }
            if (data.code == 200) {
                toastr.success(data.msg);
                $('#borrowingModal').modal('hide');
                //刷新申请借阅列表
                reLoadBorrowingTab();
            }
        }
    })
}


//获取选中行信息
function getChecked() {
    tabChecks = "";
    var inpatientNoArray = new Array();
    var admissTimesArray = new Array();
    var nameArray = new Array();
    var disDeptArray = new Array();
    var idlist = $('#mytab').bootstrapTable('getAllSelections');
    if (idlist.length > 0) {
        for (var i = 0; i < idlist.length; i++) {
            tabChecks += idlist[i].id + ",";
            inpatientNoArray.push(idlist[i].inpatientNo);
            admissTimesArray.push(idlist[i].admissTimes);
            nameArray.push(idlist[i].name);
            disDeptArray.push(idlist[i].disDept);
        }
        $("#checks").val(checks);
    }
    insertContent(inpatientNoArray, admissTimesArray, nameArray, disDeptArray);
    if (null != tabChecks) {
        tabChecks = tabChecks.substring(0, tabChecks.length - 1);
    }
    return tabChecks;
}


//添加内容，tr td
function insertContent(inpatientNoArray, admissTimesArray, nameArray, disDeptArray) {
    for (var i = 0; i < inpatientNoArray.length; i++) {
        var tr = document.createElement("tr");
        var td1 = document.createElement("td");
        var td2 = document.createElement("td");
        var td3 = document.createElement("td");
        var td4 = document.createElement("td");
        td1.innerHTML = inpatientNoArray[i];
        td2.innerHTML = nameArray[i];
        td3.innerHTML = admissTimesArray[i];
        td4.innerHTML = disDeptArray[i];
        tr.appendChild(td1);
        tr.appendChild(td2);
        tr.appendChild(td3);
        tr.appendChild(td4);
        document.getElementById("moreApproveBody").appendChild(tr);
    }
}


//清楚内容方法
function clearContent() {
    $('#addApprovesMore').removeAttr("data-target", "#borrowingModal");
    var table = document.getElementById("moreApproveBody");
    var len = table.childNodes.length;
    for (var i = len - 1; i >= 0; i--) {
        table.removeChild(table.childNodes[i]);
    }
}


//------------------------------------------申请借阅列表---------------------------------------------------------
borrowingTab()

let borrowingIds = []

function borrowingTab() {
    $('#borrowingTab').bootstrapTable({
        height: $(window).height,
        toolbar: '#toolbar',                //工具按钮用哪个容器
        striped: true,                      //是否显示行间隔色
        cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
        pagination: true,                   //是否显示分页（*）
        sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
        paginationPreText: '上一页',
        paginationNextText: '下一页',
        fixedColumns: true,
        fixedNumber: 4,
        pageNumber: 1,                       //初始化加载第一页，默认第一页
        pageSize: 20,                       //每页的记录行数（*）
        pageList: [5, 10, 15, 20, 30, 50],//可供选择的每页的行数（*）
        height: 350,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
        columns: [
            {
                title: '全选',
                field: 'select',
                checkbox: true,
                width: 25,
                align: 'center',
                valign: 'middle',
                formatter: function (value, row, index) {
                    if (borrowingIds.indexOf(row['id']) >= 0) {
                        return {checked: true};
                    }
                    var applyStatc = row.applyStatc;
                    if (applyStatc == 1 || applyStatc == 4 || applyStatc === 3) {
                        return {disabled: true}
                    }
                }
            },
            {
                field: 'no',
                title: '序号',
                sortable: true,
                formatter: function (value, row, index) {
                    //获取每页显示的数量
                    var pageSize = $('#borrowingTab').bootstrapTable('getOptions').pageSize;
                    //获取当前是第几页
                    var pageNumber = $('#borrowingTab').bootstrapTable('getOptions').pageNumber;
                    //返回序号，注意index是从0开始的，所以要加上1
                    return pageSize * (pageNumber - 1) + index + 1;
                }
            },
            {
                title: '申请人工号',
                field: 'applyName',
            },
            {
                title: '申请日期',
                field: 'applyTime',
                formatter: crtTimeFtt
            },
            {
                title: '申请天数',
                field: 'effectiveDay',
            },
            {
                title: '有效日期',
                field: 'effectiveTime',
                formatter: crtTimeFtt
            },
            {
                title: '病案号',
                field: 'inpatientNo',

            },
            {
                title: '住院次数',
                field: 'admissTimes',

            },
            {
                title: '患者姓名',
                field: 'patientName',

            },
            {
                title: '出院日期',
                field: 'disTime',
                formatter: crtTimeFtt
            },
            {
                title: '申请理由',
                field: 'applyReason',

            },
            {
                title: '申请类型',
                field: 'applyFlag',
                formatter: function (value, row, index) {
                    var spanValue;
                    if (value == 1) {
                        spanValue = '<p style="color:#0d6aad">借阅申请</p>';
                    } else if (value == 2) {
                        spanValue = '<p style="color:green">纸质申请</p>';
                    }
                    return spanValue;
                }
            },
            {
                title: '申请状态',
                field: 'applyStatc',
                formatter: function (value, row, index) {
                    var spanValue;
                    if (value == 1) {
                        spanValue = '<p style="color:green">已通过</p>';
                    } else if (value == 2) {
                        spanValue = '<p style="color:orange">申请中</p>';
                    } else if (value == 3) {
                        spanValue = '<p style="color:red">驳回</p>';
                    } else if (value == 4) {
                        spanValue = '<p style="color:royalblue">已过期</p>';
                    }else if (value == 5){
                        spanValue = '<p style="color:green">已归还</p>';
                    }
                    return spanValue;
                }
            },
            {
                title: '经办人工号',
                field: 'handlingName',
            },
            {
                title: '经办人姓名',
                field: 'handlingNameString',
            },
            {
                title: '审批人工号',
                field: 'examineName',
            },
            {
                title: '审批人姓名',
                field: 'examineNameString',
            },
            {
                title: '审批时间',
                field: 'examineTime',
                formatter: crtTimeFtt
            },
            {
                title: '归还人工号',
                field: 'returnName',
            },
            {
                title: '归还人',
                field: 'returnNameString',
            },
            {
                title: '归还时间',
                field: 'returnTime',
                formatter: crtTimeFtt
            },
            {
                title: '操作',
                formatter: function (value, row, index) {
                    var applyStatc = row.applyStatc;
                    var editanddrop = '';
                    if (applyStatc != 1 && applyStatc != 4 && applyStatc != 3 && applyStatc != 5) {
                        editanddrop += '&nbsp&nbsp&nbsp<button type="button" onclick="approveById(' + row.id + ',' + row.effectiveDay + ')" class="btn btn-sm  btn-danger">借阅审批</button>';
                    }
                    editanddrop += '&nbsp&nbsp&nbsp<button type="button" onclick="deleteById(' + row.id + ')" class="btn btn-sm  btn-danger">删除</button>';
                    if (applyStatc != 3 && applyStatc != 4) {
                        editanddrop += '&nbsp&nbsp&nbsp<button type="button" onclick="rejectById(' + row.id + ')" class="btn btn-sm  btn-danger">驳回</button>';
                    }
                    return editanddrop;
                }
            }

        ],
        locale: 'zh-CN',//中文支持,
        url: path + '/applyDetails/getBatchApplyDetails',//排序方式
        queryParams: function (params) {
            return {
                limit: params.limit, // 每页显示数量
                offset: params.offset, // SQL语句起始索引
                page: (params.offset / params.limit) + 1, //当前页码,
                batchId: getUrlParam('batchId'),
                inpatientNo: $("#inpatientNo1").val(),
            }
        },
        responseHandler: function (res) {
            //在ajax获取到数据，渲染表格之前，修改数据源
            var nres = [];
            nres.push({total: res.total, rows: res.list});
            return nres[0];
        },
        onLoadSuccess: function () {
            $(".page-list").show();
            $(".fixed-table-body").css("overflow", "auto");
        },
        //监听分页点击事件
        onPageChange: function (num, type) {
            pageNumber = num;
        },
        //选中单个复选框
        onCheck: function (row) {
            borrowingIds.push(row.id)
            var checks = $("#checks").val();
            $("#checks").val(checks += "'" + row.id + "',");
        },
        //取消单个复选框
        onUncheck: function (row) {
            const findIndex = borrowingIds.findIndex(rowIndex => rowIndex == row.id)
            if (findIndex != -1) {
                borrowingIds.splice(findIndex, 1)
            }
            var checks = $("#checks").val();
            checks = checks.replace("'" + row.id + "',", "");
            $("#checks").val(checks);
        },
        //全选
        onCheckAll: function (rows) {
            borrowingIds = rows.map(rowData => rowData.id)
            $("#checks").val("");
            var checks = '';
            for (var i = 0; i < rows.length; i++) {
                checks += "'" + rows[i].id + "',"
            }
            $("#checks").val(checks);
        },
        //全不选
        onUncheckAll: function (rows) {
            borrowingIds = []
            $("#checks").val("");
        }
    })
}

//截取路径后参数
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
    if (r != null) return unescape(r[2]);
    return null; //返回参数值
}

//删除
function deleteById(id) {
    Common.confirm({
        title: "提示",
        message: "请确认是否删除此申请?",
        operate: function (reselt) {
            if (reselt) {
                $.ajax({
                    type: 'post',
                    url: path + '/applyDetails/deleteById',
                    data: {id: id, batchId: getUrlParam('batchId'),},
                    dataType: 'json',
                    success: function (data) {
                        console
                        if (data == 1) {
                            toastr.success("删除成功!");
                            reLoadBorrowingTab();
                            $('#mytab').bootstrapTable('selectPage', pageNumber);
                        } else {
                            toastr.warning("删除失败");
                        }
                    }
                })
            }
        }
    })
}


//借阅审批
function approveById(id, effectiveDay) {
    var batchId = getUrlParam('batchId');
    Common.confirm({
        title: "提示",
        message: "请确认是否通过此申请?",
        operate: function (reselt) {
            if (reselt) {
                $.ajax({
                    type: 'post',
                    url: path + '/applyDetails/agreeById/',
                    data: {ids: id, effectiveDay: effectiveDay, batchId: batchId},
                    dataType: 'json',
                    success: function (data) {
                        console
                        if (data == 1) {
                            toastr.success("通过成功!");
                            reLoadBorrowingTab();
                            $('#mytab').bootstrapTable('selectPage', pageNumber);
                        } else {
                            toastr.warning("通过失败");
                        }
                    }
                })
            }
        }
    })
}


//批量审核
function batchApprove() {
    //先清除上次数据
    clearContentApprove();
    //批量添加选择信息
    tabChecks = getApproveChecked();
}


//获取申请借阅列表选中行信息
function getApproveChecked() {
    tabChecks = "";
    var inpatientNoArray = new Array();
    var admissTimesArray = new Array();
    var nameArray = new Array();
    var effectiveDayArray = new Array();
    var idlist = $('#borrowingTab').bootstrapTable('getAllSelections');
    if (idlist.length > 0) {
        for (var i = 0; i < idlist.length; i++) {
            tabChecks += idlist[i].id + ",";
            inpatientNoArray.push(idlist[i].inpatientNo);
            admissTimesArray.push(idlist[i].admissTimes);
            nameArray.push(idlist[i].patientName);
            effectiveDayArray.push(idlist[i].effectiveDay);
        }
        $("#checks").val(checks);
    }
    insertApproveContent(inpatientNoArray, admissTimesArray, nameArray, effectiveDayArray);
    if (null != tabChecks) {
        tabChecks = tabChecks.substring(0, tabChecks.length - 1);
    }
    return tabChecks;
}

//添加内容，tr td
function insertApproveContent(inpatientNoArray, admissTimesArray, nameArray, effectiveDayArray) {
    for (var i = 0; i < inpatientNoArray.length; i++) {
        var tr = document.createElement("tr");
        var td1 = document.createElement("td");
        var td2 = document.createElement("td");
        var td3 = document.createElement("td");
        var td5 = document.createElement("td");
        td1.innerHTML = inpatientNoArray[i];
        td2.innerHTML = nameArray[i];
        td3.innerHTML = admissTimesArray[i];
        td5.innerHTML = effectiveDayArray[i];
        tr.appendChild(td1);
        tr.appendChild(td2);
        tr.appendChild(td3);
        tr.appendChild(td5);
        document.getElementById("approveBody").appendChild(tr);
    }
}


//清楚内容方法
function clearContentApprove() {
    $('#batchApprove').removeAttr("data-target", "#approveModal");
    var table = document.getElementById("approveBody");
    var len = table.childNodes.length;
    for (var i = len - 1; i >= 0; i--) {
        table.removeChild(table.childNodes[i]);
    }
}

//驳回
function rejectById(id) {
    Common.confirm({
        title: "提示",
        message: "请确认是否驳回此申请?",
        operate: function (reselt) {
            if (reselt) {
                $.ajax({
                    type: 'post',
                    url: path + '/applyDetails/rejectById/',
                    data: {id: id},
                    dataType: 'json',
                    success: function (data) {
                        console
                        if (data == 1) {
                            toastr.success("驳回成功!");
                            reLoadBorrowingTab();
                            $('#mytab').bootstrapTable('selectPage', pageNumber);
                        } else {
                            toastr.warning("驳回失败");
                        }
                    }
                })
            }
        }
    })
}

//清空
function borrowingEmpty() {
    $(":input").val("")
    refreshBorrowingTab();
}


//申请借阅列表查询按钮
function refreshBorrowingTab() {
    $("#checks").val("");
    $('#borrowingTab').bootstrapTable('refresh', {
        url: path + '/applyDetails/getBatchApplyDetails',//排序方式
    })
}


//保存批量审批
function addApprove() {
    var batchId = getUrlParam('batchId');
    var ids = borrowingIds.join();
    if (borrowingIds.length == 0) {
        return toastr.warning("至少选择一条以上");
    }
    $.ajax({
        type: 'post',
        url: path + '/applyDetails/agreeById',
        data: {
            ids: ids,
            batchId: batchId
        },
        dataType: 'json',
        success: function (data) {
            if (data == 0) {
                borrowingIds = []
                return toastr.warning("批量借阅申请失败!");
            }
            if (data == 1) {
                borrowingIds = []
                toastr.success("批量借阅申请成功!");
                $('#approveModal').modal('hide');
                reLoadBorrowingTab();
            }
        }
    })
}


//批量申请确认提交后刷新页面
function reLoadBorrowingTab() {
    $("#borrowingTab").bootstrapTable('refresh', path + '/applyDetails/getBatchApplyDetails');//排序方式
}


//清空快速归还、快速借阅表单
function emptyForm() {
    $('#barCodeReturnTable')[0].reset();
    $('#borrowingTable')[0].reset();
}


//清空快速归还、快速借阅表单
function emptyBorrowingForm() {
    $('#borrowingTable')[0].reset();
}


//快速归还
function updateReturn() {
    var barCode = $("#barCodeReturn").val();
    var barCodeName = $("#barCodeName").val();
    var batchId = getUrlParam('batchId');
    $.ajax({
        type: 'post',
        url: path + '/applyDetails/updateBatchApply',
        data: {barCode: barCode, barCodeName: barCodeName,batchId:batchId},
        dataType: 'json',
        success: function (data) {
            if (data.code == 100) {
                return toastr.warning(data.msg);
            }
            if (data.code == 200) {
                document.getElementById("barCodeReturn").value = "";
                reLoadBorrowingTab();
                return toastr.success(data.msg);
            }
        }
    })
}


//监听回车立即搜索
//键盘回车查询
$("#barCodeReturnTable").bind("keypress", function (e) {
    // 兼容FF和IE和Opera
    var theEvent = e || window.event;
    var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
    if (code == 13) {
        e.preventDefault();
        //回车执行查询
        updateReturn();
    }
});


//快速借阅
function fastBorrowing() {
    var effeDays = $("#effeDaysBorrowing").val()
    var applyType = $("#applyTypeBorrowing").val()
    var applyReason = $("#applyReasonBorrowing").val()
    var barCode = $("#barCodeBorrowing").val()
    var applyUserName = $("#applyUserName").val()
    var batchId = getUrlParam('batchId');
    if (applyUserName == "") {
        return toastr.warning("申请人工号不能为空");
    }
    $.ajax({
        type: 'post',
        url: path + '/applyDetails/fastBatchApply',
        data: {
            effeDays: effeDays,
            applyType: 2,
            applyReason: applyReason,
            barCode: barCode,
            userName: applyUserName,
            batchId:batchId
        },
        dataType: 'json',
        success: function (data) {
            if (data.code == 100) {
                document.getElementById("barCodeBorrowing").value = "";
                return toastr.warning(data.msg);
            }
            if (data.code == 200) {
                document.getElementById("barCodeBorrowing").value = "";
                reLoadBorrowingTab();
                return toastr.success(data.msg)
            }
        }
    })

}


//监听回车立即搜索
//键盘回车查询
$("#borrowingTable").bind("keypress", function (e) {
    // 兼容FF和IE和Opera
    var theEvent = e || window.event;
    var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
    if (code == 13) {
        e.preventDefault();
        //回车执行查询
        fastBorrowing();
    }
});

