<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <% request.setAttribute("ctx", request.getContextPath()); %> <fmt:setBundle var="bundle" basename="i18n_config.message" scope="page" /> <!DOCTYPE html> <html> <head> <script type="text/javascript" src="${ctx }/js/base/pageview.js"></script> <style type="text/css"> td { word-wrap: break-word; word-break: break-all; 90px; } ul li { cursor: pointer; } </style> <script type="text/javascript"> var dnStr = ""; var totalPageCount = 1; var currentPage = 1; var apprAdminArr = [];//未审批的管理员数组 var checkFlag = true; var moreFlag = false; $(document).ready(function() { juqeryI18n(); apprAdminList(); initHid(); $('#myModal').on('show.bs.modal', function(e) { $(this).find('.modal-dialog').css({ 'margin-top' : "15%" }); }); }); function initHid() { var wid = $(".sidebar-menu").css("width"); if (wid == '50px') { //alert("jinlai"); $("#logoPic").css("display", 'none'); } else { $("#logoPic").css("display", 'inline'); } } //拒绝审批 function rejustAdmin() { let $this = $(this); $("#adminId").val($this.attr("parama")); $("#adminName").val($this.attr("paramb")); $("#confirm").attr("onclick", "rejustAdmin2();"); $('#myModal').modal('show'); } function rejustAdmin2() { var adminId = $("#adminId").val(); var adminName = $("#adminName").val(); var rejustReason = $("#rejustReason").val(); $.ajax({ type : "post", url : "${ctx}/threeAdminApprovalController/updateAdminApproval.do", data : { "idStrA" : adminId + "", "isApproval" : "true", "isRejust" : "true", "rejustReason" : rejustReason, "loginNameStr" : adminName }, dataType : "json", success : function(jsonObj) { var info = jsonObj.info; swal("", info, "info"); apprAdminList(); }, error : function() { swal("", "审批异常", "error"); } }); } //审批管理员 function approvalAdmin() { let $this = $(this); var adminId = $this.attr("parama"); var loginNameStr = $this.attr("paramb"); $.ajax({ type : "post", url : "${ctx}/threeAdminApprovalController/updateAdminApproval.do", data : { "idStrA" : adminId + "", "isApproval" : "true", "isRejust" : "false", "rejustReason" : "", "loginNameStr" : loginNameStr + "" }, dataType : "json", success : function(jsonObj) { var result = jsonObj.result; if (result == "true") { swal("", "审批成功", "info"); apprAdminList(); } else { swal("", "审批失败!", "error"); } }, error : function() { swal("", "审批异常", "error"); } }); } //查询未审批管理员列表 function apprAdminList() { window.$pageLoadEntity.doexecute({ init : [ [ "申请人", "adminLoginName" ], [ "审批类型", "approvalType", "", function(val) { if (val == "add") { return "添加"; } else if (val == "update") { return "修改"; } else if (val == "delete") { return "删除"; } } ], [ "审批对象登录名", "approvalLoginName" ], [ "审批对象姓名", "approvalAdminName" ], [ "审批对象部门全称", "approvalDeptName" ], [ "审批对象类型", "approvalAdminType", "", function(val) { if (val == "sysadmin") { return "系统管理员"; } else if (val == "secadmin") { return "安全管理员"; } else if (val == "auditadmin") { return "审计管理员"; } } ], [ "申请时间", "submitTime" ], [ "操作", "111" ] ], tableEle : "#nihao", upbtnEle : ".uppageview", dnbtnEle : ".dnpageview", contentEle : "section", cNumEle : "#currentPage", mnumEle : "#totalPage", ckValName : "id", bandClickEle : "#right_content", url : "${ctx}/threeAdminApprovalController/getAdminNoApprovalList" }); } //翻页 function turnPage(flag) { if (flag == "next") { if (currentPage == totalPageCount) { swal("", "已是最后一页", "info"); return; } currentPage++; } else { if (currentPage == 1) { swal("", "已是第一页", "info"); return; } currentPage--; } $("#currentPage").text(currentPage); pagination(apprFlowArr, createApprFlowList, pageNum); } //批量通过审批 function batchApproval() { var str = ""; var loginname = ""; var idStr; var loginNameStr; $('[name=nihao]:checkbox').each(function() { if (this.checked) { var val = $(this).parent().next().next().next().text(); str += this.value.split("@@")[0] + ","; loginname += this.value.split("@@")[1] + ","; } }); idStr = str.substring(0, str.length - 1); loginNameStr = loginname.substring(0, loginname.length - 1); if (idStr.length <= 0) { swal("", "请至少选择一项审批", "info"); return; } alert(idStr); $.ajax({ type : "post", url : "${ctx}/threeAdminApprovalController/updateAdminApproval.do", data : { "idStrA" : idStr, "isApproval" : "true", "isRejust" : "false", "rejustReason" : "", "loginNameStr" : loginNameStr }, dataType : "json", success : function(jsonObj) { var result = jsonObj.result; var info = jsonObj.info; $("#check_all").prop("checked", false); if (result == "true") { swal("", "审批通过成功", "info"); apprAdminList(); } else { swal("", info, "info"); } }, error : function() { swal("", "批量通过审批流程异常", "error"); } }); } //拒绝审批 function batchAjust(adminId) { var str = ""; var loginname = ""; var idStr; var loginNameStr; $('[name=nihao]:checkbox').each(function() { if (this.checked) { str += this.value.split("@@")[0] + ","; loginname += this.value.split("@@")[1] + ","; } }); idStr = str.substring(0, str.length - 1); loginNameStr = loginname.substring(0, loginname.length - 1); if (idStr.length <= 0 || loginNameStr.length <= 0) { swal("", "请至少选择一项审批", "info"); return; } alert(idStr); alert(loginNameStr); $("#adminId").val(idStr); $("#adminName").val(loginNameStr); $('#confirm').attr("onclick", "batchAjust2();"); $('#myModal').modal('show'); } //批量拒绝审批 function batchAjust2() { var nameStr = $("#adminId").val(); var loginNameStr = $("#adminName").val(); var rejustReason = $("#rejustReason").val(); $.ajax({ type : "post", url : "${ctx}/threeAdminApprovalController/updateAdminApproval.do", data : { "idStrA" : nameStr, "isApproval" : "true", "isRejust" : "true", "rejustReason" : rejustReason, "loginNameStr" : loginNameStr }, dataType : "json", success : function(jsonObj) { var result = jsonObj.result; var info = jsonObj.info; $("#check_all").prop("checked", false); if (result == "rejust") { apprAdminList(); } swal("", info, "info"); }, error : function() { swal("", "批量拒绝审批流程异常", "error"); } }); } //初始化table事件 function initTable() { $("#check_all").click(function() { if (this.checked) { $(":checkbox").prop("checked", true); } else { $(":checkbox").prop("checked", false); } }); $('[name=checkboxt]:checkbox').click(function() { if (!this.checked) { $("#check_all").prop("checked", false); } checkFlag = true; $('[name=checkboxt]:checkbox').each(function() { if (!this.checked) { checkFlag = false; } }); if (checkFlag) { $("#check_all").prop("checked", true); } }); } </script> </head> <body> <!-- Main content --> <section class="content"> <div class="title"> <div style="margin-left: 34px;" class="btn-group" role="group" aria-label="..." id="more_btn"> <button type="button" class="btn btn-default"> <i style="color: rgb(41, 139, 253); font-size: 16px;" class="fa fa-plus-circle"></i> </button> <div class="btn-group" role="group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <strong>更多</strong> <span class="caret"></span> </button> <ul class="dropdown-menu"> <li onclick="batchApproval();"><a>通过</a></li> <li onclick="batchAjust();"><a>拒绝</a></li> </ul> </div> </div> <div class="btn-group mybtn-group" style="float: right;"> <button type="button" class="btn btn-default uppageview"> <span class="ion-arrow-left-b"></span> </button> <button type="button" class="btn btn-default dnpageview"> <span class="ion-arrow-right-b"></span> </button> </div> <span style="float: right; margin-top: 8px; font-weight: bold;"><span id="currentPage">1</span>/<span id="totalPage">1</span></span> <!-- </div> --> </div> <div class="main no_nav_main" id="main"> <div class="inner-body" id="inner_body"></div> <div id="table_list" style=" 100%;"> <table id="nihao" class="table table-bordered table-hover table-striped" style="margin: 5px; 99%;"> </table> </div> </div> </section> <!-- /.content --> <!-- 模态框 (Modal)--> <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">拒绝原因</h4> </div> <div class="modal-body"> <input hidden="hidden" id="adminId"></input> <input hidden="hidden" id="adminName"></input> <textarea rows="4" cols="78" id="rejustReason"></textarea> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">取消 </button> <button type="button" class="btn btn-primary" id="confirm" data-dismiss="modal" onclick="rejustAdmin2();">确定</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal --> </div> </body> </html>