f0cbe52b90a57f1898bda042ece72f26009c24ae.svn-base 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. var typeJson = [{"key":"台风","value":"台风"},
  2. {"key":"地震","value":"地震"},
  3. {"key":"冰灾","value":"冰灾"},
  4. {"key":"降水","value":"降水"},
  5. {"key":"其他","value":"其他"}];
  6. /***新增事件***/
  7. function save(){
  8. $form = $('#editForm');
  9. var valid = $form.validationEngine({returnIsValid: true});
  10. if(!valid){
  11. top.Dialog.alert(CHECKREDBOX);
  12. return;
  13. }
  14. getEventName();
  15. if(valid){
  16. showProgressBar("正在提交中...");
  17. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  18. if(fd_id && fd_id!="null" && fd_id.length>0){//修改
  19. url = $.pathname() + '/ws/crud/CRUDService/update/';
  20. }
  21. var formValue = $form.serialize();
  22. $.ajax({
  23. url : url,
  24. type : 'post',
  25. data : formValue,
  26. dataType : 'json',
  27. async: false,
  28. success : function(data){
  29. }
  30. });
  31. }
  32. };
  33. function getServerTime(){
  34. var nowTime = "";
  35. $.ajax({//后台获取系统当前时间
  36. url : $.pathname()+ '/ws/response/responseService/getNowTime',
  37. type : 'post',
  38. dataType : 'text',
  39. async : false,
  40. success : function(result){
  41. nowTime=result;
  42. },error : function(e){
  43. top.Dialog.alert("获取后台时间失败!");
  44. return nowTime;
  45. }
  46. });
  47. return nowTime;
  48. }
  49. /******
  50. 选择事件类型
  51. *******/
  52. function changeEventType(){
  53. var selectType = $("#EVENT_TYPE_363").attr("relvalue");
  54. var table = $("#this_table");
  55. var allTr = $("#this_table>tr:gt(0)");
  56. allTr.remove();
  57. if(selectType=="台风"){
  58. //事件日期
  59. var tr1 = $("<tr></tr>");
  60. table.append(tr1);
  61. tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
  62. var td1 = $("<td align='left'></td>");
  63. tr1.append(td1);
  64. var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM' id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
  65. input1.render();
  66. td1.append(input1);
  67. //台风编号
  68. var tr2 = $("<tr></tr>");
  69. table.append(tr2);
  70. tr2.append("<td align='right'><div ><span class='star'>*</span>台风编号:</div></td>");
  71. var td2 = $("<td align='left'></td>");
  72. tr2.append(td2);
  73. var input2 = $("<input type='text' class='validate[required,custom[onlyNumber]]' id='EVENT_NUM_363' inputMode='numberOnly' name='EVENT_NUM_363' maxLength='10'/>");
  74. input2.render();
  75. td2.append(input2);
  76. //台风名称
  77. var tr3 = $("<tr></tr>");
  78. table.append(tr3);
  79. tr3.append("<td align='right'><div ><span class='star'>*</span>台风名称:</div></td>");
  80. var td3 = $("<td align='left'></td>");
  81. tr3.append(td3);
  82. var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' name='EVENT_PLACE_363' maxLength='20'/>");
  83. input3.render();
  84. td3.append(input3);
  85. }else if(selectType=="地震"){
  86. //事件日期
  87. var tr1 = $("<tr></tr>");
  88. table.append(tr1);
  89. tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
  90. var td1 = $("<td align='left'></td>");
  91. tr1.append(td1);
  92. var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM-dd' id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
  93. input1.render();
  94. td1.append(input1);
  95. //震级
  96. var tr2 = $("<tr></tr>");
  97. table.append(tr2);
  98. tr2.append("<td align='right'><div ><span class='star'>*</span>震级:</div></td>");
  99. var td2 = $("<td align='left'></td>");
  100. tr2.append(td2);
  101. var input2 = $("<input type='text' id='EVENT_NUM_363' class='validate[required]' name='EVENT_NUM_363' maxLength='10'/>");
  102. input2.render();
  103. td2.append(input2);
  104. //地震位置
  105. var tr3 = $("<tr></tr>");
  106. table.append(tr3);
  107. tr3.append("<td align='right'><div ><span class='star'>*</span>地震位置:</div></td>");
  108. var td3 = $("<td align='left'></td>");
  109. tr3.append(td3);
  110. var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' name='EVENT_PLACE_363' maxLength='20'/>");
  111. input3.render();
  112. td3.append(input3);
  113. }else if(selectType=="冰灾"){
  114. //事件日期
  115. var tr1 = $("<tr></tr>");
  116. table.append(tr1);
  117. tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
  118. var td1 = $("<td align='left'></td>");
  119. tr1.append(td1);
  120. var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM-dd' id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
  121. input1.render();
  122. td1.append(input1);
  123. //名称
  124. var tr3 = $("<tr></tr>");
  125. table.append(tr3);
  126. tr3.append("<td align='right'><div ><span class='star'>*</span>名称:</div></td>");
  127. var td3 = $("<td align='left'></td>");
  128. tr3.append(td3);
  129. var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' value='低温雨雪冰冻灾害' name='EVENT_PLACE_363' maxLength='20'/>");
  130. input3.render();
  131. td3.append(input3);
  132. }else if(selectType=="降水"){
  133. //事件日期
  134. var tr1 = $("<tr></tr>");
  135. table.append(tr1);
  136. tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
  137. var td1 = $("<td align='left'></td>");
  138. tr1.append(td1);
  139. var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM-dd'id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
  140. input1.render();
  141. td1.append(input1);
  142. //名称
  143. var tr3 = $("<tr></tr>");
  144. table.append(tr3);
  145. tr3.append("<td align='right'><div ><span class='star'>*</span>名称:</div></td>");
  146. var td3 = $("<td align='left'></td>");
  147. tr3.append(td3);
  148. var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' value='降水' name='EVENT_PLACE_363' maxLength='20'/>");
  149. input3.render();
  150. td3.append(input3);
  151. }else if(selectType=="其他"){
  152. //事件日期
  153. var tr1 = $("<tr></tr>");
  154. table.append(tr1);
  155. tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
  156. var td1 = $("<td align='left'></td>");
  157. tr1.append(td1);
  158. var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM-dd'id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
  159. input1.render();
  160. td1.append(input1);
  161. //名称
  162. var tr3 = $("<tr></tr>");
  163. table.append(tr3);
  164. tr3.append("<td align='right'><div ><span class='star'>*</span>名称:</div></td>");
  165. var td3 = $("<td align='left'></td>");
  166. tr3.append(td3);
  167. var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' name='EVENT_PLACE_363' maxLength='20'/>");
  168. input3.render();
  169. td3.append(input3);
  170. }
  171. }
  172. /***
  173. * 获取事件名称,拼接
  174. * 赋值
  175. */
  176. function getEventName(){
  177. var selectType = $("#EVENT_TYPE_363").attr("relvalue");
  178. var name = "";
  179. if(selectType=="台风"){
  180. name = $("#EVENT_DATE_363").val()+"_"+$("#EVENT_NUM_363").val()+selectType+$("#EVENT_PLACE_363").val();
  181. }else if(selectType=="地震"){
  182. name = $("#EVENT_DATE_363").val()+"_"+$("#EVENT_PLACE_363").val()+$("#EVENT_NUM_363").val()+selectType;
  183. }else{
  184. name = $("#EVENT_DATE_363").val()+"_"+$("#EVENT_PLACE_363").val();
  185. }
  186. $("#EVENT_NAME_363").val(name);
  187. }