let form, table, laydate; let tableIns; let pageNum = 1; // 定义分页 layui.use(["form", "table"], function () { form = layui.form; table = layui.table; initTable(); }); // 查询/重置 function queryTable(type) { if (type === 1) { let carNum = $('#carNum').val(); let flag = checkValue(carNum); if (flag) { $('#carNum').val(''); return layer.msg('车牌号查询包含特殊字符,请重新输入', { icon: 2 }); } let supName = $('#supName').val(); let flag2 = checkValue(supName); if (flag2) { $('#supName').val(''); return layer.msg('供应商查询包含特殊字符,请重新输入', { icon: 2 }); } reloadTable(1); } else if (type === 2) { $('#carNum').val(''); $('#supName').val(''); layui.form.render(); reloadTable(1); } } // 刷新页面数据 function reloadData() { reloadTable(1); } // 重载表格 function reloadTable(pageNum) { table.reload("currentTableId", { page: { curr: pageNum ? pageNum : 1, }, where: { encryptedData: JSON.stringify({ 'carNum': $('#carNum').val(), 'supName': $('#supName').val(), }), }, }, ); } // 初始化表格 function initTable() { tableIns = table.render({ elem: "#currentTableId", id: 'currentTableId', headers: { authorization: sessionStorage.getItem("gz-token"), }, height: "full-170", url: dataUrl + "backstage/carCar/getCarPageList", where: { encryptedData: JSON.stringify({ 'carNum': $('#carNum').val(), 'supName': $('#supName').val(), }), }, request: { pageName: 'pageNum', limitName: 'pageSize' }, parseData: function (res) { // res 即为原始返回的数据 if (res.code === 401) { closeWindowOpen(); } return { "code": 0, // 解析接口状态 "msg": '获取成功', // 解析提示文本 "count": res.total, // 解析数据长度 "data": res.list // 解析数据列表 }; }, cols: [ [ { width: '5%', title: "序号", align: "center", templet: function (d) { return d.LAY_NUM; }, }, { field: "carNum", width: '7%', title: "车牌号", unresize: true, align: "center", sort:true, }, { field: "brand", width: '9%', title: "车辆品牌", unresize: true, align: "center", sort:true, }, { field: "type", width: '8%', title: "车辆类型", unresize: true, align: "center", sort:true, }, { field: "ton", width: '10%', title: "车辆吨位(T)", unresize: true, align: "center", sort:true, templet: function (d) { return (d.ton ? d.ton : 0) + '吨'; }, }, { field: "xyNum", width: '7%', title: "挂靠协议", unresize: true, align: "center", sort:true, templet: function (d) { return ''+d.xyNum+''; }, }, { field: "bxNum", width: '7%', title: "车辆保险", unresize: true, sort:true, align: "center", templet: function (d) { return ''+d.bxNum+''; }, }, { field: "xszNum", width: '7%', title: "行驶证", unresize: true, sort:true, align: "center", templet: function (d) { return ''+d.xszNum+''; }, }, { field: "bxDay", width: '11%', title: "车辆保险到期日期", unresize: true, align: "center", sort:true, }, { field: "supName", width: '10%', title: "所属供应商", unresize: true, align: "center", sort:true, }, { field: "isWhiteList", width: '9%', title: "是否为白名单", unresize: true, align: "center", sort:true, templet: function (d) { return (d.isWhiteList===1 ? "是" : "否"); }, }, { title: "操作", width: '10%', align: "center", unresize: true, templet: function (d) { let html = ""; html += "详情"; html += "