de76957ff91ea51916783412300575e48b6f79c3.svn-base 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /**
  2. * 功能:应急预警报告添加及修改
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/09/14
  7. */
  8. ReportInputPlanAddEdit = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. /**私有方法**/
  12. /***新增信息***/
  13. _this.save = function(){
  14. if(_is_add){
  15. top.Dialog.alert("不能重复添加预警填报要求,请重新选择!");
  16. return;
  17. }
  18. var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
  19. var obj = getTimeId();
  20. if(!checkTime()){
  21. return;
  22. }else if(!decideTime()){
  23. return ;
  24. } else if(!checkTimes()){
  25. return;
  26. }else if(!checkTimeAdd("addTime",obj,timeindex)){
  27. return;
  28. }else if(pattern.test($("#PROGRAMME_NAME_320").val())){
  29. top.Dialog.alert("填报要求名称不能包含特殊字符");
  30. return;
  31. }
  32. $('#editForm input[name="classid"]').val('320');
  33. var deptName = $("#WRITE_DEPT_ID_320_show").val();
  34. $("#WRITE_DEPT_NAME_320").val(deptName);
  35. $form = $('#editForm');
  36. var valid = $form.validationEngine({returnIsValid: true});
  37. if($("#show_WRITE_DEPT_ID_320").val()==""){
  38. $("#show_WRITE_DEPT_ID_320").addClass("error-field");
  39. }else{
  40. $("#show_WRITE_DEPT_ID_320").removeClass("error-field");
  41. }
  42. if(!valid){
  43. top.Dialog.alert(CHECKREDBOX);
  44. return;
  45. }
  46. if(valid){
  47. showProgressBar("正在提交中...");
  48. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  49. var _write_dept_name = $("#selectTree3_input").val();
  50. if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){
  51. url = $.pathname() +"/ws/crud/CRUDService/update/";
  52. }
  53. var formValue = $form.serialize();
  54. $.request.add(url,formValue,function(data){
  55. closeProgress();
  56. top.Dialog.alert(data.Msg.info);
  57. if(isAlert != null && isAlert == 0){
  58. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId);
  59. }else{
  60. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp");
  61. }
  62. });
  63. }
  64. };
  65. _this.saveAndRelease = function(){
  66. if(_is_add){
  67. top.Dialog.alert("不能重复添加预警填报要求,请重新选择!");
  68. return;
  69. }
  70. if(!checkTime()){
  71. return;
  72. }else if(!decideTime()){
  73. return ;
  74. } else if(!checkTimes()){
  75. return;
  76. }
  77. $('#editForm input[name="classid"]').val('320');
  78. var deptName = $("#WRITE_DEPT_ID_320_show").val();
  79. $("#WRITE_DEPT_NAME_320").val(deptName);
  80. $form = $('#editForm');
  81. var valid = $form.validationEngine({returnIsValid: true});
  82. if(!valid){
  83. top.Dialog.alert(CHECKREDBOX);
  84. }
  85. if(valid){
  86. showProgressBar("正在提交中...");
  87. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  88. var _write_dept_name = $("#selectTree3_input").val();
  89. if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){
  90. url = $.pathname() +"/ws/crud/CRUDService/update/";
  91. }
  92. $("#IS_RELEASE_320").val("1");
  93. var formValue = $form.serialize();
  94. $.request.add(url,formValue,function(data){
  95. closeProgress();
  96. //top.Dialog.alert(data.Msg.info);
  97. top.Dialog.confirm("发布成功!是否发送短信通知?", function() {
  98. var comp_id = $("input[name=WRITE_DEPT_ID_320]").val();
  99. $.ajax({
  100. url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg',
  101. type : 'post',
  102. data : {
  103. /*'fd_id' : fd_id,
  104. 'userId':userId,*/
  105. 'comp_id':comp_id
  106. },
  107. async:false,
  108. dataType : 'json',
  109. success : function(data) {
  110. addMsg(data.list.split("|")[0],data.list.split("|")[1],"新发布了一个预警报告填报要求,请及时填报!",1);
  111. },
  112. error : function(e) {
  113. $.messager.alert('访问服务失败!', 'error');
  114. }
  115. });
  116. },function(){
  117. if(isAlert != null && isAlert == 0){
  118. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId);
  119. }else{
  120. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp");
  121. }
  122. });
  123. });
  124. }
  125. };
  126. _this.formReset = function(){
  127. //if(fd_id!=undefined&&fd_id!=""){
  128. $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/alert/report/reportInputPlan/ReportInputPlanAddEdit.jsp?fd_id='+fd_id);
  129. //}else{
  130. // document.getElementById("editForm").reset();
  131. // $("#dept_name").resetValue();
  132. //}
  133. };
  134. return {
  135. init : function() {
  136. $('#save').bind('click',function(){
  137. _this.save();
  138. });
  139. $("#saveAndRelease").bind("click",function(){
  140. _this.saveAndRelease();
  141. })
  142. $('#goback').bind('click',function(){
  143. if(isAlert != null && isAlert == 0){
  144. $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId);
  145. }else{
  146. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp");
  147. }
  148. });
  149. }
  150. };
  151. }();
  152. $(function() {
  153. ReportInputPlanAddEdit.init();
  154. });
  155. window.onload = function(){
  156. $(".selectbox").attr("readonly","readonly");
  157. };