let form, table, element; let tableIns; let pageNum = 1; // 定义分页 layui.use(["form", "table", 'element'], function () { form = layui.form; table = layui.table; element = layui.element; // tab 切换事件 element.on('tab(demo-filter-tab)', function (data) { let auditStatus = $(this).attr('value'); $('#auditStatus').val(auditStatus); queryTable(1); }); initTable(); }); // 查询/重置 function queryTable(type) { if (type === 1) { let keyWord = $('#keyWord').val(); let flag = checkValue(keyWord); if (flag) { $('#keyWord').val(''); return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 }); } reloadTable(1); } else if (type === 2) { $('#keyWord').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({ 'keyWord': $('#keyWord').val(), 'auditStatus': $('#auditStatus').val(), }), }, }, ); } // 初始化表格 function initTable() { tableIns = table.render({ elem: "#currentTableId", id: 'currentTableId', headers: { authorization: sessionStorage.getItem("gz-token"), }, height: "full-220", url: dataUrl + "backstage/planAudit/findByPage", where: { encryptedData: JSON.stringify({ 'keyWord': $('#keyWord').val(), 'auditStatus': $('#auditStatus').val(), }), }, request: { pageName: 'pageNum', limitName: 'pageSize' }, parseData: function (res) { // res 即为原始返回的数据 return { "code": 0, // 解析接口状态 "msg": '获取成功', // 解析提示文本 "count": res.total, // 解析数据长度 "data": res.list // 解析数据列表 }; }, cols: [ [ { width: '6.9%', title: "序号", align: "center", templet: function (d) { return d.LAY_NUM; }, }, { field: "code", width: '10%', title: "计划单号", unresize: true, align: "center", }, { field: "proName", width: '14%', title: "工程名称", unresize: true, align: "center", }, { field: "projectPart", width: '10%', title: "项目部分", unresize: true, align: "center", }, { field: "allPrice", width: '10%', title: "审核状态", unresize: true, align: "center", templet: function (d) { return getCheckStatus(d.statusType, d.status); ; }, }, { field: "creator", width: '10%', title: "提交人", unresize: true, align: "center", }, { field: "createTime", width: '15%', title: "提交时间", unresize: true, align: "center", }, { field: "remark", width: '14%', title: "备注", unresize: true, align: "center", }, { title: "操作", width: '10%', align: "center", unresize: true, templet: function (d) { let html = ""; html += "详情"; let content = getCheckStatus(d.statusType, d.status); if (!(content.indexOf('驳回') > -1 || content.indexOf('通过') > -1)) { html += "