a224c2c0860dcc8b4dc92631c7312ebaeeb81235.svn-base 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author
  6. * @date 2015/09/14
  7. */
  8. TranferAddEdit = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. /**私有方法**/
  12. /***新增信息***/
  13. _this.save = function(){
  14. $form = $('#editForm');
  15. var valid = $form.validationEngine({returnIsValid: true});
  16. if(!valid){
  17. top.Dialog.alert(CHECKREDBOX);
  18. }
  19. if(valid){
  20. var teamPeopNo1 = $("#peopNO").val();//队伍总人数
  21. var teamPeopNo2 = $("#POPULATION_395").val();//人数输入框填的人数
  22. /*if(teamPeopNo2 > teamPeopNo1){
  23. top.Dialog.alert("您输入的人数不能大于队伍总人数!");
  24. return;
  25. }*/
  26. var teamCount = $("#count").val();
  27. if(teamCount==1){
  28. showProgressBar("正在提交中...");
  29. var teamRealName = $("#TEAM_NEAM_395").attr("relText");
  30. $("#TEAM_REAL_NEAM_395").val(teamRealName);//保存队伍名称的NAME
  31. var formValue = $(".teamMsgForm").serialize();
  32. //var url = 'nwyj/ws/crud/CRUDService/create/';
  33. $("body").eq(0).showLoading();
  34. $.ajax({
  35. //url : $.pathname() + '/ws/crud/CRUDService/create/',
  36. url : $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad",//附件保存
  37. type : 'post',
  38. timeout : 15000,
  39. data : formValue,
  40. dataType : 'json',
  41. success : function(result){
  42. $("body").eq(0).hideLoading();
  43. top.Dialog.alert("保存成功!");
  44. if(isWaitDo == 1){
  45. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  46. }else{
  47. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/team/allotManage.jsp?pagenumber="+1);
  48. }
  49. //$('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/team/allotManage.jsp?pagenumber="+1);
  50. },
  51. error : function(e){
  52. top.Dialog.alert("保存失败");
  53. }
  54. });
  55. }else if(teamCount>1){
  56. for(var i=0;i<teamCount;i++){
  57. showProgressBar("正在提交中...");
  58. // var teamRealName = $("form:eq("+i+") #DCV_RANK_395").val();
  59. // var teamrenNum = $("form:eq("+i+") .teamRealName_0").val();
  60. // alert(teamrenNum +"********"+ teamRealName)
  61. var formValue = $("form:eq("+i+")").serialize();
  62. // $("body").eq(0).showLoading();
  63. $.ajax({
  64. // url : $.pathname() + '/ws/crud/CRUDService/create/',//保存的共用方法
  65. url : $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad",//附件保存
  66. type : 'post',
  67. timeout : 15000,
  68. async : false,
  69. data : formValue,
  70. dataType : 'json',
  71. success : function(result){
  72. //
  73. },
  74. error : function(e){
  75. top.Dialog.alert("保存失败!");
  76. return;
  77. }
  78. });
  79. }
  80. top.Dialog.alert("保存成功!");
  81. if(isWaitDo == 1){
  82. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  83. }else{
  84. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/team/allotManage.jsp?pagenumber="+1);
  85. }
  86. //$('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/team/allotManage.jsp?pagenumber="+1);
  87. }
  88. }
  89. };
  90. return {
  91. init : function() {
  92. $('#save').bind('click',function(){
  93. _this.save();
  94. });
  95. $('#cancel').bind('click',function(){
  96. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/team/TeamAddEditTest.jsp?fd_id="+fd_id);
  97. });
  98. $('#back').bind('click',function(){
  99. $(top.document.body).find(".positionTab").eq(1);
  100. //alert(fd_id == "");
  101. /*if(fd_id == ""){*/
  102. if(isWaitDo == 1){
  103. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  104. }else{
  105. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/team/allotManage.jsp?pagenumber="+1);
  106. }
  107. /*} else {
  108. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
  109. }*/
  110. });
  111. }
  112. };
  113. }();
  114. $(function() {
  115. TranferAddEdit.init();
  116. });