let table, layer, form; let myChart = null, myChart2 = null; layui.use(['layer', 'table', 'form'], function () { layer = layui.layer; table = layui.table; form = layui.form; let bidCode = parent.parent.parent.$('#bidPro').val() initTable(bidCode,""); }); function initTable(bidCode,name) { const url = commonUrl + "screen/largeScreen/engineeringSafetyAnalysis/getHazardsList"; table.render({ elem: '#demo2', url: url, id: 'demo2', skin: 'line', page: true, // height: 'full-400', headers: { "decrypt": "decrypt", "Authorization": token }, where: { bidCode: bidCode, name:name }, cols: [[ { type: 'numbers', title: '序号', width: '10%' }, // 添加序号列 { field: 'id', title: '隐患编号', align: 'center',}, { field: 'type', title: '隐患类型', align: 'center', }, { field: 'level', title: '隐患等级', align: 'center', }, { field: 'timestamp', title: '隐患发生时间', align: 'center', }, ]], initComplete: function () { // 在表格渲染完成后,重新渲染序号列 var that = this.elem.next(); var tool = that.children('.layui-table-box').children('.layui-table-fixed').children('.layui-table-body').children('.layui-table'); tool.find("tr").each(function (index, item) { $(this).find('td[data-field="LAY_TABLE_INDEX"]').text(index + 1); }); }, done: function (res, curr, count, origin) { // console.log(res); } }) } function query(type) { let name = $('#name').val(); let bidCode = parent.parent.parent.$('#bidPro').val() initTable(bidCode,name); }