var example = null; var pers = null ; var form = null; var usernameLogin = localStorage.getItem("usernameLogin"); $(function () { layui.use([ 'layer' ,'form'], function() { var layer = layui.layer; form = layui.form; getProject(form); }); pers = checkPermission(); init(); $("#searchBt").click(function(){ example.ajax.reload(); }); }) function init(){ example = $('#dt-table').DataTable({ "searching": false, "processing": true, //加载数据时显示进度状态 "serverSide" : true, "pagingType": "full_numbers", //首页|尾页 "language": { "url": "../../../js/plugin/datatables/Chinese.lang" }, "ajax": { "url" : smz_ht_url + "/SubPrincipalManagement", "type":"get", "data":function(d){ d.proId = $("#proId").val();//关键字部分,查询功能 d.keyWord = $("#keyWord").val();//关键字部分,查询功能 }, "error":function(xhr, textStatus, errorThrown){ var msg = xhr.responseText; console.log(msg); var response = JSON.parse(msg); var code = response.code; var message = response.message; if (code == 400) { layer.msg(message); } else if (code == 401) { localStorage.removeItem("token"); layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){ location.href = smz_ht_url + '/login.html'; }); } else if (code == 403) { console.log("未授权:" + message); layer.msg('未授权'); } else if (code == 500) { console.log('系统错误:' + message); } } }, "lengthMenu": [ [10, 20, 50], [10, 20, 50] ], // 设置每页显示数据量选项 "drawCallback": function() { // alert( '表格重绘了' ); var thisDataTable = $('#dt-table').DataTable(); $(".pagination").append("
  • " + "" + "确认
  • "); //点击按钮跳转指定页数 $('#dataTable-btn').click(function (e) { if ($("#changePage").val() && $("#changePage").val() > 0) { var redirectpage = $("#changePage").val() - 1; } else { var redirectpage = 0; } thisDataTable.page(redirectpage).draw( 'page' ); }); //敲击回车键跳转指定页数 $("#changePage").keypress(function (e) { if(event.keyCode==13){ if ($("#changePage").val() && $("#changePage").val() > 0) { var redirectpage = $("#changePage").val() - 1; } else { var redirectpage = 0; } thisDataTable.page(redirectpage).draw( 'page' ); } }); }, "dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-4 col-xs-4 hidden-xs'i><'col-xs-8 col-sm-8' p v>><'dt-table-length'l>", "columns": [ { width : '40px', "orderable": false, data : function(row, type, set, meta) { var c = meta.settings._iDisplayStart + meta.row + 1; return c; } }, { "data": "proName","defaultContent": "","orderable": false,}, { "data": "subName","defaultContent": "","orderable": false,}, { "data": "name","defaultContent": "","orderable": false,}, { "data": "", "defaultContent": "", "orderable": false, "render": function (data, type, row) { var idCardJustURL = row['idCardJustURL']; var html = ''; if(idCardJustURL == '' || idCardJustURL == null){ html = '未上传' }else{ html = '点击预览' } return html; } }, { "data": "", "defaultContent": "", "orderable": false, "render": function (data, type, row) { var idCardBackURL = row['idCardBackURL']; var html = ''; if(idCardBackURL == '' || idCardBackURL == null){ html = '未上传' }else{ html = '点击预览' } return html; } }, { "data": "", "defaultContent": "", "orderable": false, "render": function (data, type, row) { var operationVideoURL = row['operationVideoURL']; var html = ''; if(operationVideoURL == '' || operationVideoURL == null){ html = '未上传' }else{ html = '点击预览' } return html; } }, { "data": "", "defaultContent": "", "orderable": false, "render": function (data, type, row) { var esignatureURL = row['esignatureURL']; var html = ''; if(esignatureURL == '' || esignatureURL == null){ html = '未上传' }else{ html = '点击预览' } return html; } }, { "data": "", "defaultContent": "", "orderable": false, "render": function (data, type, row) { var powerOfAttorneyURL = row['powerOfAttorneyURL']; var html = ''; if(powerOfAttorneyURL == '' || powerOfAttorneyURL == null){ html = '未上传' }else{ html = '点击预览' } return html; } }, { "data": "", "width":"10%", "defaultContent": "", "orderable": false, "render": function (data, type, row) { var buAudit = row['auditResult']; var html = ''; if (buAudit == '0'){ html+= "待审核"; } else if (buAudit == '1'){ html+= "审核通过"; } else { html+= "审核不通过"; } return html; } }, { "data": "auditRemark", "width":"10%", "defaultContent": "", "orderable": false, }, { "data": "", "width":"10%", "defaultContent": "", "orderable": false, "render": function (data, type, row) { var id = row['id']; var buAudit = row['auditResult']; var html = ''; if (buAudit == '0'){ if(usernameLogin == "bnsAdmin" || usernameLogin == "cygrAdmin"){ html+= buttonAudit(id, "", pers); } } return html; } }, ], "order": [] //在栏目列上显示排序功能 } ); } /** * 审核工程 * */ function audit(id) { localStorage.setItem("auditId", id); var height = '75%'; var width = '75%'; var index = layer.open({ title: ['审核', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'], type: 2, content: 'SubPrincipalManagementAudit.html', data: {"id": id}, area: [width, height], maxmin: false, btn: ['确定', '关闭'], success: function (layero, index) { }, yes: function (index, layero) { // 获取弹出层中的form表单元素 var formSubmit = layer.getChildFrame('form', index); var submited = formSubmit.find('button')[0]; // 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息 submited.click(); example.ajax.reload(); // 刷新页面 }, btn2: function (index, layero) { } }); } // 审核按钮 function buttonAudit(id, permission, pers) { if (permission != "") { if ($.inArray(permission, pers) < 0) { return ""; } } var btn = $(""); return btn.prop("outerHTML"); } function getPhoto(url) { var filePath = smz_ht_url + "/"+url; window.open(filePath); }