3e37892196d22c8895c831afa46835f216651f47.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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="../../../../include2.jsp" %>
  9. <!--框架必需end-->
  10. </head>
  11. <body>
  12. <form id="fileId" method="post" enctype="multipart/form-data" >
  13. <!-- <input type="hidden" name="classid" value="615"/> -->
  14. <table>
  15. <tr>
  16. <td width="10%" align="right"><span class="star">*</span>任务名称:</td>
  17. <td width="20%" id="renwu"></td>
  18. </tr>
  19. </table>
  20. <div id="fileDiv"></div>
  21. <div style="width: 100%; text-align:center"><input value="保存" type="button" onclick="javascript:saveAlertNotice();"/>&nbsp;&nbsp;<input value="重置" type="reset" /><br/></div>
  22. </form>
  23. <div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/nwyj/excels/list.xls" class="red underline">点击这里</a>下载导入的excel数据模板</div>
  24. <div class="padding_top5">&nbsp;&nbsp;&nbsp;&nbsp;说明:导入的excel需要遵循规定的格式,且导入的文件不能超过40M!</div>
  25. </html>
  26. <script type="text/javascript">
  27. var errorMessage=["请选择文件!","请选择正确的Excel文件!","导入Excel文件与模版不匹配!","选择导入的文件不能超过40M!"];
  28. <%-- var ifmHeight = "<%=request.getParameter("ifmHeight")%>"; --%>
  29. $(function(){
  30. //部门id
  31. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  32. $("#renwu").append('<select editable=false name="TASK_ID_632" prompt="请选择" class="validate[required]" id="TASK_ID_632" selAlign="" selWidth="200"></select>')
  33. //$("#renwu").render();
  34. // $("#TASK_ID_632").attr("prompt", "请选择");
  35. $("#TASK_ID_632").initBgdDutySelect("610", "FD_OBJECTID", "PROGRAM_NAME", "TASK_STATE='1' and (INPUT_UNIT_ID='" + deptId + "' or GPS_AREA_ID like '%" + deptId + "%')");
  36. $('#fileDiv').getDutyUploadFileContent();
  37. //s$(parent.document.body).find("#frmright").height(ifmHeight);
  38. });
  39. function saveAlertNotice(){
  40. var fform = $("#fileId");
  41. //alert(fform+"--+++++_____")
  42. myFileToSave(fform);
  43. };
  44. function myFileToSave($form){
  45. showProgressBar("正在提交中...");
  46. var task_id = $("#TASK_ID_632").attr("relvalue");
  47. if(task_id==undefined || task_id==""){
  48. top.Dialog.alert("请选择任务名称!");
  49. return;
  50. }
  51. var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  52. //部门id
  53. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  54. //表单异步提交处理
  55. $form.ajaxSubmit({
  56. //url:$.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad",
  57. url:$.pathname() + "/ws/duty/DutyRecordsService/mxbimportExcel?task_id="+ task_id+"&realName="+encodeURI(encodeURI(realName))+"&deptId="+deptId,
  58. //url:$.pathname() + "/ws/service0/BGDmingxibiao/saveBGDmingxibiao",
  59. //表单提交成功后的回调
  60. success : function(responseText, statusText, xhr, $form) {
  61. responseText = eval("(" + responseText + ")");
  62. closeProgress();
  63. //alert(responseText.success);//false
  64. if (responseText.success == 'true') {
  65. top.Dialog.alert("导入成功!",function(){
  66. if(top.Dialog || top.Dialog.close){
  67. top.Dialog.close();
  68. }
  69. });
  70. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/gps/queryStatistics/list/List.jsp');
  71. }else if(responseText.success == 'false'){
  72. if(responseText.info=='22'){
  73. top.Dialog.alert("导入的文档模版有误,请检查标题字段!");
  74. }else{
  75. var info = responseText.info;
  76. info = info.split("_");
  77. top.Dialog.alert("导入的文档第"+(parseInt(info[0])+1)+"行,第"+info[1]+"列数据有误,请按格式要求修改后再尝试导入!",function(){
  78. if(top.Dialog || top.Dialog.close){
  79. top.Dialog.close();
  80. }
  81. });
  82. }
  83. }else if(responseText.success == 'false1'){
  84. var info = responseText.info;
  85. info = info.split("_");
  86. top.Dialog.alert("导入的文档第"+(parseInt(info[0])+1)+"行,第"+info[1]+"列单位不在保供电责任单位之内,请检查修改后再尝试导入!",function(){
  87. if(top.Dialog || top.Dialog.close){
  88. top.Dialog.close();
  89. }
  90. });
  91. }
  92. },error:function( xhr,textStatus,errorThrown){
  93. top.Dialog.alert("导入失败!",function(){
  94. if(top.Dialog || top.Dialog.close){
  95. top.Dialog.close();
  96. }
  97. });
  98. }
  99. });
  100. }
  101. </script>