function initCase() { $('#tableModule').show(); $('#demoModule').hide(); $('#wordPicture').show(); $('#indexNextPart').show(); var checkCase = $('#checkCase').val(); //第一个ajax获取count总数 $.ajax({ type: "POST", url: rootPath + "/punishmentCase/countPunishmentCase.html", data: {query: checkCase}, dataType: "json", success: function (json) { $('#demoSpan').html(json.data); layui.use('table', function () { var table = layui.table; //执行一个laypage实例 table.render({ elem: '#demo' //注意,这里的 test1 是 ID,不用加 # 号 , url: rootPath + "/punishmentCase/queryPunishmentCase.html" , where: {query: checkCase} , cols: [[ {field: 'lawsName', title: '名称', templet: '{{d.lawsName}}'} , {field: 'lawsCode', title: '编号'} , {field: 'timeliness', title: '时效性'} , {field: 'publishTime', title: '发布时间', templet: 'changeDateFormat(d.publishTime)'} , {field: 'implementationTime', title: '实施时间', templet: 'changeDateFormat(d.implementationTime)'} ]] , page: true , limit: 10 , response: {count: json.data} , done: function (res, curr, count) { //res为请求接口返回的数据 //curr为当前页码 //count为数据总数 if (curr > 1 && res.data.length == 0) { table.reload('demo', { page: { curr: curr - 1 //重新从上一页开始 } }); } } }); }); } }); };


原文地址: https://www.cveoy.top/t/topic/p24J 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录