296e05582666c59c711b6bd2a33ac30328fce21c.svn-base 7.0 KB

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