aaf2990b37c8f04c40a1407824768fe0825444f1.svn-base 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author
  6. * @date 2015/09/21
  7. */
  8. WeatherAlertReceiveAddEdit = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. /**私有方法**/
  12. /***新增信息***/
  13. _this.save = function(){
  14. var getCorp_names = top.com.sinosoft.lz.system.user.LoginInfo
  15. .getCorp_names();
  16. $("#WRITER_UNIT_NAME_369").val(getCorp_names);
  17. var connectId = $("#CONNECT_ID_369").val();
  18. if(connectId == undefined){
  19. $("#CONNECT_ID_369").val("");//关联ID
  20. }else if(connectId == ""){
  21. $("#CONNECT_ID_369").val(fd_id);//关联ID
  22. }
  23. $form = $('#editForm');
  24. var valid = $form.validationEngine({returnIsValid: true});
  25. if(!valid){
  26. top.Dialog.alert(CHECKREDBOX);
  27. }
  28. if(valid){
  29. var formValue = $form.serialize();
  30. //var url = $.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad";
  31. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
  32. //fileToSave($form,null,null,url);
  33. //显示loading条
  34. $("body").eq(0).showLoading();
  35. $.request.add(url,formValue,function(data){
  36. //隐藏loading条
  37. $("body").eq(0).hideLoading();
  38. top.Dialog.alert("保存成功");
  39. var url = "/nwyj/page/business/em/monitor/alertReceive/weather/WeatherAlertReceiveManager.jsp";
  40. top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
  41. });
  42. /*$.request.add(url,formValue,function(data){
  43. //隐藏loading条
  44. $("body").eq(0).hideLoading();
  45. top.Dialog.alert(data.Msg.info);
  46. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/monitor/alertReceive/weather/WeatherAlertReceiveManager.jsp');
  47. });*/
  48. }
  49. };
  50. //解除上次预警
  51. _this.relieveLastWarning =function() {
  52. var url =$.pathname()+'/ws/EventService/EventService/changeStatus/';
  53. var params = {
  54. objectid : $("#LAST_ID_369").val(),
  55. classid :$("#classid").val()
  56. };
  57. $.ajax({
  58. url : url,
  59. type : 'post',
  60. timeout : 15000,
  61. data : params,
  62. dataType : 'json',
  63. success : function(data){
  64. }
  65. });
  66. };
  67. //附件同步上传使用,异步时不使用该方法
  68. function fileToSave($form,listGrid,msg,url){
  69. //显示loading条
  70. $("body").eq(0).showLoading();
  71. //表单异步提交处理
  72. $form.ajaxSubmit({
  73. type: 'post',
  74. url:url,
  75. //表单提交成功后的回调
  76. success: function(responseText, statusText, xhr, $form){
  77. //隐藏loading
  78. $("body").eq(0).hideLoading();
  79. responseText = eval('('+responseText+')');
  80. if(msg!=undefined){
  81. if(responseText.info == 'success')
  82. top.Dialog.alert(msg+'成功!');//弹出提示
  83. else
  84. top.Dialog.alert(msg+'失败!');//弹出提示
  85. }else{
  86. if(responseText.info == 'success')
  87. top.Dialog.alert('保存成功!');//弹出提示
  88. else
  89. top.Dialog.alert('保存失败!');//弹出提示
  90. }
  91. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/monitor/alertReceive/weather/WeatherAlertReceiveManager.jsp');
  92. }
  93. });
  94. }
  95. return {
  96. init : function() {
  97. //保存
  98. $('#save').bind('click',function(){
  99. var pageType1 = "";
  100. if(pageType == 0){
  101. pageType1 = "保存";
  102. }else if(pageType == 1){
  103. pageType1 = "调整";
  104. }else if(pageType == 2){
  105. pageType1 = "解除";
  106. }
  107. if($("#LAST_ID_369").val()){
  108. top.Dialog.confirm("是否确认"+pageType1+"当前预警通知单?", function() {
  109. _this.relieveLastWarning();
  110. _this.save();
  111. });
  112. }else{
  113. _this.save();
  114. }
  115. });
  116. //取消
  117. $('#cancel').bind('click',function(){if(fd_id.length>0){
  118. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/monitor/alertReceive/weather/WeatherAlertReceiveAddEdit.jsp?fd_id='+fd_id);
  119. }else{
  120. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/monitor/alertReceive/weather/WeatherAlertReceiveAddEdit.jsp?fd_id=');
  121. }
  122. });
  123. //返回
  124. $('#back').bind('click',function(){
  125. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/monitor/alertReceive/weather/WeatherAlertReceiveManager.jsp');
  126. });
  127. }
  128. };
  129. }();
  130. $(function() {
  131. WeatherAlertReceiveAddEdit.init();
  132. });