2dd20a9ca45d8436fd75c80b625aa3c27e36736c.svn-base 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /**
  2. * 功能:应急预警报告添加及修改
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/09/14
  7. */
  8. ReportInputAddEdit = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. /**私有方法**/
  12. /***新增信息***/
  13. _this.save = function(){
  14. $("#IS_RELEASE_321").val("0");
  15. $("#OPR_STATE_321").val("0");
  16. var file = $("#uploaderFileRealName").val();
  17. var maingridtext = $("#maingrid").text();
  18. /*if(!file && !maingridtext){
  19. top.Dialog.alert("请上传报告附件!");
  20. return;
  21. }*/
  22. $form = $('#editForm');
  23. var valid = $form.validationEngine({returnIsValid: true});
  24. if(!valid){
  25. top.Dialog.alert(CHECKREDBOX);
  26. }
  27. if(!hasFile()){
  28. top.Dialog.alert("请上传附件!");
  29. return;
  30. }
  31. if(valid){
  32. showProgressBar("正在提交中...");
  33. var formValue = $form.serialize();
  34. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  35. $.request.add(url,formValue,function(data){
  36. closeProgress();
  37. top.Dialog.alert(data.Msg.info);
  38. if(pagetype=="daiban"){
  39. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  40. }else{
  41. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
  42. }
  43. });
  44. /*var url = $.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad";
  45. if(fd_id!=undefined&&fd_id!=""){
  46. url = $.pathname() +"/ws/uploadForm/FileUpDownService/editlocation";
  47. }*/
  48. //fileToSave($form,null,null,url);
  49. }
  50. };
  51. _this.saveAndRelease = function(){
  52. $("#IS_RELEASE_321").val("1");
  53. $("#OPR_STATE_321").val("1");
  54. $form = $('#editForm');
  55. var valid = $form.validationEngine({returnIsValid: true});
  56. if(!valid){
  57. top.Dialog.alert(CHECKREDBOX);
  58. }
  59. if(!hasFile()){
  60. top.Dialog.alert("请上传附件!");
  61. return;
  62. }
  63. if(valid){
  64. showProgressBar("正在提交中...");
  65. var formValue = $form.serialize();
  66. var plan_id = $("#PLAN_ID_321").attr("selvalue");
  67. $.ajax({
  68. url : $.pathname() + '/ws/qrps/QueryReportProgrammeService/loadReportInputByDeptAndTaskId',
  69. type : 'post',
  70. timeout : 15000,
  71. data : {
  72. planId : plan_id,
  73. deptId : top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(),
  74. reportType:"2"
  75. },
  76. ansyc:false,
  77. dataType : 'text',
  78. success : function(data) {
  79. if(data=="true"){
  80. top.Dialog.confirm("同时段,该填报要求响应报告已上报过,是否继续发布并上报覆盖之前的报告?", function(){
  81. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  82. top.Dialog.confirm("该报告尚未发布,是否发布并上报?|上报", function(){
  83. $.request.add(url,formValue,function(data){
  84. top.Dialog.alert('保存并上报成功!', null, null, null, -1);
  85. if(pagetype=="daiban"){
  86. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  87. }else{
  88. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
  89. }
  90. });
  91. });
  92. },
  93. function(){return;}
  94. );
  95. }else{
  96. top.Dialog.confirm("该报告尚未发布,是否发布并上报?|上报", function(){
  97. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  98. $.request.add(url,formValue,function(data){
  99. top.Dialog.alert('保存并上报成功!', null, null, null, -1);
  100. if(pagetype=="daiban"){
  101. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  102. }else{
  103. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
  104. }
  105. });
  106. },
  107. function(){return;}
  108. );
  109. }
  110. },
  111. error : function(e) {
  112. $.messager.alert('上报失败');
  113. }
  114. });
  115. };
  116. };
  117. function fileToSave($form,listGrid,msg,url){
  118. showProgressBar("正在提交中...");
  119. //表单异步提交处理
  120. $form.ajaxSubmit({
  121. type: 'post',
  122. url:url,
  123. //表单提交成功后的回调
  124. success: function(responseText, statusText, xhr, $form){
  125. responseText = eval('('+responseText+')');
  126. closeProgress();
  127. if(msg!=undefined){
  128. if(responseText.info == 'success')
  129. top.Dialog.alert(msg+'成功!');//弹出提示
  130. else
  131. top.Dialog.alert(msg+'失败!');//弹出提示
  132. }else{
  133. if(responseText.info == 'success')
  134. top.Dialog.alert('保存成功!');//弹出提示
  135. else
  136. top.Dialog.alert('保存失败!');//弹出提示
  137. }
  138. if(pagetype=="daiban"){
  139. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  140. }else{
  141. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
  142. }
  143. }
  144. });
  145. }
  146. return {
  147. init : function() {
  148. $('#save').bind('click',function(){
  149. _this.save();
  150. });
  151. $('#goback').bind('click',function(){
  152. if(pagetype=="daiban"){
  153. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  154. }else{
  155. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
  156. }
  157. });
  158. $('#saveandrelease').bind('click',function(){
  159. _this.saveAndRelease();
  160. });
  161. }
  162. };
  163. }();
  164. $(function() {
  165. ReportInputAddEdit.init();
  166. });