importHrExcel.jsp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <%@ include file="/include/head.jsp"%>
  2. <%@ page contentType="text/html;charset=GBK"%>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  4. <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <HEAD>
  7. <TITLE>Excel导入</TITLE>
  8. <link href="main.css" rel="stylesheet" type="text/css"></link>
  9. <link href="./liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css"
  10. rel="stylesheet" type="text/css"></link>
  11. <script type="text/javascript" src="/shares/js/jquery-1.3.2.min.js"></script>
  12. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"
  13. type="text/javascript"></script>
  14. <script type="text/javascript" src="/shares/js/common.js"></script>
  15. <script type="text/javascript" src="/shares/js/constant.js"></script>
  16. <script type="text/javascript">
  17. $(function(){
  18. if(top.importWaitDlg)top.importWaitDlg.close();
  19. <c:if test="${result ne null}">
  20. var result = "${result}";
  21. if(result == "-1"){
  22. top.$.ligerDialog.error('导入失败:Excel文件中没有数据!');
  23. }else if(result == "-2"){
  24. showErrorDiv();
  25. //top.$.ligerDialog.error('数据验证不通过,请查询模板格式是否正确!');
  26. }else if(result == "0"){
  27. /* top.$.ligerDialog.success('操作成功!'); */
  28. showErrorDiv();
  29. }else{
  30. top.$.ligerDialog.success('成功导入'+result+'条数据!');
  31. }
  32. /* <c:if test="${fn:length(infoList) gt 0}">
  33. showInfoDiv();
  34. </c:if> */
  35. </c:if>
  36. });
  37. function importExcel(operner){
  38. var rs = $.validate({name:"files",model:[{type:"require",msg:"Excel文件不能为空!"}]});
  39. if(!rs)return;
  40. var mess = "确定要导入吗?";
  41. top.$.ligerDialog.confirm(mess, function (yes){
  42. if(yes){
  43. top.importWaitDlg = top.$.ligerDialog.waitting('正在导入中,请稍候...');
  44. $("#excelForm").submit();
  45. }}
  46. );
  47. }
  48. function showErrorDiv(){
  49. top.$.ligerDialog.open({ title:"数据验证不通过",height: 200, target : errorDiv , width: 400, slide: false, buttons: [ { text: '确定', onclick: function (item, dialog) { dialog.hidden(); } } ] });
  50. }
  51. function showInfoDiv(){
  52. top.$.ligerDialog.open({ title:"数据导入成功",height: 200, target : infoDiv , width: 400, slide: false, buttons: [ { text: '确定', onclick: function (item, dialog) { dialog.hidden(); } } ] });
  53. }
  54. </script>
  55. </HEAD>
  56. <BODY>
  57. <%@ include file="/include/message.jsp"%>
  58. <div class="l-content">
  59. <FORM method="post" name="excelForm" id="excelForm" action="hrImportAction.do?task=excelImporthr&type=${type }" enctype="multipart/form-data">
  60. <div class="forum-container">
  61. <center>
  62. <table border="0" cellspacing="1" cellpadding="0" class="l-table-edit line">
  63. <tr>
  64. <td width="25%"><b>Excel文件</b><font color="red">*</font>:</td>
  65. <td width="55%"><input type="file" name="files" id="files" /></td>
  66. <%--<td class="l-table-edit-td"><input type="button" onclick="submitExcelForm('supplier')" class="l-button" value="导入" /></td> --%>
  67. <td ><a href="${pageContext.request.contextPath}/yw/hr/import/${type }.xls" >下载模版</a> </td>
  68. </tr>
  69. </table>
  70. </center>
  71. </div>
  72. </FORM>
  73. </div>
  74. <div id="errorDiv" style="display: none;">
  75. <div style="color: red;margin:10px 0 10px 0 ">总共有${fn:length(errList)}条数据有问题,请修复后重新导入:</div>
  76. <c:forEach items="${errList}" var="err">
  77. <div style="color: red;">${err}</div>
  78. </c:forEach>
  79. </div>
  80. <div id="infoDiv" style="display: none;">
  81. <c:forEach items="${infoList}" var="info">
  82. <div style="color: green;">${info}</div>
  83. </c:forEach>
  84. </div>
  85. </BODY>
  86. </HTML>