d41957401c4855100b0b93f121088aa5d8c86940.svn-base 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /**
  2. * 功能:应急预警报告添加及修改
  3. *
  4. *
  5. * @author LJP
  6. * @date 2015/12/29
  7. */
  8. ReportInputPlanAddEdit = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. /**私有方法**/
  12. /***新增信息***/
  13. _this.save = function(){
  14. if(is_overTime){
  15. top.Dialog.alert("自定义时间应大于当前时间!");
  16. return;
  17. }
  18. $('#requireForm input[name="classid"]').val('429');
  19. $form = $('#requireForm');
  20. var valid = $form.validationEngine({returnIsValid: true});
  21. if(!valid){
  22. /*top.Dialog.alert(CHECKREDBOX);*/
  23. var flag = $(".tem_content").is(":hidden");
  24. if($("#report_type").val().trim()==""){
  25. top.Dialog.alert("请选择报表类型");
  26. }else if($("#PROJECT_NAME_429").val().trim()==""){
  27. top.Dialog.alert("请填写计划名称");
  28. }else if($("input[name=REPORT_DEPT_429]").val().trim()==""){
  29. top.Dialog.alert("请选择填报单位");
  30. }else if($("#FILL_IN_SCHEDULE_429").val().trim()==""){
  31. top.Dialog.alert("请选择填报周期");
  32. }
  33. if(!flag&&$("#TEMPORARY_TIME_429").val().trim()==""){
  34. top.Dialog.alert("请填写自定义时间");
  35. }
  36. }
  37. if(valid){
  38. showProgressBar("正在提交中...");
  39. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  40. if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){
  41. url = $.pathname() +"/ws/crud/CRUDService/update/";
  42. }
  43. $("#REPORT_DEPT_NAME_429").val($("#REPORT_DEPT_429").attr("reltext"));
  44. var formValue = $form.serialize();
  45. /*alert(JSON.stringify(formValue));
  46. return;*/
  47. $.request.add(url,formValue,function(data){
  48. closeProgress();
  49. top.Dialog.alert(data.Msg.info);
  50. goback();
  51. });
  52. }
  53. };
  54. _this.saveAndRelease = function(){
  55. if(is_overTime){
  56. top.Dialog.alert("自定义时间应大于当前时间!");
  57. return;
  58. }
  59. $('#requireForm input[name="classid"]').val('429');
  60. $form = $('#requireForm');
  61. var valid = $form.validationEngine({returnIsValid: true});
  62. if(!valid){
  63. if($("#report_type").val().trim()==""){
  64. top.Dialog.alert("请选择报表类型");
  65. }else if($("#PROJECT_NAME_429").val().trim()==""){
  66. top.Dialog.alert("请填写计划名称");
  67. }else if($("input[name=REPORT_DEPT_429]").val().trim()==""){
  68. top.Dialog.alert("请选择填报单位");
  69. }else if($("#FILL_IN_SCHEDULE_429").val().trim()==""){
  70. top.Dialog.alert("请选择填报周期");
  71. }else if(!$("#TEMPORARY_TIME_429").is(":hidden")){
  72. if($("#TEMPORARY_TIME_429").val().trim()==""){
  73. top.Dialog.alert("请填写自定义时间");
  74. }
  75. }
  76. }
  77. if(valid){
  78. showProgressBar("正在提交中...");
  79. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  80. if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){
  81. url = $.pathname() +"/ws/crud/CRUDService/update/";
  82. }
  83. $("#SEND_STAT_429").val("1");
  84. $("#REPORT_DEPT_NAME_429").val($("#REPORT_DEPT_429").attr("reltext"));
  85. var formValue = $form.serialize();
  86. $.request.add(url,formValue,function(data){
  87. closeProgress();
  88. top.Dialog.alert(data.Msg.info);
  89. goback();
  90. });
  91. }
  92. };
  93. return {
  94. init : function() {
  95. $('#save').bind('click',function(){
  96. _this.save();
  97. });
  98. $("#saveAndRelease").bind("click",function(){
  99. _this.saveAndRelease();
  100. });
  101. }
  102. };
  103. }();
  104. $(function() {
  105. ReportInputPlanAddEdit.init();
  106. });