008858b0983c38df9db4bbeeef81f52c97de2818.svn-base 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author
  6. * @date 2015/09/14
  7. */
  8. EventAddEdit = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. /**私有方法**/
  12. /***新增信息***/
  13. _this.save = function(){
  14. $('#editForm input[name="classid"]').val('397');
  15. $form = $('#editForm');
  16. var valid = $form.validationEngine({returnIsValid: true});
  17. if(!valid){
  18. top.Dialog.alert(CHECKREDBOX);
  19. return;
  20. }
  21. if(valid){
  22. showProgressBar("正在提交中...");
  23. $("body").eq(0).showLoading();
  24. var formValue = $form.serialize();
  25. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  26. if(fd_id!=undefined&&fd_id!=""){
  27. url = $.pathname() +"/ws/crud/CRUDService/update/";
  28. }
  29. $.request.add(url,formValue,function(data){
  30. $("body").eq(0).hideLoading();
  31. top.Dialog.alert(data.Msg.info);
  32. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickReport.jsp");
  33. });
  34. }
  35. };
  36. /***保存发布***/
  37. _this.saveAndRelease = function(){
  38. $('#editForm input[name="classid"]').val('397');
  39. $form = $('#editForm');
  40. var valid = $form.validationEngine({returnIsValid: true});
  41. if(!valid){
  42. top.Dialog.alert(CHECKREDBOX);
  43. return;
  44. }
  45. if(valid){
  46. showProgressBar("正在提交中...");
  47. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  48. if(fd_id!=undefined && fd_id != "" && fd_id!="null"){
  49. url = $.pathname() +"/ws/crud/CRUDService/update/";
  50. }
  51. $("#RELEASE_STATE_397").val("1");
  52. var formValue = $form.serialize();
  53. $.request.add(url,formValue,function(data){
  54. closeProgress();
  55. //top.Dialog.alert(data.Msg.info);
  56. top.Dialog.confirm("发布成功!是否发送短信通知?", function() {
  57. $.ajax({
  58. url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg',
  59. type : 'post',
  60. data : {
  61. 'comp_id':$("#EVENT_UNIT_397").val()
  62. },
  63. async:false,
  64. dataType : 'json',
  65. success : function(data) {
  66. alert(JSON.stringify(data));
  67. addMsg(data.list.split("|")[0],data.list.split("|")[1],"新发布了一个响应报告填报要求,请及时填报!",1);
  68. },
  69. error : function(e) {
  70. $.messager.alert('访问服务失败!', 'error');
  71. }
  72. });
  73. },function(){
  74. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickReport.jsp");
  75. });
  76. });
  77. }
  78. };
  79. _this.formReset = function(){
  80. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickAddEdit.jsp?fd_id="+fd_id);
  81. };
  82. return {
  83. init : function() {
  84. $('#save').bind('click',function(){
  85. _this.save();
  86. });
  87. $("#saveAndRelease").bind("click",function(){
  88. _this.saveAndRelease();
  89. });
  90. $('#back').bind('click',function(){
  91. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickReport.jsp");
  92. });
  93. }
  94. };
  95. }();
  96. $(function() {
  97. EventAddEdit.init();
  98. });