f1622a2ed9f0db01bc4d1f8f5708c12f91011e45.svn-base 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <%@page language="java" pageEncoding="UTF-8"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>导入预案信息</title>
  7. <!--框架必需start-->
  8. <%@include file="../../../include.jsp" %>
  9. <!--框架必需end-->
  10. <style type="text/css">
  11. .back{
  12. margin:10px 0px 10px 15px;
  13. }
  14. </style>
  15. <script type="text/javascript" src="../../../../scripts/business/am/ContingercyPlan/ContingercyPlan-import.js"></script>
  16. </head>
  17. <body>
  18. <div style="height: 50px;background: #F8F8F8;" align="center"><a href="javascript:;"><img id="back" class="back" title="返回" align="left" alt="返回" src="/nwyj/images/temp/back.png" onclick="goBack()"></img></a><font style="font-weight: bold;font-size: 20px;line-height: 45px;">导入预案信息</font></div>
  19. <form id="fillForm" method="post" enctype="multipart/form-data">
  20. <table width="100%" class="tableStyle">
  21. <tr style="display: none;">
  22. <td>
  23. <input type="hidden" name="classid"
  24. value="214" required="true" />
  25. </tr>
  26. <tr>
  27. <td width="10%">选择导入文件:</td>
  28. <td width="70%">
  29. <input name="import" fileWidth="300" id="import" type="file" contenteditable="false" />
  30. </td>
  31. <td width="10%"><div><input type="button" value="下载应急预案导入模版" onclick="xiazai()"/></div></td>
  32. <td width="10%" align="center"><div id="sure"><input type="button" value="确定" onclick="submitInfo()"/></div></td>
  33. </tr>
  34. </table>
  35. </form>
  36. <div class="padding_right5">
  37. <div id="maingrid"></div>
  38. </div>
  39. <script type="text/javascript">
  40. $(function(){
  41. $("#back").hover(function(){
  42. $(this).attr("src","/nwyj/images/temp/back_hover.png");
  43. },function(){
  44. $(this).attr("src","/nwyj/images/temp/back.png");
  45. });
  46. });
  47. //导入方法
  48. function submitInfo() {
  49. /* var val= $("#import").val();
  50. var end = val.substring(val.indexOf(".")-15);
  51. if(end=="contingencyyuan.xls"||end=="contingencyyuan.xlsx"){ */
  52. addfn();
  53. /* }else{
  54. top.Dialog.alert("请导入正确的excel文件");
  55. return;
  56. } */
  57. };
  58. //保存
  59. function fileToSave($form,listGrid,msg){
  60. //showProgressBar("正在提交中...");
  61. //表单异步提交处理
  62. $form.ajaxSubmit({
  63. url:$.pathname() + "/ws/ContingercyPlanExcel/ContingercyPlanExcelToDBTableTool/importFile",
  64. //type : 'post',
  65. timeout : 15000,
  66. async: false,
  67. success: function(responseText, statusText, xhr, $form){
  68. encodeURI(responseText);
  69. //alert(responseText);
  70. responseText = eval('('+responseText+')');
  71. var length = responseText.rows.length;
  72. if(length>1000){
  73. top.Dialog.alert('导入的数据一次不能超过1000条,请分批次导入。');
  74. return;
  75. }
  76. var data = JSON.stringify(responseText);
  77. testData = JSON.parse(decodeURI(data));
  78. initGrid(testData);
  79. },
  80. error : function(e) {
  81. top.Dialog.alert('导入失败,请用正确的模板导入!', '访问服务失败!', 'error');
  82. }
  83. });
  84. }
  85. //导入excle
  86. function addfn() {
  87. var $form = $("#fillForm");
  88. fileToSave($form,'','');
  89. };
  90. </script>
  91. </body>
  92. </html>