var pers = [] var table,form layui.use(['form','layer','table'], function () { table = layui.table; form = layui.form; // 触发submit提交 按钮点击或者表单被执行提交时触发 form.on('submit(query)', function (data) { console.log("搜索") // 对表格进行重载。id 即 table表格的id table.reload('table', { // //设定异步数据接口的额外参数 page:{curr : 1} ,where: data.field }) return false; // 阻止表单跳转。如果需要表单跳转,去掉这段即可。 }); form.on('submit(reset)', function () { console.log("重置") $('#search1').val(''); $('#search2').val(''); $('#search3').val(''); $('#search4').val(''); form.render(); let obj = { search1:'', search2:'', search3:'', search4:'' } // 对表格进行重载。id 即 table表格的id table.reload('table', { // //设定异步数据接口的额外参数 page:{curr : 1} ,where: obj }) return false; // 阻止表单跳转。如果需要表单跳转,去掉这段即可。 }); init(); }); // 静态数据 var tableData = [ {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '2'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '2'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '3'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '3'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '4'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '4'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '4'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '2', contractStatus: '1'}, {id: 1, name: '李云飞', sex: '男', birthday: '1962-01-20', healthy: '健康', education: '小学', line:'500kVxxx线', area:'N1/N2/N3/N4/N5/N6/N7/N8/N9/N10', address: 'xxxxxxxxxxxxxxxxxxxx', phone:'15665366624', idCard: '342224196202241356', startTime:'2024-01-01',endTime:'2025-01-01', station: '昆明运检一站', comName: '运检一公司', personStatus: '1', contractStatus: '1'}, ]; /** * 初始化数据 */ function init(){ // 渲染表格 table.render({ elem: '#table', // url: "/sys/achievement", page: true, skin: 'line', // 表格样式 data: tableData, cols: [[ { title: '序号', field: 'zizeng', align: 'center', type: 'numbers' }, {field:'name', title: '姓 名',align: 'center',}, {field:'sex', title: '性别',align: 'center',}, {field:'birthday', title: '出生年月',align: 'center',}, {field:'healthy', title: '健康状况',align: 'center',}, {field:'education', title: '文化程度',align: 'center',}, {field:'line', title: '管辖线路名称',align: 'center'}, {field:'area', title: '范围、基数',align: 'center',width:170}, {field:'address', title: '住址',align: 'center', }, {field:'phone', title: '联系电话',align: 'center', }, {field:'idCard', title: '身份证号',align: 'center',}, {field:'startTime', title: '协议起始日期',align: 'center',}, {field:'endTime', title: '协议终止日期',align: 'center',}, {field:'station', title: '所属运检站',align: 'center',}, {field:'comName', title: '所属分公司',align: 'center',}, { field: '', title: '人员状态', align: 'center', templet: function(d){ var personStatus = d.personStatus; var text; var color; var html = ""; if(personStatus == '1'){ text = '在职'; color = '#19BE6B'; } if(personStatus == '2'){ text = '离职'; color = '#F56C6C'; } html += "" html += `  ` html += `${text}` html += "" return html; }, }, { field: '', title: '人员状态', align: 'center', templet: function(d){ var contractStatus = d.contractStatus; var text; var color; var html = ""; if(contractStatus == '1'){ text = '已签订'; color = '#19BE6B'; } if(contractStatus == '2'){ text = '未签订'; color = '#F56C6C'; } if(contractStatus == '3'){ text = '已过期'; color = '#F56C6C'; } if(contractStatus == '4'){ text = '临期预警'; color = '#FF9900'; } html += "" html += `  ` html += `${text}` html += "" return html; }, }, ]], }); } //导出 function exportData() { // let search1 = $('#search1').val(); // let search2 = $('#search2').val(); window.location.href = oiPlanUrl + "/monthlyPlanSubmission/export?token=" + token; }